]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
IPTV: tune the http client settings
authorJaroslav Kysela <perex@perex.cz>
Wed, 16 Apr 2014 07:06:47 +0000 (09:06 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 5 May 2014 20:00:36 +0000 (22:00 +0200)
- increase the chunk size to 128KB
- allow HTTP redirects

src/input/mpegts/iptv/iptv_http.c

index 770dff4a84ae2eca0c755c6bee6caa297c393e3f..9aed89beebaa1708c5666a466fb328277a86c215 100644 (file)
 static int
 iptv_http_header ( http_client_t *hc )
 {
-  pthread_mutex_lock(&global_lock);
-  iptv_input_mux_started(hc->hc_aux);
-  pthread_mutex_unlock(&global_lock);
+  /* multiple headers for redirections */
+  if (hc->hc_code == HTTP_STATUS_OK) {
+    pthread_mutex_lock(&global_lock);
+    iptv_input_mux_started(hc->hc_aux);
+    pthread_mutex_unlock(&global_lock);
+  }
   return 0;
 }
 
@@ -67,9 +70,11 @@ iptv_http_start
   if (!(hc = http_client_connect(im, HTTP_VERSION_1_1, u->scheme,
                                  u->host, u->port)))
     return SM_CODE_TUNING_FAILED;
-  hc->hc_hdr_received  = iptv_http_header;
-  hc->hc_data_received = iptv_http_data;
-  http_client_register(hc);
+  hc->hc_hdr_received    = iptv_http_header;
+  hc->hc_data_received   = iptv_http_data;
+  hc->hc_handle_location = 1;        /* allow redirects */
+  hc->hc_chunk_size      = 128*1024; /* increase buffering */
+  http_client_register(hc);          /* register to the HTTP thread */
   r = http_client_simple(hc, u);
   if (r < 0) {
     http_client_close(hc);