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

Luca Abeni lucabe72
Tue Mar 3 23:03:13 CET 2009


Hi Michael,

Michael Niedermayer wrote:
[...]
>> I was not suggesting usleep(0) (which, of course, is not better than 
>> sched_yield()): I was just wondering if we might be able to predict when 
>> the next frame will be available, and to usleep() for the right amount 
>> of time... Anyway, this can be committed in a second time (if worth), 
>> after your patch is committed.
> 
> what my oppinion is, is that its not the user applications job to guess
> this, thats also why i considerd sched_yield() more correct than
> usleep(something).

Well, I am not sure if I agree here (it would be nice to have a syscall 
that behaves as you describe, but I do not think sched_yield() does 
this) but the discussion risks to go off-topic.
Just one last proposal: instead of "usleep(10000)", with 10000 being an 
arbitrary constant, we probably can use a smarter constant. If all the 
streams have frames with a fixed duration (and I think this assumption 
is reasonable for live inputs) and t_min is the minimum frame duration, 
we can do usleep(t_min / 2).
This should ensure that we do not have overruns on any input, and should 
avoid too many useless polls.

Just an idea... If you think this is overkilling, or does not make 
sense, just ignore it.


				Thanks,
					Luca




More information about the ffmpeg-devel mailing list