[FFmpeg-devel] [PATCH] What is missing for working AVFMT_FLAG_NONBLOCK?

Luca Abeni lucabe72
Tue Mar 3 08:22:10 CET 2009

Hi Michael,

Michael Niedermayer wrote:
> On Tue, Mar 03, 2009 at 03:06:21AM +0100, Michael Niedermayer wrote:
>> Hi
>> AVFMT_FLAG_NONBLOCK is not enabled in ffmpeg/ffplay.c
>> what is missing for it?
>> capturing from several devices is likely going to work better if they
>> dont block. And yes i know it all should be using select() but that is
>> harder. And simple polling with non blocking demuxers should already
>> work pretty well.
>> is the only thing missing the code in ffmpeg.c that picks files
>> based on the next expected timestamp?
>> id like to set AVFMT_FLAG_NONBLOCK by default in ffmpeg.c
> The patch that i had in mind is below, passes reg tests

I'll test this patch today, with alsa and v4l2 input. Tomorrow I'll
hopefully be able to perform some more interesting tests (OSS and some
more v4l2 devices... I do not know if I still have a v4l device).
I'll post the results.

Maybe I am missing something in your patch, but I fear it will cause a
100% CPU usage (this can be addressed with a "strategic usleep()" in the
correct place - not nice, but I do not see better solutions without using

Also, I think your patch does not allow the user to force a
"no AVFMT_FLAG_NONBLOCK" setting... This could be useful in case something
goes wrong (if the patch allows the user to force the blocking behaviour, I
guess the patch should go in soon).


More information about the ffmpeg-devel mailing list