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

Ivo ivop
Fri Nov 27 14:48:56 CET 2009


On Thursday 26 November 2009, 21:10:35, Luca Abeni wrote:
> On Thu, 2009-11-26 at 18:08 +0100, Ivo wrote:
> > On Thursday 26 November 2009, 18:06:33, Ivo wrote:
> > > This patch...
>
> [...]
>
> >      while((res = snd_pcm_writei(s->h, buf, size / s->frame_size)) < 0)
> > { -        if (res == -EAGAIN) {
> > +        if (res == -EAGAIN && s1->flags & AVFMT_FLAG_NONBLOCK) {
> >
> >              return AVERROR(EAGAIN);
> >          }
>
> Are you sure about this hunk? I would not expect alsa to return -EAGAIN
> if the non-blocking flag has not been set previously...

I dropped this hunk locally. Non-blocking mode is non-blocking, but it does 
not behave entirely correctly. It should not check for -EAGAIN, but use 
snd_pcm_status_get_avail upfront, before writing the frames. If there's not 
enough room, it should return -EGAIN, as there's no way to signal the 
calling application that some frames were not written. But such fix belongs 
in a separate patch IMHO.

So, I dropped this hunk and the rest is the same. If it's ok to apply, I'll 
increase the micro number and update APIchanges in a separate commit.

Regards,
--Ivo



More information about the ffmpeg-devel mailing list