catalinii / minisatip

minisatip is an SATIP server for linux using local DVB-S2, DVB-C, DVB-T or ATSC cards
https://minisatip.org
328 stars 81 forks source link

Multiple PMTs per CA PMT seems to no longer work #1068

Closed Jalle19 closed 1 year ago

Jalle19 commented 1 year ago

Even after changing e.g. -c 4:2 to -c 4:*2 I can't play two channels simultaneously anymore. The first channel freezes as soon as the second starts.

Last known working version is v1.2.49. I don't have time to bisect this, and it's too hard to pinpoint the exact commit by other means because almost every single commit contains some unrelated change nowadays which could or could not break things...

I'm considering forking minisatip and ripping out every single feature I don't need so I have a more stable ground to eventually build on :/

Jalle19 commented 1 year ago

FWIW I think this setting should be revamped so it can control two different things:

I'm certain that some CAMs can handle even more than 2x2 channels. Currently it's not possible to even test.

Jalle19 commented 1 year ago

Could be c4915b2e66fbeeb1d08c504b6768439b7fd0a589, but I haven't verified it. It adds a stop_pmt() even though the commit message has nothing to do with that.

Yuri666 commented 1 year ago

Can't confirm. My viaccess CAM doubled decrypted channels. image

Jalle19 commented 1 year ago

Could be something else then 🤷 Every commit these days has some unrelated PMT change so it's hard to tell.

Jalle19 commented 1 year ago

I have to run a custom branch to get 4 channnels decrypted.

Jalle19 commented 1 year ago

@Yuri666 is that with X:*2?

Yuri666 commented 1 year ago

yes image

catalinii commented 1 year ago

@Jalle19 there should be nothing impacting this. Feel free to upload a log (-l http)

Jalle19 commented 1 year ago

