[FFmpeg-devel] [PATCH 4/4] libavformat/hlsenc: Persistent HTTP connections supported as an option

Karthick J kjeyapal at akamai.com
Fri Nov 3 10:27:03 EET 2017


---
 doc/muxers.texi      | 3 +++
 libavformat/hlsenc.c | 5 ++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 91bbe67..1e1468c 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -794,6 +794,9 @@ files.
 @item http_user_agent
 Override User-Agent field in HTTP header. Applicable only for HTTP output.
 
+ at item http_persistent
+Use persistent HTTP connections. Applicable only for HTTP output.
+
 @end table
 
 @anchor{ico}
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 5ea9d21..79db77a 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -175,6 +175,7 @@ typedef struct HLSContext {
     double initial_prog_date_time;
     char current_segment_final_filename_fmt[1024]; // when renaming segments
     char *user_agent;
+    int http_persistent;
 } HLSContext;
 
 static int get_int_from_double(double val)
@@ -228,7 +229,8 @@ static void set_http_options(AVFormatContext *s, AVDictionary **options, HLSCont
     }
     if (c->user_agent)
         av_dict_set(options, "user_agent", c->user_agent, 0);
-
+    if (c->http_persistent)
+        av_dict_set_int(options, "multiple_requests", c->http_persistent, 0);
 }
 
 static int replace_int_data_in_filename(char *buf, int buf_size, const char *filename, char placeholder, int64_t number)
@@ -1829,6 +1831,7 @@ static const AVOption options[] = {
     {"epoch", "seconds since epoch", 0, AV_OPT_TYPE_CONST, {.i64 = HLS_START_SEQUENCE_AS_SECONDS_SINCE_EPOCH }, INT_MIN, INT_MAX, E, "start_sequence_source_type" },
     {"datetime", "current datetime as YYYYMMDDhhmmss", 0, AV_OPT_TYPE_CONST, {.i64 = HLS_START_SEQUENCE_AS_FORMATTED_DATETIME }, INT_MIN, INT_MAX, E, "start_sequence_source_type" },
     {"http_user_agent", "override User-Agent field in HTTP header", OFFSET(user_agent), AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,    E},
+    {"http_persistent", "Use persistent HTTP connections", OFFSET(http_persistent), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, E },
     { NULL },
 };
 
-- 
1.9.1



More information about the ffmpeg-devel mailing list