[FFmpeg-devel] [PATCH] avio: Check for FF_NETERROR(EAGAIN) in retry_transfer_wrapper

Martin Storsjö martin
Thu Feb 17 15:44:19 CET 2011


On Thu, 17 Feb 2011, M?ns Rullg?rd wrote:

> Martin Storsj? <martin at martin.st> writes:
> 
> > On Windows, FF_NETERROR(EAGAIN) isn't equal to AVERROR(EAGAIN).
> > Map the return value visible to user applications to the normal
> > AVERROR() codes.
> >
> > This fixes issue 2614.
> > ---
> >  libavformat/avio.c |    2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> >
> > diff --git a/libavformat/avio.c b/libavformat/avio.c
> > index a19ec37..eca6ad2 100644
> > --- a/libavformat/avio.c
> > +++ b/libavformat/avio.c
> > @@ -219,6 +219,8 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int
> >          ret = transfer_func(h, buf+len, size-len);
> >          if (ret == AVERROR(EINTR))
> >              continue;
> > +        if (ret == FF_NETERROR(EAGAIN))
> > +            ret = AVERROR(EAGAIN);
> >          if (h->flags & URL_FLAG_NONBLOCK)
> >              return ret;
> >          if (ret == AVERROR(EAGAIN)) {
> 
> Wouldn't it be better to do this in the network layer?

That'd require adding checks/mapping in every protocol, since 
transfer_func is the actual protocol read/write function in this case.

// Martin



More information about the ffmpeg-devel mailing list