From 1f0eaa02aa7141f371e095540ac285698a0bdf46 Mon Sep 17 00:00:00 2001 From: Aman Gupta Date: Tue, 12 Dec 2017 15:25:46 -0800 Subject: avformat/hls: add http_multiple option This improves network throughput of the hls demuxer by avoiding the latency introduced by downloading segments one at a time. The problem is particularly noticable over high-latency network connections: for instance, if RTT is 250ms, there will a 250ms idle period between when one segment response is read and the next one starts. The obvious solution to this is to use HTTP pipelining, where a second request can be sent (on the persistent http/1.1 connection) before the first response is fully read. Unfortunately the way the http protocol is implemented in avformat makes implementing pipleining very complex. Instead, this commit simulates pipelining using two separate persistent http connections. This has the advantage of working independently of the http_persistent option, and can be used with http/1.0 servers as well. The pair of connections is swapped every time a new segment starts downloading, and a request for the next segment is sent on the secondary connection right away. This means the second response will be ready and waiting by the time the current response is fully read. Signed-off-by: Aman Gupta Signed-off-by: Anssi Hannula --- doc/demuxers.texi | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'doc/demuxers.texi') diff --git a/doc/demuxers.texi b/doc/demuxers.texi index f76829adfe..81ab399cdc 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -320,6 +320,10 @@ Default value is 1000. @item http_persistent Use persistent HTTP connections. Applicable only for HTTP streams. Enabled by default. + +@item http_multiple +Use multiple HTTP connections for downloading HTTP segments. +Enabled by default. @end table @section image2 -- cgit v1.2.3