[FFmpeg-devel] [PATCH] allow rtsp reading to be non blocking

Luca Abeni lucabe72
Sun Oct 14 18:53:46 CEST 2007


On Sun, 2007-10-14 at 13:32 +0200, elupus wrote:
> "Luca Abeni" <lucabe72 at email.it> wrote in message 
> > I think that a call to ff_socket_nonblock() should be added to then open
> > function (maybe to udp_open()?) if AVFMT_FLAG_NONBLOCK is set.
> >
> > When is this patch needed? How has it been tested?
> Not really needed. As one can accomplish the same with the timeout's sorta. 
> But it's a cleaner way to get away from ffmpeg blocking forever on stalled 
> rtsp/rtp udp streams.
I do not think that AVFMT_FLAG_NONBLOCK has much to do with stalled
network streams (as you say, a timeout is sufficient to detect a stalled

And, as far as I can see, your patch does not really implement a
non-blocking behaviour (reading a packet can block up to 100ms).

> aren't a socket read required to be nonblocking if select has returned that 
> they are readable? Maybe not, didn't check the specs.
If select() returns that a socket is readable, a read() on it will not
block... But select() already blocked until some data is available on
the socket. So, av_read_frame() blocks


More information about the ffmpeg-devel mailing list