Tried again, this time with -c 6:*4,7:*4. With *4 minisatip crashes immediately when starting a channel:

Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.624 AD0]: Start streaming for stream sid 0, len 16 to handle 23 => 10.110.1.1:41378
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: PAT Adapter 0, Transponder ID 13, version 1, len 19
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: Adapter 0, PMT -1 sid 13000 (32C8), pid 1273
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: new filter 6 added for adapter 0, pid 1273, flags 17, mask_len 3, master_filter 6
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: Adapter 0, PMT -1 sid 13200 (3390), pid 1410
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: new filter 7 added for adapter 0, pid 1410, flags 17, mask_len 3, master_filter 7
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: Adapter 0, PMT -1 sid 13300 (33F4), pid 1353
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: new filter 8 added for adapter 0, pid 1353, flags 17, mask_len 3, master_filter 8
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: Adapter 0, PMT -1 sid 13400 (3458), pid 1457
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: new filter 9 added for adapter 0, pid 1457, flags 17, mask_len 3, master_filter 9
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: Adapter 0, PMT -1 sid 13600 (3520), pid 1424
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: new filter 10 added for adapter 0, pid 1424, flags 17, mask_len 3, master_filter 10
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: Dumping pids table for adapter 0, number of unknown pids: 0
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: pid 0, fd 24, packets 1, d/c/c2 errs 0/0/0, flags 1, pmt -1, filter 4, sock -1, p2 0, sids: 0 -1 -1 -1 -1 -1 -1 -1
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: pid 1260, fd 25, packets 435, d/c/c2 errs 239/1/0, flags 1, pmt -1, filter -1, sock -1, p2 2, sids: 0 -1 -1 -1 -1 -1 -1 -1
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: pid 1457, fd 26, packets 2, d/c/c2 errs 0/0/0, flags 1, pmt -1, filter 9, sock -1, p2 1, sids: 0 -1 -1 -1 -1 -1 -1 -1
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: pid 3259, fd 27, packets 34, d/c/c2 errs 19/1/0, flags 1, pmt -1, filter -1, sock -1, p2 0, sids: 0 -1 -1 -1 -1 -1 -1 -1
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: pid 1, fd 28, packets 1, d/c/c2 errs 0/0/0, flags 1, pmt -1, filter -1, sock -1, p2 1, sids: 0 -1 -1 -1 -1 -1 -1 -1
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: pid 16, fd 29, packets 3, d/c/c2 errs 0/0/0, flags 1, pmt -1, filter -1, sock -1, p2 2, sids: 0 -1 -1 -1 -1 -1 -1 -1
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: pid 18, fd 30, packets 213, d/c/c2 errs 0/1/1, flags 1, pmt -1, filter -1, sock -1, p2 117, sids: -1 -1 -1 -1 -1 -1 -1 -1
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: pid 17, fd 31, packets 1, d/c/c2 errs 0/0/0, flags 1, pmt -1, filter 5, sock -1, p2 0, sids: 0 -1 -1 -1 -1 -1 -1 -1
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: pid 1273, fd 0, packets 0, d/c/c2 errs 0/0/0, flags 2, pmt -1, filter 6, sock -1, p2 0, sids: -1 -1 -1 -1 -1 -1 -1 -1
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: pid 1410, fd 0, packets 0, d/c/c2 errs 0/0/0, flags 2, pmt -1, filter 7, sock -1, p2 0, sids: -1 -1 -1 -1 -1 -1 -1 -1
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: pid 1353, fd 0, packets 0, d/c/c2 errs 0/0/0, flags 2, pmt -1, filter 8, sock -1, p2 0, sids: -1 -1 -1 -1 -1 -1 -1 -1
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: pid 1424, fd 0, packets 0, d/c/c2 errs 0/0/0, flags 2, pmt -1, filter 10, sock -1, p2 0, sids: -1 -1 -1 -1 -1 -1 -1 -1
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: AD 0 [dvr 0 0], setting filter on PID 1273 for fd 32 [0 ms]
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: AD 0 [dvr 0 0], setting filter on PID 1410 for fd 33 [0 ms]
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: AD 0 [dvr 0 0], setting filter on PID 1353 for fd 34 [0 ms]
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: AD 0 [dvr 0 0], setting filter on PID 1424 for fd 35 [0 ms]
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: process_sdt: no PMT found for sid 13000 (32C8)
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: process_sdt: no PMT found for sid 13200 (3390)
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: process_sdt: no PMT found for sid 13300 (33F4)
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: process_sdt: no PMT found for sid 13400 (3458)
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: process_sdt: no PMT found for sid 13600 (3520)
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: returning new pmt 0 for adapter 0, pmt pid 1457, sid 13400 3458
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: new PMT 0 AD 0, pid: 05B1 (1457), len 50, pi_len 6, ver 7, pcr 1260, sid 3458 (13400)
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: PMT 0 PI pos 1 caid 0B00 => pid 0AC4 (2756), index 0
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: PMT pid 1457 - stream pid 04EC (1260), type 27, es_len 5, pos 15, caids 1
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: PMT pid 1457 - stream pid 0CBB (3259), type 6 [AC3], es_len 17, pos 25, caids 1
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: Sending PMT 0 to all CAs: ad_ca_mask 2, pmt_ca_mask 0, disabled_ca_mask 0
Mar 06 10:05:51 vladimir minisatip[52835]: [06/03 10:05:51.744 AD0]: ddci_process_pmt: adapter 0, pmt 0, pid 1457, sid 13400, ddid -1, name:
Mar 06 10:05:51 vladimir minisatip[52853]: ?? ??:0
Mar 06 10:05:51 vladimir minisatip[52855]: ?? ??:0
Mar 06 10:05:51 vladimir minisatip[52857]: ?? ??:0
Mar 06 10:05:51 vladimir minisatip[52859]: ?? ??:0
Mar 06 10:05:51 vladimir minisatip[52861]: ?? ??:0
Mar 06 10:05:51 vladimir minisatip[52863]: ?? ??:0
Mar 06 10:05:51 vladimir minisatip[52865]: ?? ??:0
Mar 06 10:05:51 vladimir minisatip[52867]: ?? ??:0
Mar 06 10:05:51 vladimir minisatip[52869]: ?? ??:0
Mar 06 10:05:51 vladimir minisatip[52871]: ?? ??:0
Mar 06 10:05:51 vladimir minisatip[52835]: RECEIVED SIGNAL 4 - SP=0 IP=0
Mar 06 10:05:51 vladimir minisatip[52835]: Obtained 10 stack frames.
Mar 06 10:05:51 vladimir minisatip[52835]: 0x555ec055e00a : 0x555ec055e0c2 : 0x7f9e1b332140 : 0x555ec059237d : 0x555ec057f07b : 0x555ec057f2df : 0x555ec057cd21 : 0x555ec057d000 : 0x555ec0553693 : 0x555ec0553faf :
Mar 06 10:05:51 vladimir systemd[1]: minisatip.service: Main process exited, code=exited, status=1/FAILURE
Mar 06 10:05:51 vladimir systemd[1]: minisatip.service: Failed with result 'exit-code'.

