[FFmpeg-devel] [PATCH] Yield on AVERROR(EAGAIN).
Reimar Döffinger
Reimar.Doeffinger
Sat Mar 6 15:00:45 CET 2010
On Fri, Mar 05, 2010 at 11:36:55AM +0100, Michael Niedermayer wrote:
> On Fri, Mar 05, 2010 at 08:23:07AM +0100, Reimar D?ffinger wrote:
> > Now the issue is a bit larger if audio and video are separate, we can't block
> > on one while the other overflows a buffer, but a 10ms select in each of the
> > devices that currently cause this issue should be enough, shouldn't it?
>
> demuxers or protocols blocking a single thread application is bad.
> and not scaleable at all
> if you imagine a video security system with 5 cameras, from which do you
> read? (each can block you by 10ms if it has no video but at 30fps reading
> from 4 cams that had no video will cause the fifth to drop a frame)
> if each immedeatly returns EAGAIN you can poll all with near zero cpu time
> and then sleep for 1-10ms in a central place once and not per camera
Well, it would for fine for the average case.
However another option would be to add a timeout and pass that one
through all the contexts.
Then e.g. an application could set the timeout to 0 as long as it has received
data from at least one stream and if once it hasn't received any input from
anywhere it could set a timeout like 10 ms on the one it considers most
critical and read from it.
Basically a sleep-and-read-in-one package.
Probably I'm missing some issues, but right now it sounds like a nice
and not too complex idea to me.
More information about the ffmpeg-devel
mailing list