From: Jaroslav Kysela Date: Mon, 14 Oct 2019 10:53:17 +0000 (+0200) Subject: linuxdvb: take in account similar dmx for the exclusive tuner access, fixes #5744 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac8095e9883173ced48c223b2d53d7e91d9e6671;p=thirdparty%2Ftvheadend.git linuxdvb: take in account similar dmx for the exclusive tuner access, fixes #5744 --- diff --git a/src/input/mpegts/linuxdvb/linuxdvb_frontend.c b/src/input/mpegts/linuxdvb/linuxdvb_frontend.c index 4afb2d2a7..d3639cb9a 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_frontend.c +++ b/src/input/mpegts/linuxdvb/linuxdvb_frontend.c @@ -43,11 +43,18 @@ linuxdvb_frontend_input_thread ( void *aux ); /* * */ -static inline int sig_multiply(int value, int multiplier) +static inline int sig_multiply ( int value, int multiplier ) { return ((value * MAX(1, multiplier)) + 99) / 100; } +static inline int lfe_group ( linuxdvb_frontend_t *lfe1, + linuxdvb_frontend_t *lfe2 ) +{ + return strcmp(lfe1->lfe_dmx_path, lfe2->lfe_dmx_path) == 0 || + strcmp(lfe1->lfe_fe_path, lfe2->lfe_fe_path) == 0; +} + /* ************************************************************************** * Class definition * *************************************************************************/ @@ -67,7 +74,7 @@ linuxdvb_frontend_class_active_get ( void *obj ) active = (int *)mpegts_input_class_active_get(obj); if (!(*active)) { LIST_FOREACH(lfe2, &lfe->lfe_adapter->la_frontends, lfe_link) { - if (strcmp(lfe2->lfe_fe_path, lfe->lfe_fe_path)) + if (!lfe_group(lfe, lfe2)) continue; if (lfe2->mi_is_enabled((mpegts_input_t*)lfe2, NULL, 0, -1) != MI_IS_ENABLED_NEVER) { *active = 1; @@ -565,7 +572,7 @@ linuxdvb_frontend_get_weight ( mpegts_input_t *mi, mpegts_mux_t *mm, int flags, int w = 0; linuxdvb_frontend_t *lfe = (linuxdvb_frontend_t*)mi, *lfe2; LIST_FOREACH(lfe2, &lfe->lfe_adapter->la_frontends, lfe_link) { - if (strcmp(lfe->lfe_fe_path, lfe2->lfe_fe_path)) + if (!lfe_group(lfe, lfe2)) continue; w = MAX(w, mpegts_input_get_weight((mpegts_input_t*)lfe2, mm, flags, weight)); } @@ -648,7 +655,7 @@ linuxdvb_frontend_is_enabled ok: w = -1; LIST_FOREACH(lfe2, &lfe->lfe_adapter->la_frontends, lfe_link) { - if (lfe2 == lfe || strcmp(lfe2->lfe_fe_path, lfe->lfe_fe_path)) continue; + if (lfe2 == lfe || !lfe_group(lfe, lfe2)) continue; w = MAX(w, mpegts_input_get_weight((mpegts_input_t *)lfe2, mm, flags, weight)); } if (w >= weight) @@ -731,7 +738,7 @@ linuxdvb_frontend_warm_mux ( mpegts_input_t *mi, mpegts_mux_instance_t *mmi ) /* Stop other active frontend (should be only one) */ LIST_FOREACH(lfe2, &lfe->lfe_adapter->la_frontends, lfe_link) { - if (lfe2 == lfe || strcmp(lfe2->lfe_fe_path, lfe->lfe_fe_path)) continue; + if (lfe2 == lfe || !lfe_group(lfe, lfe2)) continue; tvh_mutex_lock(&lfe2->mi_output_lock); lmmi = LIST_FIRST(&lfe2->mi_mux_active); tvh_mutex_unlock(&lfe2->mi_output_lock);