]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
iptv: http - do not clear the input sbuf in the kick callback
authorJaroslav Kysela <perex@perex.cz>
Tue, 11 Dec 2018 09:02:20 +0000 (10:02 +0100)
committerJaroslav Kysela <perex@perex.cz>
Tue, 11 Dec 2018 09:02:20 +0000 (10:02 +0100)
src/input/mpegts/iptv/iptv.c
src/input/mpegts/iptv/iptv_file.c
src/input/mpegts/iptv/iptv_http.c
src/input/mpegts/iptv/iptv_libav.c
src/input/mpegts/iptv/iptv_pipe.c
src/input/mpegts/iptv/iptv_private.h
src/input/mpegts/iptv/iptv_rtsp.c
src/input/mpegts/iptv/iptv_udp.c

index 2d07b282d9ee8d9b6f0883162fc068fd7b85836d..758d476471e48b6e37feaa6f569c96ecef7d7984 100644 (file)
@@ -682,10 +682,11 @@ iptv_input_fd_started ( iptv_input_t *mi, iptv_mux_t *im )
 }
 
 void
-iptv_input_mux_started ( iptv_input_t *mi, iptv_mux_t *im )
+iptv_input_mux_started ( iptv_input_t *mi, iptv_mux_t *im, int reset )
 {
   /* Allocate input buffer */
-  sbuf_reset_and_alloc(&im->mm_iptv_buffer, IPTV_BUF_SIZE);
+  if (reset)
+    sbuf_reset_and_alloc(&im->mm_iptv_buffer, IPTV_BUF_SIZE);
 
   im->im_pcr = PTS_UNSET;
   im->im_pcr_pid = MPEGTS_PID_NONE;
index 99089b321ce2edb32b171dc82f878e41957a0e37..17d6b105ad681efec4c777353bb2d4072cd29ae5 100644 (file)
@@ -108,7 +108,7 @@ iptv_file_start
   fp->fd = fd;
   tvh_cond_init(&fp->cond, 1);
   im->im_data = fp;
-  iptv_input_mux_started(mi, im);
+  iptv_input_mux_started(mi, im, 1);
   tvh_thread_create(&fp->tid, NULL, iptv_file_thread, im, "iptvfile");
   return 0;
 }
index 0f42ed6c69b42a490d62677aeeae232c6ae2dbf1..04ee8789237870e28e05b84ffabc2cec646728ca 100644 (file)
@@ -197,7 +197,7 @@ iptv_http_kick_cb( void *aux )
     hp->flush = 0;
     tvh_mutex_lock(&iptv_lock);
     if (!hp->started) {
-      iptv_input_mux_started(hp->mi, im);
+      iptv_input_mux_started(hp->mi, im, 0);
     } else {
       iptv_input_recv_flush(im);
     }
@@ -516,6 +516,8 @@ iptv_http_start
   http_client_t *hc;
   int r;
 
+  sbuf_reset_and_alloc(&im->mm_iptv_buffer, IPTV_BUF_SIZE);
+
   hp = calloc(1, sizeof(*hp));
   hp->mi = mi;
   hp->im = im;
index 300909060fa39b0ca7538dde932eab62f3946f87..eceeb2ee13907d44a5bffb1125d575e6abe95d08 100644 (file)
@@ -188,7 +188,7 @@ iptv_libav_start
   la->mux = im;
   tvh_pipe(O_NONBLOCK, &la->pipe);
   im->mm_iptv_fd = la->pipe.rd;
-  iptv_input_fd_started(mi, im);
+  iptv_input_fd_started(mi, im, 1);
   atomic_set(&la->running, 1);
   atomic_set(&la->pause, 0);
   sbuf_init(&la->sbuf);
index a75cc4359293bef4f4ca88d4c002f16d9486c94b..2a5e18790866bc33c7b36c1816ac459acb3ba649 100644 (file)
@@ -68,7 +68,7 @@ iptv_pipe_start
   im->mm_iptv_respawn_last = mclk();
 
   if (url)
-    iptv_input_mux_started(mi, im);
+    iptv_input_mux_started(mi, im, 1);
   return 0;
 
 err:
index d73b0076be2641be4c28e45b77b6aa6a37d64fe1..e6f1d7174957d2f9ea11b03812f93e4d435fc185 100644 (file)
@@ -61,7 +61,7 @@ struct iptv_input
 
 int  iptv_input_fd_started ( iptv_input_t *mi, iptv_mux_t *im );
 void iptv_input_close_fds ( iptv_input_t *mi, iptv_mux_t *im );
-void iptv_input_mux_started ( iptv_input_t *mi, iptv_mux_t *im );
+void iptv_input_mux_started ( iptv_input_t *mi, iptv_mux_t *im, int reset );
 int  iptv_input_recv_packets ( iptv_mux_t *im, ssize_t len );
 void iptv_input_recv_flush ( iptv_mux_t *im );
 void iptv_input_pause_handler ( iptv_input_t *mi, iptv_mux_t *im, int pause );
index 2e411c4717dd7505dea0be2df79926c2066bdb3c..860e64f470226af01a18aa9d48ae80d31f696992 100644 (file)
@@ -113,7 +113,7 @@ iptv_rtsp_header ( http_client_t *hc )
     hc->hc_cmd = HTTP_CMD_NONE;
     tvh_mutex_lock(&global_lock);
     if (im->mm_active)
-      iptv_input_mux_started((iptv_input_t *)im->mm_active->mmi_input, im);
+      iptv_input_mux_started((iptv_input_t *)im->mm_active->mmi_input, im, 1);
     mtimer_arm_rel(&rp->alive_timer, iptv_rtsp_alive_cb, im,
                    sec2mono(MAX(1, (hc->hc_rtp_timeout / 2) - 1)));
     tvh_mutex_unlock(&global_lock);
index e086bda8396b397d2ecde067b93ebfc98263c937..fbe0bb589320894fb61fe3d2097ded5602f98331 100644 (file)
@@ -55,7 +55,7 @@ iptv_udp_start
   udp_multirecv_init(um, IPTV_PKTS, IPTV_PKT_PAYLOAD);
   im->im_data = um;
 
-  iptv_input_mux_started(mi, im);
+  iptv_input_mux_started(mi, im, 1);
   return 0;
 }