[FFmpeg-devel] network blocking

Tamas Selmeci tselmeci
Fri Feb 26 08:55:01 CET 2010

Hi all!

In the application I'm writing ffmpeg is being used as a demuxer/parser 
library for MP3 netradio streams. At the moment only used for receiving 
the stream as frames. Everything works well, as long as there's an 
existing network connection.

If network connection goes down (cable unplugged, wifi loses signal, 
bluetooth disconnects and so on), ffmpeg gets stucked. I mean, these are 
the two most serious problems:
-1) networks goes down during av_open_input_file(...), this function 
refuses to return immediately;
-2) network goes down during av_read_frame(...), also does not return 

Since the application should provide quite fast responses to such 
events, the current behaviour is not adequate. Those calls return after 
a lot of seconds, meanwhile my application (the related thread) is blocked.

I have some experience with socket programming, under 
/proc/sys/net/ipv4/ a lot of things can be adjusted. My first idea is to 
adjust the proper timeout setting, so the mentioned libav calls would 
return quick (if my assumption is right).

If that does not work, I'll have to inspect libav sources and perform 
some modification...

Could you please give my some directions on how to start solving this 

Many thanks, regards,
Selmeci, Tamas

More information about the ffmpeg-devel mailing list