Not sure how to get a better trace :shrug:

Jalle19 commented 1 year ago

It also seems like this is back, even though it was already reverted once: https://github.com/catalinii/minisatip/pull/1022/files

$ journalctl -u minisatip -f | grep 'PID Continuity error'
Mar 06 10:11:02 vladimir minisatip[52903]: [06/03 10:11:02.096 AD6]: PID Continuity error (adapter 6, pos 268): pid: 018, Expected CC: 1, Actual CC: 3, CC Before 0
Mar 06 10:11:02 vladimir minisatip[52903]: [06/03 10:11:02.567 AD6]: PID Continuity error (adapter 6, pos 23): pid: 018, Expected CC: B, Actual CC: 1, CC Before A
Mar 06 10:11:02 vladimir minisatip[52903]: [06/03 10:11:02.567 AD6]: PID Continuity error (adapter 6, pos 370): pid: 018, Expected CC: 2, Actual CC: B, CC Before 1
Mar 06 10:11:03 vladimir minisatip[52903]: [06/03 10:11:03.042 AD6]: PID Continuity error (adapter 6, pos 425): pid: 018, Expected CC: 3, Actual CC: 2, CC Before 2
Mar 06 10:11:03 vladimir minisatip[52903]: [06/03 10:11:03.464 AD6]: PID Continuity error (adapter 6, pos 650): pid: 018, Expected CC: B, Actual CC: 3, CC Before A
Mar 06 10:11:03 vladimir minisatip[52903]: [06/03 10:11:03.583 AD6]: PID Continuity error (adapter 6, pos 24): pid: 018, Expected CC: 4, Actual CC: B, CC Before 3
Mar 06 10:11:04 vladimir minisatip[52903]: [06/03 10:11:04.061 AD6]: PID Continuity error (adapter 6, pos 228): pid: 018, Expected CC: 9, Actual CC: 4, CC Before 8
Mar 06 10:11:04 vladimir minisatip[52903]: [06/03 10:11:04.179 AD6]: PID Continuity error (adapter 6, pos 125): pid: 018, Expected CC: 5, Actual CC: 9, CC Before 4
Mar 06 10:11:04 vladimir minisatip[52903]: [06/03 10:11:04.518 AD6]: PID Continuity error (adapter 6, pos 447): pid: 018, Expected CC: 1, Actual CC: 5, CC Before 0
Mar 06 10:11:04 vladimir minisatip[52903]: [06/03 10:11:04.610 AD6]: PID Continuity error (adapter 6, pos 245): pid: 018, Expected CC: 6, Actual CC: 1, CC Before 5
Mar 06 10:11:04 vladimir minisatip[52903]: [06/03 10:11:04.980 AD6]: PID Continuity error (adapter 6, pos 661): pid: 018, Expected CC: 9, Actual CC: 6, CC Before 8
Mar 06 10:11:05 vladimir minisatip[52903]: [06/03 10:11:05.043 AD6]: PID Continuity error (adapter 6, pos 306): pid: 018, Expected CC: 7, Actual CC: 9, CC Before 6

Adapter 6 here is the DD CI adapter.

Jalle19 commented 1 year ago

So it seems like tvheadend was mysteriously at fault earlier and I can now watch 4 channels with -c 6:*2,7:*2 again. Next problem is the service names on the CI adapter:

image

For some reason they're all chopped off at the second word.

Jalle19 commented 1 year ago

Closing in favor of https://github.com/catalinii/minisatip/issues/1072

Jalle19 commented 1 year ago

It also seems like this is back, even though it was already reverted once: https://github.com/catalinii/minisatip/pull/1022/files

