cwc: Fix the emm tables shutdown sequence

This commit is contained in:
Jaroslav Kysela 2014-08-08 18:55:23 +02:00
parent 47a1cbccaf
commit c1166d75c8
2 changed files with 6 additions and 3 deletions

View file

@ -2146,11 +2146,11 @@ cwc_caid_update(mpegts_mux_t *mux, uint16_t caid, uint16_t pid, int valid)
mux, caid, caid, pid, pid, valid);
pthread_mutex_lock(&cwc_mutex);
TAILQ_FOREACH(cwc, &cwcs, cwc_link) {
if (cwc->cwc_running) {
if (valid < 0 || cwc->cwc_running) {
LIST_FOREACH(pcard, &cwc->cwc_cards, cs_card) {
if (pcard->cwc_caid == caid) {
if (valid < 0 || pcard->cwc_caid == caid) {
if (pcard->cwc_mux && pcard->cwc_mux != mux) continue;
if (valid) {
if (valid > 0) {
pcard->cwc = cwc;
pcard->cwc_mux = mux;
descrambler_open_emm(mux, pcard, caid, cwc_emm);

View file

@ -573,6 +573,9 @@ descrambler_flush_tables( mpegts_mux_t *mux )
if (mux == NULL)
return;
tvhtrace("descrambler", "mux %p - flush tables", mux);
#if ENABLE_CWC
cwc_caid_update(mux, 0, 0, -1);
#endif
pthread_mutex_lock(&mux->mm_descrambler_lock);
while ((dt = TAILQ_FIRST(&mux->mm_descrambler_tables)) != NULL) {
while ((ds = TAILQ_FIRST(&dt->sections)) != NULL) {