]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
mpegts mux subscription: fix the live check (data timeout)
authorJaroslav Kysela <perex@perex.cz>
Mon, 26 Jan 2015 19:58:39 +0000 (20:58 +0100)
committerJaroslav Kysela <perex@perex.cz>
Mon, 26 Jan 2015 19:58:39 +0000 (20:58 +0100)
src/input/mpegts.h
src/input/mpegts/mpegts_input.c
src/input/mpegts/mpegts_mux.c
src/subscriptions.c
src/subscriptions.h

index ade18bcbb5f0f03f424efd77f67b269967e9c33f..61ab829f41659728296e719d65e4bcac62e45e76 100644 (file)
@@ -585,7 +585,6 @@ struct mpegts_input
    */
 
   uint8_t mi_running;            /* threads running */
-  uint8_t mi_live;               /* stream is live */
   time_t mi_last_dispatch;
 
   /* Data input */
index b4ddd6d66048e6438c4dce3cc946677d91239ed1..630ef20f3835b2c8d9a31c946ef42cff2aa58cf2 100644 (file)
@@ -590,8 +590,6 @@ mpegts_input_started_mux
 
   /* Deliver first TS packets as fast as possible */
   mi->mi_last_dispatch = 0;
-  /* Wait for first TS packet */
-  mi->mi_live = 0;
 
   /* Arm timer */
   if (LIST_FIRST(&mi->mi_mux_active) == NULL)
@@ -931,6 +929,7 @@ mpegts_input_process
   mpegts_mux_t          *mm  = mpkt->mp_mux;
   mpegts_mux_instance_t *mmi;
   mpegts_pid_t *last_mp = NULL;
+  th_subscription_t *ths;
 #if ENABLE_TSDEBUG
   off_t tsdebug_pos;
 #endif
@@ -938,12 +937,14 @@ mpegts_input_process
   if (mm == NULL || (mmi = mm->mm_active) == NULL)
     return;
 
+  LIST_FOREACH(ths, &mmi->mmi_subs, ths_mmi_link)
+    ths->ths_live = 1;
+
   assert(mm == mmi->mmi_mux);
 
 #if ENABLE_TSDEBUG
   tsdebug_pos = mm->mm_tsdebug_pos;
 #endif
-  mi->mi_live = 1;
 
   /* Process */
   assert((len % 188) == 0);
index ce4ba3a503a3308c6496b027956e875f8b399846..d2f9cc72d7f8dcca62288223b898463bfb49f195 100644 (file)
@@ -1269,7 +1269,7 @@ mpegts_mux_remove_subscriber
 #if ENABLE_TRACE
   char buf[256];
   mpegts_mux_nice_name(mm, buf, sizeof(buf));
-  tvhtrace("mpegts", "%s - remove subscriber", buf);
+  tvhtrace("mpegts", "%s - remove subscriber (reason %i)", buf, reason);
 #endif
   subscription_unlink_mux(s, reason);
   mm->mm_stop(mm, 0, reason);
index 057442eea2ceb2816fee516bdf4beabb16e2ddb1..c12eaf795680ef96ca6adfcc318fdeea326d957d 100644 (file)
@@ -741,16 +741,16 @@ static void
 mux_data_timeout ( void *aux )
 {
   th_subscription_t *s = aux;
-  mpegts_input_t *mi = s->ths_mmi->mmi_input;
 
   if (!s->ths_mmi)
     return;
 
-  if (!mi->mi_live) {
+  if (!s->ths_live) {
+    tvhwarn("subscription", "%04X: mux data timeout for %s", shortid(s), s->ths_title);
     mpegts_mux_remove_subscriber(s->ths_mmi->mmi_mux, s, SM_CODE_NO_INPUT);
     return;
   }
-  mi->mi_live = 0;
+  s->ths_live = 0;
 
   if (s->ths_timeout > 0)
     gtimer_arm(&s->ths_receive_timer, mux_data_timeout, s, s->ths_timeout);
index 77fc709184c6b325b5827d7641264770adc672f4..7ef65dcf84b1bfd3a57acd7b45092fa7e46d500c 100644 (file)
@@ -117,6 +117,7 @@ typedef struct th_subscription {
   LIST_ENTRY(th_subscription) ths_mmi_link;
   struct mpegts_mux_instance *ths_mmi;
   gtimer_t ths_receive_timer;
+  uint8_t ths_live;
 #endif
 
 } th_subscription_t;