[FFmpeg-devel] [PATCH] http: only set filesize for 206 content-range

Robert Nagy ronag89 at gmail.com
Sun Aug 5 01:08:40 EEST 2018


Growing files will return 416 with a current file size in content-range.
However, FFmpeg incorrectly assumes this is the final file size.
Fix this by only setting file size for 206 responses.
---
 libavformat/http.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 668cd51986..3bd89780c3 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -617,7 +617,7 @@ static void parse_content_range(URLContext *h, const
char *p)
     HTTPContext *s = h->priv_data;
     const char *slash;

-    if (!strncmp(p, "bytes ", 6)) {
+    if (!strncmp(p, "bytes ", 6) && s->http_code == 206) {
         p     += 6;
         s->off = strtoull(p, NULL, 10);
         if ((slash = strchr(p, '/')) && strlen(slash) > 0)
--
2.17.1


More information about the ffmpeg-devel mailing list