[FFmpeg-devel] [PATCH v1 1/1] avformat/http: fix for zero window size issue when

rpatagar at akamai.com rpatagar at akamai.com
Wed Mar 7 10:32:15 EET 2018


From: Ravindra <rpatagar at akamai.com>

---
 libavformat/http.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/libavformat/http.c b/libavformat/http.c
index 344fd60..a93fa54 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -1611,6 +1611,18 @@ static int http_write(URLContext *h, const uint8_t *buf, int size)
     return size;
 }
 
+static int http_read_response(URLContext *h) {
+    HTTPContext *s = h->priv_data;
+    char buf[1024];
+    int ret;
+
+    /* dummy read in nonblocking mode to clear the receive buffer */
+    s->hd->flags |= AVIO_FLAG_NONBLOCK;
+    ret = ffurl_read(s->hd, buf, sizeof(buf));
+    s->hd->flags &= ~AVIO_FLAG_NONBLOCK;
+    return ret;
+}
+
 static int http_shutdown(URLContext *h, int flags)
 {
     int ret = 0;
@@ -1622,6 +1634,7 @@ static int http_shutdown(URLContext *h, int flags)
         ((flags & AVIO_FLAG_READ) && s->chunked_post && s->listen)) {
         ret = ffurl_write(s->hd, footer, sizeof(footer) - 1);
         ret = ret > 0 ? 0 : ret;
+        http_read_response(h);
         s->end_chunked_post = 1;
     }
 
-- 
1.9.1



More information about the ffmpeg-devel mailing list