[FFmpeg-devel] [PATCH] libavdevice: JACK demuxer

Luca Abeni lucabe72
Fri Feb 27 21:30:05 CET 2009


Olivier Guilyardi wrote:
[...]
>> What do you need usleep() for?  Sleeping in an input handler smells of
>> bad design.
>>
> 
> The jack process callback, which runs in the JACK realtime thread, reads audio
> from JACK. It then places this data into a ringbuffer, for the
> audio_read_packet() callback to fetch it, and return it in a AVPacket. It the
> ringbuffer is empty at this point, audio_read_packet() sleeps a period, tries
> again, etc.... It times out after 2 seconds.

I think you should return EAGAIN if AVFMT_FLAG_NONBLOCK is set or block 
if it is not set... Using usleep() and polling does not look a nice 
solution, but I do not know if there are other possibilities.


			Luca




More information about the ffmpeg-devel mailing list