diff mbox

[FFmpeg-devel,1/1] libavformat/dashenc: Option to set timeout for socket I/O operation

Message ID 1519973860-25623-1-git-send-email-rpatagar@akamai.com
State Superseded
Headers show

Commit Message

Patagar, Ravindra March 2, 2018, 6:57 a.m. UTC
From: Ravindra Patagar <rpatagar@akamai.com>

Signed-off-by: Ravindra <rpatagar@akamai.com>
---
 doc/muxers.texi       | 2 ++
 libavformat/dashenc.c | 4 ++++
 2 files changed, 6 insertions(+)

Comments

Michael Niedermayer March 2, 2018, 9:42 p.m. UTC | #1
On Fri, Mar 02, 2018 at 12:27:40PM +0530, rpatagar@akamai.com wrote:
> From: Ravindra Patagar <rpatagar@akamai.com>
> 
> Signed-off-by: Ravindra <rpatagar@akamai.com>
> ---
>  doc/muxers.texi       | 2 ++
>  libavformat/dashenc.c | 4 ++++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index e41f8c6..c456a42 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -264,6 +264,8 @@ of the adaptation sets and a,b,c,d and e are the indices of the mapped streams.
>  To map all video (or audio) streams to an AdaptationSet, "v" (or "a") can be used as stream identifier instead of IDs.
>  
>  When no assignment is defined, this defaults to an AdaptationSet for each stream.
> +@item -timeout @var{timeout}
> +Set timeout (in microseconds) for socket I/O operations. Applicable only for HTTP output.
>  @end table
>  
>  @anchor{framecrc}
> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> index 83e0cff..3b4346d 100644
> --- a/libavformat/dashenc.c
> +++ b/libavformat/dashenc.c
> @@ -117,6 +117,7 @@ typedef struct DASHContext {
>      AVIOContext *mpd_out;
>      AVIOContext *m3u8_out;
>      int streaming;
> +    int timeout;
>  } DASHContext;
>  
>  static struct codec_string {
> @@ -269,6 +270,8 @@ static void set_http_options(AVDictionary **options, DASHContext *c)
>          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 get_hls_playlist_name(char *playlist_name, int string_size,
> @@ -1418,6 +1421,7 @@ static const AVOption options[] = {
>      { "http_persistent", "Use persistent HTTP connections", OFFSET(http_persistent), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, E },
>      { "hls_playlist", "Generate HLS playlist files(master.m3u8, media_%d.m3u8)", OFFSET(hls_playlist), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E },
>      { "streaming", "Enable/Disable streaming mode of output. Each frame will be moof fragment", OFFSET(streaming), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E },
> +    { "timeout", "set timeout (in microseconds) for socket I/O operations", OFFSET(timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = E },
>      { NULL },

newly added time* options should use AV_OPT_TYPE_DURATION for consistency


[...]
diff mbox

Patch

diff --git a/doc/muxers.texi b/doc/muxers.texi
index e41f8c6..c456a42 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -264,6 +264,8 @@  of the adaptation sets and a,b,c,d and e are the indices of the mapped streams.
 To map all video (or audio) streams to an AdaptationSet, "v" (or "a") can be used as stream identifier instead of IDs.
 
 When no assignment is defined, this defaults to an AdaptationSet for each stream.
+@item -timeout @var{timeout}
+Set timeout (in microseconds) for socket I/O operations. Applicable only for HTTP output.
 @end table
 
 @anchor{framecrc}
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 83e0cff..3b4346d 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -117,6 +117,7 @@  typedef struct DASHContext {
     AVIOContext *mpd_out;
     AVIOContext *m3u8_out;
     int streaming;
+    int timeout;
 } DASHContext;
 
 static struct codec_string {
@@ -269,6 +270,8 @@  static void set_http_options(AVDictionary **options, DASHContext *c)
         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 get_hls_playlist_name(char *playlist_name, int string_size,
@@ -1418,6 +1421,7 @@  static const AVOption options[] = {
     { "http_persistent", "Use persistent HTTP connections", OFFSET(http_persistent), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, E },
     { "hls_playlist", "Generate HLS playlist files(master.m3u8, media_%d.m3u8)", OFFSET(hls_playlist), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E },
     { "streaming", "Enable/Disable streaming mode of output. Each frame will be moof fragment", OFFSET(streaming), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E },
+    { "timeout", "set timeout (in microseconds) for socket I/O operations", OFFSET(timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = E },
     { NULL },
 };