[FFmpeg-devel] [PATCH 1/1] avformat/tcp: support timeout for getaddrinfo For fixing stucking when resolving addrinfo
zhangxzheng at gmail.com
Thu Jun 9 07:19:21 CEST 2016
On Tue, Jun 7, 2016 at 5:42 AM, Michael Niedermayer
<michael at niedermayer.cc> wrote:
> On Wed, Jun 01, 2016 at 12:03:32PM +0800, XinZheng Zhang wrote:
>> On Tue, May 31, 2016 at 9:33 PM, Hendrik Leppkes <h.leppkes at gmail.com> wrote:
>> > On Tue, May 31, 2016 at 2:58 PM, Xinzheng Zhang <zhangxzheng at gmail.com> wrote:
>> > > ---
>> > > libavformat/tcp.c | 215 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> > > 1 file changed, 215 insertions(+)
>> > >
>> > This whole patch looks extremely complicated and long for something
>> > hidden behind a tiny option not saying much.
>> > Maybe you should start by elaborating in detail what you are trying to
>> > fix, how you are fixing it, and why you choose this approach and not
>> > any others that may appear simpler.
>> For some ugly network conditions(Eg.Mobile device in a WiFi network,
>> but offline from internet), getaddrinfo() could block tcp_open() for a
>> long time,
>> neither timeout nor interrupt callback can save us.
>> There are serveral way to fix this issue
>> AFAIK. We can use `getaddrinfo_a` on some linux platform
>> But, it doesn't work on other platforms.
> would the getaddrinfo_a() based code be simple ?
> if so i think thats the way to go
> If one really wants one could implement getaddrinfo_a() emulation
> with a thread on other platforms. That should still be cleaner then
> stuffing this code into tcp.c
> above is just a suggestion
I thought that create and destory a thread everty time
for reolving addrinfo is such a waste thing, but as said that
there are no global thread pool or other background facility in ffmpeg,
and on most platform there has not getaddrinfo_a().
Wrap there code to a function like getaddrinfo_a(),
will make these horrible thing to be invisible.
Considering that so I choose to stuff these code into tcp.c
I know that I should implement sth maybe called ff_getaddrinfo_a().
But I do not know how...(Specially in iOS and Android platform).
Any suggestion will be helpful, thanks a lot.
Sorry for the late reply.
More information about the ffmpeg-devel