diff mbox

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

Message ID 1520242864-1380-1-git-send-email-rpatagar@akamai.com
State Accepted
Commit 6010537956d5a7260f2dd52184779fe01a085a2b
Headers show

Commit Message

Patagar, Ravindra March 5, 2018, 9:41 a.m. UTC
From: Ravindra <rpatagar@akamai.com>

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

Comments

Liu Steven March 6, 2018, 8:42 a.m. UTC | #1
> On 5 Mar 2018, at 17:41, rpatagar@akamai.com wrote:
> 
> From: Ravindra <rpatagar@akamai.com>
> 
> ---
> 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 c156ec0..3a63da7 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -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}
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 08fe0aa..5d462da 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -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 },
> };
> 
> -- 
> 1.9.1
> 

Will apply!

Thanks
Steven
Dixit, Vishwanath March 14, 2018, 11:45 a.m. UTC | #2
On 3/6/18 2:12 PM, Steven Liu wrote:
>

>

>> On 5 Mar 2018, at 17:41, rpatagar@akamai.com wrote:

>>

>> From: Ravindra <rpatagar@akamai.com>

>>

>> ---

>> 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 c156ec0..3a63da7 100644

>> --- a/doc/muxers.texi

>> +++ b/doc/muxers.texi

>> @@ -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}

>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c

>> index 08fe0aa..5d462da 100644

>> --- a/libavformat/hlsenc.c

>> +++ b/libavformat/hlsenc.c

>> @@ -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 },

>> };

>>

>> -- 

>> 1.9.1

>>

>

> Will apply!

>

Hi Steven,

Could you please apply this patch. 

PS: following up on behalf of Ravindra Patagar

Regards,
Vishwanath
Liu Steven March 14, 2018, 11:57 a.m. UTC | #3
> On 14 Mar 2018, at 19:45, Dixit, Vishwanath <vdixit@akamai.com> wrote:
> 
> 
> On 3/6/18 2:12 PM, Steven Liu wrote:
>> 
>> 
>>> On 5 Mar 2018, at 17:41, rpatagar@akamai.com wrote:
>>> 
>>> From: Ravindra <rpatagar@akamai.com>
>>> 
>>> ---
>>> 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 c156ec0..3a63da7 100644
>>> --- a/doc/muxers.texi
>>> +++ b/doc/muxers.texi
>>> @@ -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}
>>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>>> index 08fe0aa..5d462da 100644
>>> --- a/libavformat/hlsenc.c
>>> +++ b/libavformat/hlsenc.c
>>> @@ -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 },
>>> };
>>> 
>>> -- 
>>> 1.9.1
>>> 
>> 
>> Will apply!
>> 
> Hi Steven,
> 
> Could you please apply this patch. 
Oops, Sorry for delay apply this, i pushed it now.
> 
> PS: following up on behalf of Ravindra Patagar
> 
> Regards,
> Vishwanath
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Thanks
Steven
Liu Steven March 14, 2018, 12:01 p.m. UTC | #4
> On 14 Mar 2018, at 19:57, Steven Liu <lq@chinaffmpeg.org> wrote:
> 
> 
> 
>> On 14 Mar 2018, at 19:45, Dixit, Vishwanath <vdixit@akamai.com> wrote:
>> 
>> 
>> On 3/6/18 2:12 PM, Steven Liu wrote:
>>> 
>>> 
>>>> On 5 Mar 2018, at 17:41, rpatagar@akamai.com wrote:
>>>> 
>>>> From: Ravindra <rpatagar@akamai.com>
>>>> 
>>>> ---
>>>> 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 c156ec0..3a63da7 100644
>>>> --- a/doc/muxers.texi
>>>> +++ b/doc/muxers.texi
>>>> @@ -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}
>>>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>>>> index 08fe0aa..5d462da 100644
>>>> --- a/libavformat/hlsenc.c
>>>> +++ b/libavformat/hlsenc.c
>>>> @@ -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 },
>>>> };
>>>> 
>>>> -- 
>>>> 1.9.1
>>>> 
>>> 
>>> Will apply!
>>> 
>> Hi Steven,
>> 
>> Could you please apply this patch. 
> Oops, Sorry for delay apply this, i pushed it now.
Done.
>> 
>> PS: following up on behalf of Ravindra Patagar
>> 
>> Regards,
>> Vishwanath
>> 
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> Thanks
> Steven

Thanks
Steven
Dixit, Vishwanath March 14, 2018, 1:25 p.m. UTC | #5
On 3/14/18 5:31 PM, Steven Liu wrote:
>

>

>> On 14 Mar 2018, at 19:57, Steven Liu <lq@chinaffmpeg.org> wrote:

>>

>>

>>

>>> On 14 Mar 2018, at 19:45, Dixit, Vishwanath <vdixit@akamai.com> wrote:

>>>

>>>

>>> On 3/6/18 2:12 PM, Steven Liu wrote:

>>>>

>>>>

>>>>> On 5 Mar 2018, at 17:41, rpatagar@akamai.com wrote:

>>>>>

>>>>> From: Ravindra <rpatagar@akamai.com>

>>>>>

>>>>> ---

>>>>> 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 c156ec0..3a63da7 100644

>>>>> --- a/doc/muxers.texi

>>>>> +++ b/doc/muxers.texi

>>>>> @@ -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}

>>>>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c

>>>>> index 08fe0aa..5d462da 100644

>>>>> --- a/libavformat/hlsenc.c

>>>>> +++ b/libavformat/hlsenc.c

>>>>> @@ -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 },

>>>>> };

>>>>>

>>>>> -- 

>>>>> 1.9.1

>>>>>

>>>>

>>>> Will apply!

>>>>

>>> Hi Steven,

>>>

>>> Could you please apply this patch. 

>> Oops, Sorry for delay apply this, i pushed it now.

> Done.

>>>

Thank you Steven…
diff mbox

Patch

diff --git a/doc/muxers.texi b/doc/muxers.texi
index c156ec0..3a63da7 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -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}
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 08fe0aa..5d462da 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -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 },
 };