[FFmpeg-cvslog] http: Check for AVERROR_EOF in the check for premature end

Martin Storsjö git at videolan.org
Fri Nov 20 10:39:30 EET 2020


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Fri Nov 13 00:06:30 2020 +0200| [104e5233f03f1ed3aa34b256cd2b9023a9076ffb] | committer: Martin Storsjö

http: Check for AVERROR_EOF in the check for premature end

When the check was added (in 3668701f9600, in 2015), some IO
functions returned 0 on EOF (in particular, the TCP protocol
did, but the TLS protocol returned AVERROR_EOF). Since
0e1f771d2200d in 2017, the TCP protocol also returns AVERROR_EOF
instead of 0, making the check for premature end never have the
intended effect.

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=104e5233f03f1ed3aa34b256cd2b9023a9076ffb
---

 libavformat/http.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 3d25d652d3..2d24c00e18 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -1436,7 +1436,8 @@ static int http_buf_read(URLContext *h, uint8_t *buf, int size)
         if ((!s->willclose || s->chunksize == UINT64_MAX) && s->off >= target_end)
             return AVERROR_EOF;
         len = ffurl_read(s->hd, buf, size);
-        if (!len && (!s->willclose || s->chunksize == UINT64_MAX) && s->off < target_end) {
+        if ((!len || len == AVERROR_EOF) &&
+            (!s->willclose || s->chunksize == UINT64_MAX) && s->off < target_end) {
             av_log(h, AV_LOG_ERROR,
                    "Stream ends prematurely at %"PRIu64", should be %"PRIu64"\n",
                    s->off, target_end



More information about the ffmpeg-cvslog mailing list