Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
mpegts: linked inputs - fix keep unsubscribe
  • Loading branch information
perexg committed May 27, 2015
1 parent 54c26b6 commit 718d81d
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/input/mpegts/mpegts_mux.c
Expand Up @@ -134,6 +134,7 @@ mpegts_mux_subscribe_keep

s = mi->mi_linked;
mi->mi_linked = NULL;
tvhtrace("mpegts", "subscribe keep for '%s' (%p)", mi->mi_name, mm);
r = mpegts_mux_subscribe(mm, mi, "keep", SUBSCRIPTION_PRIO_KEEP,
SUBSCRIPTION_RESTART | SUBSCRIPTION_MINIMAL);
mi->mi_linked = s;
Expand Down Expand Up @@ -201,12 +202,16 @@ void
mpegts_mux_unsubscribe_linked
( mpegts_input_t *mi )
{
mpegts_mux_instance_t *mmi;
th_subscription_t *ths, *ths_next;

if (mi) {
tvhtrace("mpegts", "unsubscribing linked from '%s'", mi->mi_name);
LIST_FOREACH(mmi, &mi->mi_mux_active, mmi_active_link)
mpegts_mux_unsubscribe_by_name(mmi->mmi_mux, "keep");
tvhtrace("mpegts", "unsubscribing linked");

for (ths = LIST_FIRST(&subscriptions); ths; ths = ths_next) {
ths_next = LIST_NEXT(ths, ths_global_link);
if (ths->ths_source == (tvh_input_t *)mi && !strcmp(ths->ths_title, "keep"))
subscription_unsubscribe(ths, 0);
}
}
}

Expand Down Expand Up @@ -237,6 +242,10 @@ mpegts_mux_instance_start
/* Start */
mi->mi_display_name(mi, buf2, sizeof(buf2));
tvhinfo("mpegts", "%s - tuning on %s", buf, buf2);

if (mi->mi_linked)
mpegts_mux_unsubscribe_linked(mi);

r = mi->mi_warm_mux(mi, mmi);
if (r) return r;
r = mi->mi_start_mux(mi, mmi);
Expand Down

0 comments on commit 718d81d

Please sign in to comment.