[FFmpeg-devel] [PATCH 3/3] avformat/ffmdec: Only return EAGAIN if a server is attached

Michael Niedermayer michaelni at gmx.at
Fri Nov 20 20:10:24 CET 2015


On Fri, Nov 20, 2015 at 07:34:50PM +0100, Andreas Cadhalpun wrote:
> On 20.11.2015 03:26, Michael Niedermayer wrote:
> > From: Michael Niedermayer <michael at niedermayer.cc>
> > 
> > This should fix a infinite loop
> > 
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > ---
> >  libavformat/ffmdec.c |    9 +++++++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
> > index c3850db..e7c1449 100644
> > --- a/libavformat/ffmdec.c
> > +++ b/libavformat/ffmdec.c
> > @@ -49,7 +49,10 @@ static int ffm_is_avail_data(AVFormatContext *s, int size)
> >      } else {
> >      if (pos == ffm->write_index) {
> >          /* exactly at the end of stream */
> > -        return AVERROR(EAGAIN);
> > +        if (ffm->server_attached)
> > +            return AVERROR(EAGAIN);
> > +        else
> > +            return AVERROR_INVALIDDATA;
> >      } else if (pos < ffm->write_index) {
> >          avail_size = ffm->write_index - pos;
> >      } else {
> > @@ -59,8 +62,10 @@ static int ffm_is_avail_data(AVFormatContext *s, int size)
> >      avail_size = (avail_size / ffm->packet_size) * (ffm->packet_size - FFM_HEADER_SIZE) + len;
> >      if (size <= avail_size)
> >          return 1;
> > -    else
> > +    else if (ffm->server_attached)
> >          return AVERROR(EAGAIN);
> > +    else
> > +        return AVERROR_INVALIDDATA;
> >  }
> >  
> >  static int ffm_resync(AVFormatContext *s, int state)
> > 
> 
> This reliably fixes the infinite EAGAIN loops. Thanks a lot!
> 
> I haven't tested ffserver, but assuming you did and it still works,
> this patch is fine.

i lightly tested ffserver, yes, more testing surely cannot hurt
though

applied

thx

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

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151120/202300f7/attachment.sig>


More information about the ffmpeg-devel mailing list