[FFmpeg-devel] [PATCH] lavf: AVFMT_HAS_NONBLOCK flag for (de)muxers

Michael Niedermayer michaelni
Mon Nov 30 01:33:19 CET 2009

On Sun, Nov 29, 2009 at 11:46:58PM +0100, Ivo wrote:
> On Friday 27 November 2009, 20:23:08, Michael Niedermayer wrote:
> > On Fri, Nov 27, 2009 at 08:00:11PM +0100, Luca Abeni wrote:
> > > Anyway, if you are ok with the "generic" (avformat.h) part of the patch
> > > I think it's worth applying it (maybe waiting one day or two, to give
> > > other people to possibility to comment).
> >
> > iam ok with the generic part, but i would suspect that at least
> > av_interleaved_write_frame() needs changes to be able to recover from
> > a EAGAIN without loosing packets
> I looked at av_interleaved_write_frame and it passes -EGAIN on to the 
> calling application. I have alsa fixed locally and it's ffmpeg.c that does 
> this if alsa receives the packages too fast in non-blocking mode:
>     ret= av_interleaved_write_frame(s, pkt);
>     if(ret < 0){
>         print_error("av_interleaved_write_frame()", ret);
>         av_exit(1);
>     }
> Shouldn't the calling application act on -EAGAIN, wait a little and try 
> av_interleaved_write_frame(s,pkt) again?

yes, though not just wait but rather try the next "file" if there are more.

> Or will that result in duplicate 
> packets? (the code is not entirely clear to me yet)

as (unclearly) said, av_interleaved_write_frame() or related code might need
some change

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.
-------------- 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/20091130/f29fe7ce/attachment.pgp>

More information about the ffmpeg-devel mailing list