]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
check wrong prefcapid 208/head
authorSergey Linnik <linniksa@gmail.com>
Mon, 7 Jan 2013 11:01:00 +0000 (15:01 +0400)
committerSergey Linnik <linniksa@gmail.com>
Mon, 7 Jan 2013 11:01:00 +0000 (15:01 +0400)
src/cwc.c

index d8733ec7baff273a2697368f8ae94bfc93ca8643..79c10008cfb4b4f86479f1973a5e05d7558b2d8f 100644 (file)
--- a/src/cwc.c
+++ b/src/cwc.c
@@ -1635,11 +1635,20 @@ cwc_table_input(struct th_descrambler *td, struct service *t,
       tvhlog(LOG_DEBUG, "cwc", "Insert after unexpected reply");
     }
 
-    if (ct->cs_okchannel == -3 && t->s_prefcapid == st->es_pid) {
-      ep = calloc(1, sizeof(ecm_pid_t));
-      ep->ep_pid = t->s_prefcapid;
-      LIST_INSERT_HEAD(&ct->cs_pids, ep, ep_link);
-      tvhlog(LOG_DEBUG, "cwc", "Insert only one new ECM channel %d for service id %d", t->s_prefcapid, sid);
+    if (ct->cs_okchannel == -3 && t->s_prefcapid != 0) {
+      if (t->s_prefcapid == st->es_pid) {
+        ep = calloc(1, sizeof(ecm_pid_t));
+        ep->ep_pid = t->s_prefcapid;
+        LIST_INSERT_HEAD(&ct->cs_pids, ep, ep_link);
+        tvhlog(LOG_DEBUG, "cwc", "Insert only one new ECM channel %d for service id %d", t->s_prefcapid, sid);
+      } else {
+        // check if prefcapid wrong
+        struct elementary_stream *prefca = service_stream_find(t, t->s_prefcapid);
+
+        if (!prefca || prefca->es_type != SCT_CA) {
+          t->s_prefcapid = 0;
+        }
+      }
     }
 
     if (ct->cs_okchannel == -1 || (ct->cs_okchannel == -3 && t->s_prefcapid == 0)) {