From: Jaroslav Kysela Date: Mon, 26 Jan 2015 19:58:39 +0000 (+0100) Subject: mpegts mux subscription: fix the live check (data timeout) X-Git-Tag: v4.1~417 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b98e688f5792a9fb3906491cd51e3b5c62294cd1;p=thirdparty%2Ftvheadend.git mpegts mux subscription: fix the live check (data timeout) --- diff --git a/src/input/mpegts.h b/src/input/mpegts.h index ade18bcbb..61ab829f4 100644 --- a/src/input/mpegts.h +++ b/src/input/mpegts.h @@ -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 */ diff --git a/src/input/mpegts/mpegts_input.c b/src/input/mpegts/mpegts_input.c index b4ddd6d66..630ef20f3 100644 --- a/src/input/mpegts/mpegts_input.c +++ b/src/input/mpegts/mpegts_input.c @@ -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); diff --git a/src/input/mpegts/mpegts_mux.c b/src/input/mpegts/mpegts_mux.c index ce4ba3a50..d2f9cc72d 100644 --- a/src/input/mpegts/mpegts_mux.c +++ b/src/input/mpegts/mpegts_mux.c @@ -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); diff --git a/src/subscriptions.c b/src/subscriptions.c index 057442eea..c12eaf795 100644 --- a/src/subscriptions.c +++ b/src/subscriptions.c @@ -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); diff --git a/src/subscriptions.h b/src/subscriptions.h index 77fc70918..7ef65dcf8 100644 --- a/src/subscriptions.h +++ b/src/subscriptions.h @@ -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;