[FFmpeg-devel,3/4] libavformat/http: Reuse TCP sockets when 'multiple_requests' is set

Submitted by kjeyapal@akamai.com on Nov. 3, 2017, 8:27 a.m.

Details

Message ID 1509697623-2745-3-git-send-email-kjeyapal@akamai.com
State New
Headers show

Commit Message

kjeyapal@akamai.com Nov. 3, 2017, 8:27 a.m.
---
 libavformat/http.c | 3 +++
 1 file changed, 3 insertions(+)

Patch hide | download patch | download mbox

diff --git a/libavformat/http.c b/libavformat/http.c
index bd9148f..b7bdcdc 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -227,6 +227,9 @@  static int http_open_cnx_internal(URLContext *h, AVDictionary **options)
     ff_url_join(buf, sizeof(buf), lower_proto, NULL, hostname, port, NULL);
 
     if (!s->hd) {
+        if (s->multiple_requests && !strcmp(lower_proto, "tcp")) {
+            av_dict_set_int(options, "reuse_sockets", 1, 0);
+        }
         err = ffurl_open_whitelist(&s->hd, buf, AVIO_FLAG_READ_WRITE,
                                    &h->interrupt_callback, options,
                                    h->protocol_whitelist, h->protocol_blacklist, h);