[FFmpeg-devel] [PATCH] libavformat/avio: retry_transfer_wrapper: don't treat 0 as EOF

Daniel Kucera daniel.kucera at gmail.com
Mon Jun 19 23:34:34 EEST 2017


transfer_func variable passed to retry_transfer_wrapper are
h->prot->url_read and h->prot->url_write functions. These need
to return EOF or other error properly. In case of returning >= 0,
 url_read/url_write is retried until error is returned.

requires patch: libavformat/cache: don't treat 0 as EOF

Signed-off-by: Daniel Kucera <daniel.kucera at gmail.com>
---
 libavformat/avio.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/avio.c b/libavformat/avio.c
index 1e79c9dd5c..d0cee42c39 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -393,8 +393,10 @@ static inline int retry_transfer_wrapper(URLContext *h, uint8_t *buf,
                 }
                 av_usleep(1000);
             }
-        } else if (ret < 1)
-            return (ret < 0 && ret != AVERROR_EOF) ? ret : len;
+        } else if (ret == AVERROR_EOF)
+            return len;
+        else if (ret < 0)
+            return ret;
         if (ret) {
             fast_retries = FFMAX(fast_retries, 2);
             wait_since = 0;
-- 
2.11.0



More information about the ffmpeg-devel mailing list