From: Jaroslav Kysela Date: Sun, 13 Aug 2017 15:29:52 +0000 (+0200) Subject: capmt: fix the weird key update when services have TELETEXT stream shared X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1c6c91508fbdd6b0336db7ceaf5bc9bc88d50a54;p=thirdparty%2Ftvheadend.git capmt: fix the weird key update when services have TELETEXT stream shared --- diff --git a/src/descrambler/capmt.c b/src/descrambler/capmt.c index f9b903bd4..06661bdde 100644 --- a/src/descrambler/capmt.c +++ b/src/descrambler/capmt.c @@ -192,6 +192,7 @@ typedef struct capmt_service { /* Elementary stream types */ uint8_t ct_types[MAX_PIDS]; + uint8_t ct_type_sok[MAX_PIDS]; } capmt_service_t; /** @@ -1090,7 +1091,7 @@ capmt_process_key(capmt_t *capmt, uint8_t adapter, ca_info_t *cai, mpegts_service_t *t; capmt_service_t *ct; uint16_t *pids; - int i, j, pid; + int i, j, pid, multipid; pthread_mutex_lock(&capmt->capmt_mutex); LIST_FOREACH(ct, &capmt->capmt_services, ct_link) { @@ -1109,6 +1110,8 @@ capmt_process_key(capmt_t *capmt, uint8_t adapter, ca_info_t *cai, if (adapter != ct->ct_adapter) continue; + multipid = descrambler_multi_pid((th_descrambler_t *)ct); + pids = cai->pids; for (i = 0; i < MAX_PIDS; i++) { @@ -1117,11 +1120,11 @@ capmt_process_key(capmt_t *capmt, uint8_t adapter, ca_info_t *cai, pid = ct->ct_pids[j]; if (pid == 0) break; if (pid == pids[i]) { - if (descrambler_multi_pid((th_descrambler_t *)ct)) { + if (multipid) { descrambler_keys((th_descrambler_t *)ct, type, pid, even, odd); continue; - } - goto found; + } else if (ct->ct_type_sok[j]) + goto found; } } } @@ -2021,6 +2024,10 @@ capmt_update_elementary_stream(capmt_service_t *ct, int *_i, if (st->es_pid != ct->ct_pids[i] || type != ct->ct_types[i]) { ct->ct_pids[i] = st->es_pid; ct->ct_types[i] = type; + /* mark as valid for !multipid - TELETEXT may be shared */ + ct->ct_type_sok[i] = SCT_ISVIDEO(st->es_type) || + SCT_ISAUDIO(st->es_type) || + st->es_type == SCT_DVBSUB; return 1; }