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

Martin Storsjö martin
Sat Feb 19 19:17:33 CET 2011


On Thu, 17 Feb 2011, Ronald S. Bultje wrote:

> Hi,
> 
> On Thu, Feb 17, 2011 at 11:22 AM, Martin Storsj? <martin at martin.st> wrote:
> > On Thu, 17 Feb 2011, Nicolas George wrote:
> >
> >> Le nonidi 29 pluvi?se, an CCXIX, Luca Barbato a ?crit?:
> >> > It would mean repeat that for every network protocol, might worth a try
> >> > though.
> >>
> >> All (almost?) protocols use the ff_neterrno() macro, which is defined, on
> >> windows, as:
> >>
> >> #define ff_neterrno() (-WSAGetLastError())
> >>
> >> It could become:
> >>
> >> static inline int ff_neterrno(void)
> >> {
> >> ? ? int err = -WSAGetLastError();
> >> ? ? return err == -WSAEWOULDBLOCK ? AVERROR(EAGAIN) : err;
> >> }
> >>
> >> This would become a good place for similar mappings should they become
> >> necessary in the future.
> >
> > If this change is done, all uses of FF_NETERROR(EAGAIN) need to be
> > switched to AVERROR(EAGAIN) at the same time.
> 
> Sounds good to me, I've always disliked this FF_NETERROR() thing, it's
> just very prone to stupid bugs that we can't really find because
> they're win32-only and error-only.

Indeed, getting rid of this would be great. However, that requires us to 
add mappings in ff_neterrno() for all the network errors that we want to 
catch via AVERROR(), that could lead to similar sublte bugs.

What's worse, though, is that we use EPROTONOSUPPORT, ETIMEDOUT and 
ECONNREFUSED, too, and these ones don't exist in windows errno.h, only in 
the WSA-prefixed versions, so there's no header-provided value that we can 
map them to.

What do you think about this, is it worth fixing it this way, while still 
leaving a few cases of FF_NETERROR() scattered around for the errors that 
don't have a non-WSA-prefixed version in the windows errno.h?

// Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Map-EAGAIN-and-EINTR-from-ff_neterrno-to-the-AVERROR.patch
Type: text/x-diff
Size: 10218 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110219/2578901a/attachment.patch>



More information about the ffmpeg-devel mailing list