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

Michael Niedermayer michaelni
Fri Mar 5 16:26:29 CET 2010


On Fri, Mar 05, 2010 at 01:34:33PM +0100, Nicolas George wrote:
> Le quintidi 15 vent?se, an CCXVIII, Michael Niedermayer a ?crit?:
> > i dont understand you, libavdevice/jack_audio.c for example alraedy uses
> > a seperate thread (its the way how jack is supposed to be used it seems)
> > and without any AVThreadInfo
> 
> I was thinking of a generic solution: code in the library that can run any
> device in a separate thread without requiring any change at all in the
> various devices.
> 
> Jack can run in its own thread because is has specific code for it. It does
> not require the thread_info field because it has it in the priv_data->client
> field (the structure is opaque, but looking into it confirms that there are
> thread-related fields).
> 
> What I have in mind is this:
> 
> Currently, av_read_packet does this:
> 
> 	ret= s->iformat->read_packet(s, pkt);
> 
> what it could do instead is:
> 
> 	if (s->thread_info) {
> 	    if (!s->thread_info->running)
> 		start_thread(s);
> 	    ret = queue_get(s->thread_info->packet_queue);
> 	} else {
> 	    ret= s->iformat->read_packet(s, pkt);
> 	}
> 
> Thus, running a device in its own thread requires only filling the
> thread_info field.
> 
>  From the application's point of view, this device is still blocking, but
> now, it is also insensible to polling irregularities: if the application is
> blocked in another device, or spends a little too much time encoding a
> particularly complex frame, it will not drop any data, just queue it.

it should return EAGAIN not block ...

anyway, a patch for this is probably welcome

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 1
"Used only once"    - "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100305/52ba5b8e/attachment.pgp>



More information about the ffmpeg-devel mailing list