$ journalctl -u minisatip -f | grep 'PID Continuity error'
Mar 06 10:11:02 vladimir minisatip[52903]: [06/03 10:11:02.096 AD6]: PID Continuity error (adapter 6, pos 268): pid: 018, Expected CC: 1, Actual CC: 3, CC Before 0
Mar 06 10:11:02 vladimir minisatip[52903]: [06/03 10:11:02.567 AD6]: PID Continuity error (adapter 6, pos 23): pid: 018, Expected CC: B, Actual CC: 1, CC Before A
Mar 06 10:11:02 vladimir minisatip[52903]: [06/03 10:11:02.567 AD6]: PID Continuity error (adapter 6, pos 370): pid: 018, Expected CC: 2, Actual CC: B, CC Before 1
Mar 06 10:11:03 vladimir minisatip[52903]: [06/03 10:11:03.042 AD6]: PID Continuity error (adapter 6, pos 425): pid: 018, Expected CC: 3, Actual CC: 2, CC Before 2
Mar 06 10:11:03 vladimir minisatip[52903]: [06/03 10:11:03.464 AD6]: PID Continuity error (adapter 6, pos 650): pid: 018, Expected CC: B, Actual CC: 3, CC Before A
Mar 06 10:11:03 vladimir minisatip[52903]: [06/03 10:11:03.583 AD6]: PID Continuity error (adapter 6, pos 24): pid: 018, Expected CC: 4, Actual CC: B, CC Before 3
Mar 06 10:11:04 vladimir minisatip[52903]: [06/03 10:11:04.061 AD6]: PID Continuity error (adapter 6, pos 228): pid: 018, Expected CC: 9, Actual CC: 4, CC Before 8
Mar 06 10:11:04 vladimir minisatip[52903]: [06/03 10:11:04.179 AD6]: PID Continuity error (adapter 6, pos 125): pid: 018, Expected CC: 5, Actual CC: 9, CC Before 4
Mar 06 10:11:04 vladimir minisatip[52903]: [06/03 10:11:04.518 AD6]: PID Continuity error (adapter 6, pos 447): pid: 018, Expected CC: 1, Actual CC: 5, CC Before 0
Mar 06 10:11:04 vladimir minisatip[52903]: [06/03 10:11:04.610 AD6]: PID Continuity error (adapter 6, pos 245): pid: 018, Expected CC: 6, Actual CC: 1, CC Before 5
Mar 06 10:11:04 vladimir minisatip[52903]: [06/03 10:11:04.980 AD6]: PID Continuity error (adapter 6, pos 661): pid: 018, Expected CC: 9, Actual CC: 6, CC Before 8
Mar 06 10:11:05 vladimir minisatip[52903]: [06/03 10:11:05.043 AD6]: PID Continuity error (adapter 6, pos 306): pid: 018, Expected CC: 7, Actual CC: 9, CC Before 6

Adapter 6 here is the DD CI adapter.

@catalinii these messages look like a bug. Here's some more:

