[FFmpeg-devel] TCP timeout for HTTP/HTTPS connections.

Steven Liu lq at chinaffmpeg.org
Mon Nov 18 11:43:28 EET 2019



> 在 2019年11月18日,17:32,Tom Gaudasiński <tomg at records.headdesk.com.au> 写道:
> 
> How do I append “#EXT-X-ENDLIST” to the end of the m3u8 using the API?
> The URL I get ffmpeg to open is the m3u8 file, so I somehow need to do
> it in memory, I presume?
> 
Hello Tom,

	Can you try this patch please:
	https://patchwork.ffmpeg.org/patch/16316/
> 
> 
> On 18/11/19 8:00 pm, Steven Liu wrote:
>> 
>>> 在 2019年11月18日,16:44,Tom Gaudasiński <tomg at records.headdesk.com.au> 写道:
>>> 
>>> That would probably work in the one case where it's looking at the next
>>> entry in the list. It's actually blocking on a read, so I need some way
>>> to interrupt it. I will try AVIOInterruptCB and see how I go.
>> AVIOInterruptCB maybe ok if that is blocking. But is dose not useful if it always refresh m3u8.
>>> 
>>> 
>>> On 18/11/19 7:36 pm, Steven Liu wrote:
>>>>> 在 2019年11月18日,16:11,Tom Gaudasiński <tomg at records.headdesk.com.au> 写道:
>>>>> 
>>>>> I essentially have a thread that I need to have exit immediately.  I
>>>>> thought tweaking timeouts would be one way to get this done, but I'm
>>>>> starting to think that's a bad approach.
>>>>> 
>>>>> So, let me, maybe, rephrase the question: Is there a way I can tell
>>>>> ffmpeg to terminate? Like, closing its sockets, or something like that?
>>>>> This is all from another thread.
>>>> Just append an “#EXT-X-ENDLIST” into the m3u8 list is ok.
>>>> 
>>>>> On 18/11/19 7:06 pm, Steven Liu wrote:
>>>>>>> 在 2019年11月18日,15:37,Tom Gaudasiński <tomg at records.headdesk.com.au> 写道:
>>>>>>> 
>>>>>>> That seems to change the call-stack a bit, but it still gets stuck on
>>>>>>> something in hls.c.
>>>>>>> 
>>>>>>> I'm looking into what it is. I've also tried connect_timeout.
>>>>>>> 
>>>>>>> I really just need to terminate the av_read_frame call, so that it
>>>>>>> returns immediately when I need it to, but av_read_frame appears to
>>>>>>> reconnect internally.
>>>>>> Ah, maybe i get your point, do you mean you don’t like the hls always retry 
>>>>>> get the m3u8 list when the last segment don’t update living mode?
>>>>>> 
>>>>>>> On 18/11/19 6:02 pm, Steven Liu wrote:
>>>>>>>>> 在 2019年11月18日,14:56,Tom Gaudasiński <tomg at records.headdesk.com.au> 写道:
>>>>>>>>> 
>>>>>>>>> I'm trying to set a read timeout for a http/https stream through the
>>>>>>>>> API. Currently I'm passing...
>>>>>>>>> 
>>>>>>>>>   av_dict_set(&options, "timeout", "100000", 0);
>>>>>>>>> 
>>>>>>>>> ... to avformat_open_input().
>>>>>>>>> 
>>>>>>>>> This appears to not work once the connection has been established. The
>>>>>>>>> protocol call-stack appears to be
>>>>>>>>> 
>>>>>>>>> hls.c -> http.c -> avio.c -> tcp.c -> network.c
>>>>>>>> What about use rw_timeout ?
>>>>>>>>> The issue, I think, is that tcp.c only gets it's timeout from a
>>>>>>>>> ?key=val&key=val  string at the end of the URL supplied to tcp.c, but
>>>>>>>>> http.c or avio.c don't supply this. In fact, when I see what was passed
>>>>>>>>> down, it's just "tcp://hostname.tld:80".
>>>>>>>>> 
>>>>>>>>> Am I missing something? Is there a way to get ffmpeg to set tcp-timeout
>>>>>>>>> from the very top-level API calls? I can't see it.
>>>>>>>>> 
>>>>>>>>> Thank you.
>>>>>>>>> 
>>>>>>>>> --Tom G.
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> _______________________________________________
>>>>>>>>> ffmpeg-devel mailing list
>>>>>>>>> ffmpeg-devel at ffmpeg.org
>>>>>>>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>>>>>>> 
>>>>>>>>> To unsubscribe, visit link above, or email
>>>>>>>>> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>>>>>>>> Thanks
>>>>>>>> Steven
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> _______________________________________________
>>>>>>>> ffmpeg-devel mailing list
>>>>>>>> ffmpeg-devel at ffmpeg.org
>>>>>>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>>>>>> 
>>>>>>>> To unsubscribe, visit link above, or email
>>>>>>>> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>>>>>>> _______________________________________________
>>>>>>> ffmpeg-devel mailing list
>>>>>>> ffmpeg-devel at ffmpeg.org
>>>>>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>>>>> 
>>>>>>> To unsubscribe, visit link above, or email
>>>>>>> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>>>>>> Thanks
>>>>>> Steven
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> _______________________________________________
>>>>>> ffmpeg-devel mailing list
>>>>>> ffmpeg-devel at ffmpeg.org
>>>>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>>>> 
>>>>>> To unsubscribe, visit link above, or email
>>>>>> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>>>>> _______________________________________________
>>>>> ffmpeg-devel mailing list
>>>>> ffmpeg-devel at ffmpeg.org
>>>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>>> 
>>>>> To unsubscribe, visit link above, or email
>>>>> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>>>> Thanks
>>>> Steven
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> _______________________________________________
>>>> ffmpeg-devel mailing list
>>>> ffmpeg-devel at ffmpeg.org
>>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>> 
>>>> To unsubscribe, visit link above, or email
>>>> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>>> 
>>> _______________________________________________
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel at ffmpeg.org
>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>> 
>>> To unsubscribe, visit link above, or email
>>> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>> Thanks
>> Steven
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>> 
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
> 
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".

Thanks
Steven







More information about the ffmpeg-devel mailing list