From 511c4f7b50c4abf21e482636379021f14451be0d Mon Sep 17 00:00:00 2001
From: "Schenk, Michael" <michael.schenk@albistechnologies.com>
Date: Mon, 21 Sep 2015 15:15:11 +0200
Subject: [PATCH] avformat/http: detect end of received on chunked persistence
 http connections

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

diff --git a/libavformat/http.c b/libavformat/http.c
index 075dda7..5f48e6e 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -1239,8 +1239,11 @@ static int http_read_stream(URLContext *h, uint8_t *buf, int size)
                 av_log(NULL, AV_LOG_TRACE, "Chunked encoding data size: %"PRId64"'\n",
                         s->chunksize);
 
-                if (!s->chunksize)
+                if (!s->chunksize) {
+                    s->chunksize = -1;
+                    s->filesize = s->off;
                     return 0;
+                }
         }
         size = FFMIN(size, s->chunksize);
     }
-- 
1.8.3.1

