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

Martin Herkt lachs0r at srsfckn.biz
Tue Jan 9 10:15:39 EET 2018


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);
-- 
2.15.1



More information about the ffmpeg-devel mailing list