From: Vishwanath Dixit <vdi...@akamai.com> In write only mode, the TCP receive buffer keeps growing and eventually becomes full. This results in zero tcp window size, which in turn causes unwanted issues, like, terminated tcp connection. The issue is apparent when http persistent connection is enabled in hls/dash streaming use cases. To overcome this issue, the logic here reads and discards the data from the tcp socket. --- libavformat/http.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/libavformat/http.c b/libavformat/http.c index 983034f..e6d414b 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -1627,6 +1627,13 @@ 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; + /* flush the receive buffer when it is write only mode */ + if (!(flags & AVIO_FLAG_READ)) { + char buf[1024]; + s->hd->flags |= AVIO_FLAG_NONBLOCK; + ffurl_read(s->hd, buf, sizeof(buf)); + s->hd->flags &= ~AVIO_FLAG_NONBLOCK; + } s->end_chunked_post = 1; } -- 1.9.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel