]> git.sesse.net Git - ffmpeg/commitdiff
avformat/hlsenc: Option to set timeout for socket I/O operation
authorRavindra <rpatagar@akamai.com>
Wed, 14 Mar 2018 11:59:34 +0000 (19:59 +0800)
committerSteven Liu <lq@chinaffmpeg.org>
Wed, 14 Mar 2018 11:59:34 +0000 (19:59 +0800)
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
doc/muxers.texi
libavformat/hlsenc.c

index c156ec0c87ba45ae393080e45f364fe8418db8b0..3a63da7fe72d02b58450ec9d6e7038826923caf2 100644 (file)
@@ -964,6 +964,9 @@ publishing it repeatedly every after 30 segments i.e. every after 60s.
 @item http_persistent
 Use persistent HTTP connections. Applicable only for HTTP output.
 
+@item timeout
+Set timeout for socket I/O operations. Applicable only for HTTP output.
+
 @end table
 
 @anchor{ico}
index 7d9512b6648f3f302bf7da403886fc1adac6c59c..58d403d3fa4dd0ce063a3c5dd1b522480ddfae68 100644 (file)
@@ -224,6 +224,7 @@ typedef struct HLSContext {
     int http_persistent;
     AVIOContext *m3u8_out;
     AVIOContext *sub_m3u8_out;
+    int64_t timeout;
 } HLSContext;
 
 static int mkdir_p(const char *path) {
@@ -305,7 +306,8 @@ static void set_http_options(AVFormatContext *s, AVDictionary **options, HLSCont
         av_dict_set(options, "user_agent", c->user_agent, 0);
     if (c->http_persistent)
         av_dict_set_int(options, "multiple_requests", 1, 0);
-
+    if (c->timeout >= 0)
+        av_dict_set_int(options, "timeout", c->timeout, 0);
 }
 
 static void write_codec_attr(AVStream *st, VariantStream *vs) {
@@ -2792,6 +2794,7 @@ static const AVOption options[] = {
     {"master_pl_name", "Create HLS master playlist with this name", OFFSET(master_pl_name), AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,    E},
     {"master_pl_publish_rate", "Publish master play list every after this many segment intervals", OFFSET(master_publish_rate), AV_OPT_TYPE_INT, {.i64 = 0}, 0, UINT_MAX, E},
     {"http_persistent", "Use persistent HTTP connections", OFFSET(http_persistent), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, E },
+    {"timeout", "set timeout for socket I/O operations", OFFSET(timeout), AV_OPT_TYPE_DURATION, { .i64 = -1 }, -1, INT_MAX, .flags = E },
     { NULL },
 };