negge@vladimir:~$ journalctl -u minisatip -f | grep -v process_sdt | grep 'PID Continuity error'
Mar 12 20:07:42 vladimir minisatip[80152]: [12/03 20:07:42.822 AD6]: PID Continuity error (adapter 6, pos 587): pid: 018, Expected CC: 5, Actual CC: 6, CC Before 4
Mar 12 20:07:42 vladimir minisatip[80152]: [12/03 20:07:42.948 AD6]: PID Continuity error (adapter 6, pos 273): pid: 018, Expected CC: 7, Actual CC: 5, CC Before 6
Mar 12 20:07:43 vladimir minisatip[80152]: [12/03 20:07:43.360 AD6]: PID Continuity error (adapter 6, pos 29): pid: 018, Expected CC: D, Actual CC: 7, CC Before C
Mar 12 20:07:43 vladimir minisatip[80152]: [12/03 20:07:43.444 AD6]: PID Continuity error (adapter 6, pos 77): pid: 018, Expected CC: 8, Actual CC: D, CC Before 7
Mar 12 20:07:43 vladimir minisatip[80152]: [12/03 20:07:43.783 AD6]: PID Continuity error (adapter 6, pos 643): pid: 018, Expected CC: 5, Actual CC: 8, CC Before 4
Mar 12 20:07:43 vladimir minisatip[80152]: [12/03 20:07:43.926 AD6]: PID Continuity error (adapter 6, pos 10): pid: 018, Expected CC: 9, Actual CC: 5, CC Before 8
Mar 12 20:07:44 vladimir minisatip[80152]: [12/03 20:07:44.280 AD6]: PID Continuity error (adapter 6, pos 654): pid: 018, Expected CC: D, Actual CC: 9, CC Before C
Mar 12 20:07:44 vladimir minisatip[80152]: [12/03 20:07:44.378 AD6]: PID Continuity error (adapter 6, pos 550): pid: 018, Expected CC: A, Actual CC: D, CC Before 9
Mar 12 20:07:44 vladimir minisatip[80152]: [12/03 20:07:44.802 AD6]: PID Continuity error (adapter 6, pos 455): pid: 018, Expected CC: 5, Actual CC: A, CC Before 4
Mar 12 20:07:44 vladimir minisatip[80152]: [12/03 20:07:44.858 AD6]: PID Continuity error (adapter 6, pos 449): pid: 018, Expected CC: B, Actual CC: 5, CC Before A
Mar 12 20:07:45 vladimir minisatip[80152]: [12/03 20:07:45.299 AD6]: PID Continuity error (adapter 6, pos 494): pid: 018, Expected CC: D, Actual CC: B, CC Before C
Mar 12 20:07:45 vladimir minisatip[80152]: [12/03 20:07:45.341 AD6]: PID Continuity error (adapter 6, pos 268): pid: 018, Expected CC: C, Actual CC: D, CC Before B
Mar 12 20:07:45 vladimir minisatip[80152]: [12/03 20:07:45.837 AD6]: PID Continuity error (adapter 6, pos 238): pid: 018, Expected CC: B, Actual CC: C, CC Before A
Mar 12 20:07:45 vladimir minisatip[80152]: [12/03 20:07:45.934 AD6]: PID Continuity error (adapter 6, pos 504): pid: 018, Expected CC: D, Actual CC: B, CC Before C
Mar 12 20:07:46 vladimir minisatip[80152]: [12/03 20:07:46.317 AD6]: PID Continuity error (adapter 6, pos 327): pid: 018, Expected CC: 3, Actual CC: D, CC Before 2
Mar 12 20:07:46 vladimir minisatip[80152]: [12/03 20:07:46.415 AD6]: PID Continuity error (adapter 6, pos 373): pid: 018, Expected CC: E, Actual CC: 3, CC Before D
Mar 12 20:07:46 vladimir minisatip[80152]: [12/03 20:07:46.797 AD6]: PID Continuity error (adapter 6, pos 323): pid: 018, Expected CC: B, Actual CC: E, CC Before A
Mar 12 20:07:46 vladimir minisatip[80152]: [12/03 20:07:46.912 AD6]: PID Continuity error (adapter 6, pos 225): pid: 018, Expected CC: F, Actual CC: B, CC Before E
Mar 12 20:07:47 vladimir minisatip[80152]: [12/03 20:07:47.335 AD6]: PID Continuity error (adapter 6, pos 155): pid: 018, Expected CC: 3, Actual CC: F, CC Before 2
Mar 12 20:07:47 vladimir minisatip[80152]: [12/03 20:07:47.392 AD6]: PID Continuity error (adapter 6, pos 162): pid: 018, Expected CC: 0, Actual CC: 3, CC Before F
Mar 12 20:07:47 vladimir minisatip[80152]: [12/03 20:07:47.817 AD6]: PID Continuity error (adapter 6, pos 101): pid: 018, Expected CC: B, Actual CC: 0, CC Before A
Mar 12 20:07:47 vladimir minisatip[80152]: [12/03 20:07:47.873 AD6]: PID Continuity error (adapter 6, pos 32): pid: 018, Expected CC: 1, Actual CC: B, CC Before 0
Mar 12 20:07:48 vladimir minisatip[80152]: [12/03 20:07:48.326 AD6]: PID Continuity error (adapter 6, pos 178): pid: 018, Expected CC: 3, Actual CC: 1, CC Before 2
Mar 12 20:07:48 vladimir minisatip[80152]: [12/03 20:07:48.326 AD6]: PID Continuity error (adapter 6, pos 562): pid: 018, Expected CC: 2, Actual CC: 3, CC Before 1
Mar 12 20:07:48 vladimir minisatip[80152]: [12/03 20:07:48.807 AD6]: PID Continuity error (adapter 6, pos 585): pid: 018, Expected CC: 1, Actual CC: 2, CC Before 0
Mar 12 20:07:48 vladimir minisatip[80152]: [12/03 20:07:48.950 AD6]: PID Continuity error (adapter 6, pos 38): pid: 018, Expected CC: 3, Actual CC: 1, CC Before 2
Mar 12 20:07:49 vladimir minisatip[80152]: [12/03 20:07:49.343 AD6]: PID Continuity error (adapter 6, pos 4): pid: 018, Expected CC: 9, Actual CC: 3, CC Before 8
Mar 12 20:07:49 vladimir minisatip[80152]: [12/03 20:07:49.428 AD6]: PID Continuity error (adapter 6, pos 42): pid: 018, Expected CC: 4, Actual CC: 9, CC Before 3
Mar 12 20:07:49 vladimir minisatip[80152]: [12/03 20:07:49.824 AD6]: PID Continuity error (adapter 6, pos 9): pid: 018, Expected CC: 1, Actual CC: 4, CC Before 0
Mar 12 20:07:49 vladimir minisatip[80152]: [12/03 20:07:49.882 AD6]: PID Continuity error (adapter 6, pos 514): pid: 018, Expected CC: 5, Actual CC: 1, CC Before 4
Mar 12 20:07:50 vladimir minisatip[80152]: [12/03 20:07:50.324 AD6]: PID Continuity error (adapter 6, pos 364): pid: 018, Expected CC: 9, Actual CC: 5, CC Before 8
Mar 12 20:07:50 vladimir minisatip[80152]: [12/03 20:07:50.365 AD6]: PID Continuity error (adapter 6, pos 298): pid: 018, Expected CC: 6, Actual CC: 9, CC Before 5
Mar 12 20:07:50 vladimir minisatip[80152]: [12/03 20:07:50.802 AD6]: PID Continuity error (adapter 6, pos 416): pid: 018, Expected CC: 1, Actual CC: 6, CC Before 0
Mar 12 20:07:50 vladimir minisatip[80152]: [12/03 20:07:50.844 AD6]: PID Continuity error (adapter 6, pos 278): pid: 018, Expected CC: 7, Actual CC: 1, CC Before 6
Mar 12 20:07:51 vladimir minisatip[80152]: [12/03 20:07:51.339 AD6]: PID Continuity error (adapter 6, pos 253): pid: 018, Expected CC: F, Actual CC: 7, CC Before E

