> On 28 Mar 2018, at 12:52, vdi...@akamai.com wrote: > > 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)); ffurl_read have a int return value.
407 int ffurl_read(URLContext *h, unsigned char *buf, int size) 408 { 409 if (!(h->flags & AVIO_FLAG_READ)) 410 return AVERROR(EIO); 411 return retry_transfer_wrapper(h, buf, size, 1, h->prot->url_read); 412 } > + 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 Thanks Steven _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel