Project

General

Profile

Bug #5097

Multipid not detected properly

Added by Joe User over 2 years ago. Updated about 2 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
Descrambling
Target version:
-
Start date:
2018-05-02
Due date:
% Done:

0%

Estimated time:
Found in version:
4.3 commit 2a36607d7
Affected Versions:

Description

I finally updated from c1a5e43 to the latest git and descrambling failed for multipid (extended_cw) channels. Errors reported that keys were not found. At first I thought it may be related to switching from ffdecsa to dvbcsa, but I worked my way back and found the problem started with changes to capmt.c in commit 2a36607d7 ([[https://github.com/tvheadend/tvheadend/commit/2a36607d7df4d3f7087ac47305f723af0adfdeb8#diff-84c61f754429bea32ae72788ca1f4c0b]] )

If I reverse these changes, descrambling works again for multipid channels. (tested with latest 4.3-1252~g595fd17)

diff --git a/src/descrambler/capmt.c b/src/descrambler/capmt.c
index dcce0d8..c99ea77 100644
--- a/src/descrambler/capmt.c
+++ b/src/descrambler/capmt.c
@@ -190,7 +190,6 @@ typedef struct capmt_service {

   /* PIDs list */
   uint16_t ct_pids[MAX_PIDS];
-  uint8_t  ct_multipid;

   /* Elementary stream types */
   uint8_t ct_types[MAX_PIDS];
@@ -1118,7 +1117,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) {
@@ -1137,6 +1136,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++) {
@@ -1145,7 +1146,7 @@ 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 (ct->ct_multipid) {
+          if (multipid) {
             ct->ct_ok_flag = 1;
             descrambler_keys((th_descrambler_t *)ct, type, pid, even, odd);
             continue;
@@ -2457,7 +2458,6 @@ capmt_service_start(caclient_t *cac, service_t *s)
   ct              = calloc(1, sizeof(capmt_service_t));
   ct->ct_capmt    = capmt;
   ct->ct_adapter  = tuner;
-  ct->ct_multipid = descrambler_multi_pid((th_descrambler_t *)ct);

   i = 0;
   TAILQ_FOREACH(st, &t->s_filt_components, es_filt_link) {

Since nobody else has reported this, it is possible it is due to something unique in my configuration, but I am not sure what???

Associated revisions

Revision 67758d02 (diff)
Added by Jaroslav Kysela about 2 years ago

campt: fix the ct_multipid initialization, fixes #5097

History

#1

Updated by Joe User about 2 years ago

This is still a problem.

In descrambler.c:

descrambler_multi_pid ( th_descrambler_t *td )
{
  service_t *t = td->td_service;
  th_descrambler_runtime_t *dr;

  if (t == NULL || (dr = t->s_descramble) == NULL) 
    return 0;
  return dr->dr_key_multipid;
}

(dr = t->s_descramble) is always null when called during "capmt_service_start" and so ct_multipid is always set to 0 and never updated.

Since descrambler properly uses dr_key_multipid, some channels still work due to the way keys are indexed in capmt, but other services fail because capmt does not continue setting keys because ct_multipid is always 0.

    pids = cai->pids;

      for (i = 0; i < MAX_PIDS; i++) {
        if (pids[i] == 0) continue;
        for (j = 0; j < MAX_PIDS; j++) {
          pid = ct->ct_pids[j];
          if (pid == 0) break;
          if (pid == pids[i]) {
            if (ct->ct_multipid) {
              ct->ct_ok_flag = 1;
              descrambler_keys((th_descrambler_t *)ct, type, pid, even, odd);
              continue;
            } else if (ct->ct_type_sok[j])
              goto found;
          }
        }     
      }       
      continue;

  found:      
      ct->ct_ok_flag = 1;
      descrambler_keys((th_descrambler_t *)ct, type, pid, even, odd);                     
    } 

#2

Updated by Petar Ivanov about 2 years ago

Yes Joe Miller User is right, when apply changes who give in thread, i can watch same time powervu channels AFN on 9E and Discovery channels on 1W same time, right now AFN not work now, but i was try when work and with this changes, both powervu work same time. If not apply, not work both powervu same time. This is good this changes to be apply in master.

#3

Updated by Joe User about 2 years ago

Looks like the problem is "td->td_service " is not set until about 35 lines after trying to call "descrambler_multi_pid((th_descrambler_t *)ct)"

#4

Updated by Petar Ivanov about 2 years ago

Yesterday out AFN fix for oscam and now i build new oscam, if not apply change from begging of thread, AFN not open, when apply and AFN start work.

#5

Updated by Jaroslav Kysela about 2 years ago

Fixed in v4.3-1475-g94a7f2df8 .

#6

Updated by Jaroslav Kysela about 2 years ago

  • Status changed from New to Fixed

Also available in: Atom PDF