There's a clear pattern to these. It seems like the expected and actual CC is offset by one. Any idea what could be causing this? In my case the continuity errors start sometimes when I try to open a second channel on a CAM (unsuccessfully, it won't start playing, perhaps due to the CC errors).

Should I open a separate ticket about this?

Jalle19 commented 1 year ago

AFAICT the continuity counter errors come from PID 18 which is the virtual EPG/EIT added by ddci.c. I've asked before if it can be removed because I don't see the point of it, but I haven't yet actually tried removing it.

Jalle19 commented 1 year ago

Screenshot_20230312-205907

Apparently it really is true that PID 18 is required. Guess there's a bug hiding in there somewhere then if the CC becomes wrong in certain situations.

catalinii commented 1 year ago

Check if pid 18 is mapped to the ddci adapter. This could happen because ddci_cretae_epg adds packets with pid 18. ATM we do not explicitly add pid 18 but maybe we should forbid mapping it

Jalle19 commented 1 year ago

Yeah I'm digging. When a second channel is started, its PID 17 gets mapped to PID 18, and that's when the CC errors start. We're also adding the EIT data twice per PMT, and I suspect that it's related to the continuity counter errors. I'll have to do some more digging and more runtime testing.

Jalle19 commented 1 year ago

Yeah, I think I get it now. In ddci_add_psi we:

  1. Write the PAT to the TS stream as PID 0
  2. Write each PMT to the TS stream using the mapped PID
  3. Run ddci_create_epg, which creates a TS packet itself with a hardcoded PID of 18.

This would normally be fine - the only packets with PID 18 in the final TS stream are the ones ddci_create_epg creates. However, the SDT PID (17) is mapped to PID 18 and written to the TS before we even get to ddci_add_psi, so the resulting PID 18 sent to the DDCI adapter is an unholy mix of both the SDT from one adapter and the EIT stream from ddci_create_epg.

I'm thinking the best solution would be to not map PID 17 but instead introduce a ddci_create_sdt which generates a new SDT for the DDCI TS stream.

I'm wondering what issues this has been causing... Could very well explain some decryption problems since both SDT and EIT are required according to the spec, and the reason PID 17 was mapped originally was to fix CAM updates or whatever.

I think I'll open a new ticket for this.

Jalle19 commented 1 year ago

https://github.com/catalinii/minisatip/issues/1077