[FFmpeg-devel] [PATCH 1/1] avformat/http: handle SEEK_SET to filesize

vectronic hello.vectronic at gmail.com
Fri Apr 24 14:09:13 EEST 2020


if whence == SEEK_SET and offset is filesize and is_streamable is false
we can just return the filesize to prevent an HTTP 416 error

Signed-off-by: vectronic <hello.vectronic at gmail.com>
---
 libavformat/http.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index c9415578aa..1adcc6eb67 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -1719,7 +1719,7 @@ static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int fo
     int old_buf_size, ret;
     AVDictionary *options = NULL;
 
-    if (whence == AVSEEK_SIZE)
+    if ((whence == AVSEEK_SIZE) || (whence == SEEK_SET && h->is_streamed == 0 && off == s->filesize))
         return s->filesize;
     else if (!force_reconnect &&
              ((whence == SEEK_CUR && off == 0) ||
-- 
2.24.2 (Apple Git-127)



More information about the ffmpeg-devel mailing list