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

Luca Abeni lucabe72
Tue Mar 3 14:01:48 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.

I guess you want to set AVFMT_FLAG_NONBLOCK on input files, right?
It seems to me that your patch sets it on the output... The attached
fix-ffmpeg-nonblock.diff sets the flag for the inputs too (I hope ;-).

I tried it, and it already uncovered a small bug in the alsa input
device (see attached fix-alsa-nonblock.diff.

I tested capturing some audio with the two attached patches (without them,
nothing changes...) and it seems to me that this is working (easy,,, I
only have a single input ;-). I see a near-100% CPU load, so I guess a
usleep() somewhere (or something similar) is really needed.

The alsa fix seems simple enough (and looks surely correct), so I'll apply
it in few days unless anyone screams. I think for your patch we miss some
way to force the old blocking behaviour through a command line switch.
Then, I am in favour of it.

I'll report the results of some other tests in the next days.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fix-alsa-nonblock.diff
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090303/944ad1d0/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fix-ffmpeg-nonblock.diff
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090303/944ad1d0/attachment.asc>

More information about the ffmpeg-devel mailing list