[FFmpeg-devel] [PATCH] avformat/avio: fix off-by-one in retry_transfer_wrapper

wm4 nfxjfg at googlemail.com
Tue Jan 9 21:31:50 EET 2018


On Tue,  9 Jan 2018 09:15:39 +0100
Martin Herkt <lachs0r at srsfckn.biz> wrote:

> This reportedly fixes hangs with segmented streams.
> Affects playback via Schannel on Windows in particular.
> 
> Can be reproduced with any YouTube live stream.
> ---
>  libavformat/avio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/avio.c b/libavformat/avio.c
> index 63e82872f7..cd1e325a6b 100644
> --- a/libavformat/avio.c
> +++ b/libavformat/avio.c
> @@ -393,7 +393,7 @@ static inline int retry_transfer_wrapper(URLContext *h, uint8_t *buf,
>              }
>          } else if (ret == AVERROR_EOF)
>              return (len > 0) ? len : AVERROR_EOF;
> -        else if (ret < 0)
> +        else if (ret <= 0)
>              return ret;
>          if (ret) {
>              fast_retries = FFMAX(fast_retries, 2);

This was explicitly changed with the EOF change (that broke a lot of
stuff), so this is probably not correct. The intention is very much to
retry if the result is 0.


More information about the ffmpeg-devel mailing list