[FFmpeg-devel] [PATCH] Yield on AVERROR(EAGAIN).

Ramiro Polla ramiro.polla
Fri Mar 5 14:17:57 CET 2010


On Fri, Mar 5, 2010 at 10:13 AM, Nicolas George
<nicolas.george at normalesup.org> wrote:
> Le quartidi 14 vent?se, an CCXVIII, Ramiro Polla a ?crit?:
>> ? ? ? ? ?ret = av_read_frame_internal(ic, &pkt1);
>> - ? ? ? ?if(ret == AVERROR(EAGAIN))
>> + ? ? ? ?if(ret == AVERROR(EAGAIN)) {
>> + ? ? ? ? ? ?ff_yield();
>> ? ? ? ? ? ? ?continue;
>> + ? ? ? ?}
>
> What gain do you expect from that code, be it the current or modified
> version?

CPU usage.

> Reading from a source in a non-blocking way makes sense if we do something
> else, something useful, when there is no data available. If we just run
> around waiting for more data, that is useless, whether it eats CPU or not:

> just put the source in blocking mode and be done with it.

If we could toggle nonblock after the device has been init'ed, yes
that would be better.



More information about the ffmpeg-devel mailing list