[FFmpeg-devel] [PATCH] http: Return AVERROR_EOF instead of 0 in some EOF conditions

Martin Storsjö martin at martin.st
Fri Nov 13 00:05:55 EET 2020


IO functions are expected to return AVERROR_EOF instead of 0
nowadays. This is also expected by other higher level layers
within the http protocol itself (e.g. the reconnect mechanism).
---
 libavformat/http.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 3d25d652d3..528ea046ef 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -1408,12 +1408,12 @@ static int http_buf_read(URLContext *h, uint8_t *buf, int size)
             if (!s->chunksize && s->multiple_requests) {
                 http_get_line(s, line, sizeof(line)); // read empty chunk
                 s->chunkend = 1;
-                return 0;
+                return AVERROR_EOF;
             }
             else if (!s->chunksize) {
                 av_log(h, AV_LOG_DEBUG, "Last chunk received, closing conn\n");
                 ffurl_closep(&s->hd);
-                return 0;
+                return AVERROR_EOF;
             }
             else if (s->chunksize == UINT64_MAX) {
                 av_log(h, AV_LOG_ERROR, "Invalid chunk size %"PRIu64"\n",
-- 
2.24.3 (Apple Git-128)



More information about the ffmpeg-devel mailing list