Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minisatip tries wrong PMT #1129

Closed
surfcu opened this issue Oct 14, 2023 · 39 comments
Closed

Minisatip tries wrong PMT #1129

surfcu opened this issue Oct 14, 2023 · 39 comments
Labels

Comments

@surfcu
Copy link

surfcu commented Oct 14, 2023

I can watch all Digital Platform channels on my enigma2 (Zgemma h9 twin se) box 42e.
When running Minisatip can provide all but beIN SPORTS 2 (PMT=48).
Instead when pmt=48 is requested minisatip tries Ticari beIN Sports 2 (PMT=52) and fails since it's not in the subscription.

minisatip.log

Any ideas?

@surfcu
Copy link
Author

surfcu commented Oct 29, 2023

I think problem is pmt 48 is misinterpreted as audio. But I don't know much about coding.

@iandebris
Copy link

i think this happens when the VPID (and PCR) is the same on multiple channels and only APID is different (or reverse, same APID but different VPID on different PMTs like beIN SPORTS ticari/commercial and non-commercial) as it also happens on d***t 42e as well with stingray music channels (12188 V 27500, 8PSK DVB-S2 5/6), all music channels like DEEP BLUES (PMT 1935, APID 235), RIDDIM (PMT 1937, APID 237) etc use the VPID of iTVGAMETEST (PMT 4250, VPID 108) and its a roll of dice whether or not the correct PMT is utilized.

for instance if you load up NATURE ESCAPE (PMT 1908, PCR 308, VPID 108, APID 208), minisatip may use the correct thing; or just go pick up random other PMT that has the same VPID, for instance '80'ler (PID 1922, PCR 308, VPID 108, APID 222)

i've included a sample log from a raspberry pi 4 with TurboSight TBS 5930 DVB-S/S2/S2x

msip.log

@Jalle19 Jalle19 added the bug label Jun 17, 2024
@Jalle19
Copy link
Collaborator

Jalle19 commented Jun 17, 2024

Thanks for the additional clues!

@Jalle19
Copy link
Collaborator

Jalle19 commented Jun 17, 2024

So it seems that the problem is that get_master_pmt_for_pid() returns any PMT that happens to contain some particular PID. This leads to that PMT (PID 1922 in the log above) being set as the master PMT for all the other PMTs in the same PAT, which is obviously incorrect.

@Jalle19
Copy link
Collaborator

Jalle19 commented Jun 17, 2024

Same issue in @surfcu 's log (PMT 1 (52) gets incorrectly marked as master for PMT 10 (48)):

$ cat minisatip\(8\).log | grep -e 'new PMT 1 \|new PMT 10 \|master pmt set to'
[13/10 23:19:44.170 AD0]: new PMT 1 AD 0, pid: 0034 (52), len 125, pi_len 0, ver 3, pcr 3301, sid 3718 (14104)  
[13/10 23:19:44.334 AD0]: PMT 5, master pmt set to 3
[13/10 23:19:44.456 AD0]: PMT 8, master pmt set to 3
[13/10 23:19:44.457 AD0]: PMT 9, master pmt set to 0
[13/10 23:19:44.497 AD0]: new PMT 10 AD 0, pid: 0030 (48), len 125, pi_len 0, ver 3, pcr 3301, sid 3715 (14101)  
[13/10 23:19:44.497 AD0]: PMT 10, master pmt set to 1
[13/10 23:19:44.538 AD0]: PMT 11, master pmt set to 0
[13/10 23:19:44.579 AD0]: PMT 12, master pmt set to 1
[13/10 23:19:44.620 AD0]: PMT 13, master pmt set to 4

@Jalle19
Copy link
Collaborator

Jalle19 commented Jun 17, 2024

@catalinii what do you think would be the best fix for this? Can you elaborate what the idea behind "master PMT" is? Does it make any sense anymore?

@catalinii
Copy link
Owner

Generally for a vpid/apid, you can have multiple PMTs reporting those vpid/apids (for example the German PMT and the Austrian PMT).

obviously the user owns just one card, however it is imposing to know which one of them is it.

so Master PMT is the first PMT that minisatip receives and the other PMTs are linked to the master, so when the CAPMT is sent it contains all the capids and caids for all PMTs that contains the same vpid/apid to ensure it can be decrypted.

The fix would be to identify why the wrong PMT is linked to the master PMT (see process_pmt)

@Jalle19
Copy link
Collaborator

Jalle19 commented Jun 18, 2024

Perhaps the logic should be changed then to look for a PMT that contains both the new PMT's VPID and APID, not just either one of them? Not sure how much better that is but it should at least be a little less prone to false positives.

@Jalle19
Copy link
Collaborator

Jalle19 commented Jun 18, 2024

Then again I don't know what would happen to encrypted radio channels (that presumably don't have a VPID at all)

@Jalle19
Copy link
Collaborator

Jalle19 commented Jun 18, 2024

Jalle19@bdb643b trying a fix here, haven't tested it yet

@Jalle19
Copy link
Collaborator

Jalle19 commented Jun 18, 2024

Seems to be that going from a random PID to a PMT is not possible to get absolutely right

@catalinii
Copy link
Owner

Try it, let’s see if it works

@Jalle19
Copy link
Collaborator

Jalle19 commented Jun 19, 2024

image
Now that I think about this some more, it seems like even if we match against both video and audio PIDs it won't fix OPs issue.

@Jalle19
Copy link
Collaborator

Jalle19 commented Jun 19, 2024

@Jalle19
Copy link
Collaborator

Jalle19 commented Jun 19, 2024

Testing it myself at the moment, seems to work just fine

@iandebris
Copy link

[...] can you try this branch? https://github.com/Jalle19/minisatip/tree/master-pmt2

@Jalle19 Heya, your master-pmt2 branch seems to work, though this time it looks like oscam is choked (running out of demuxers) by many PMTs its receiving (I guess this is what @catalinii meant by finding a master PMT). I'm including the minisatip log and a partial oscam log below:

msip.log

oscam.log

oscam.conf:

[global]
logfile                       = stdout
lb_mode                       = 1
lb_nbest_readers              = 2
lb_force_reopen_always        = 1
lb_stat_cleanup               = 24
disablecrccws                 = 1
disablecrccws_only_for        = 092B:000000;06F8:000000;0656:000000

[cache]

[dvbapi]
enabled                       = 1
au                            = 1
pmt_mode                      = 4
request_mode                  = 1
listen_port                   = 15012
delayer                       = 65
user                          = dvbapi
read_sdt                      = 2
write_sdt_prov                = 1
demuxer_fix                   = 1
boxtype                       = pc

[webif]
httpport                      = 8888
httpallowed                   = 127.0.0.1,192.168.0.0-192.168.255.255,10.0.0.0-10.255.255.255,172.16.0.0-172.31.255.255,::1

oscam.user:

[account]
user                          = dvbapi
uniq                          = 2
au                            = 1
max_connections               = 5
group                         = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16

@Jalle19
Copy link
Collaborator

Jalle19 commented Jun 19, 2024

I figured that could happen. Need to find a better way to "start" only the right PMT.

@Jalle19
Copy link
Collaborator

Jalle19 commented Jun 20, 2024

@iandebris are you able to test the Bein Sports 2 vs. Ticari bein sports case?

@iandebris
Copy link

[...] are you able to test the Bein Sports 2 vs. Ticari bein sports case?

@Jalle19 sorry, although I don't have an access card for the provider of those channels; I can at least confirm the same PMT demux flood happens on oscam:

2024/06/20 22:07:06 6C6DDD5E c   (dvbapi) Client connected: 'minisatip/1.3.~ffa4004' (protocol version = 2)
2024/06/20 22:07:38 6C6DDD5E c        (-) -- Skipped 1 duplicated log lines --
2024/06/20 22:07:38 6C6DDD5E c   (dvbapi) Demuxer 0 ecmpid 0 CAID: 0664 ECM_PID: 1E7E PROVID: 000000 
2024/06/20 22:07:38 6C6DDD5E c   (dvbapi) Demuxer 0 ecmpid 1 CAID: 06EE ECM_PID: 13F0 PROVID: 000000 
2024/06/20 22:07:38 6C6DDD5E c   (dvbapi) Demuxer 0 found 2 ECM pids and 5 STREAM pids in CA PMT
2024/06/20 22:07:38 6C6DDD5E c   (dvbapi) Demuxer 0 no suitable readers found that can be used for decoding!
2024/06/20 22:07:38 6C6DDD5E c   (dvbapi) Demuxer 1 ecmpid 0 CAID: 06EE ECM_PID: 13ED PROVID: 000000 
2024/06/20 22:07:38 6C6DDD5E c   (dvbapi) Demuxer 1 ecmpid 1 CAID: 0664 ECM_PID: 1E7C PROVID: 000000 
2024/06/20 22:07:38 6C6DDD5E c   (dvbapi) Demuxer 1 found 2 ECM pids and 5 STREAM pids in CA PMT
2024/06/20 22:07:38 6C6DDD5E c   (dvbapi) Demuxer 1 no suitable readers found that can be used for decoding!
2024/06/20 22:07:38 6C6DDD5E c   (dvbapi) Demuxer 2 ecmpid 0 CAID: 0664 ECM_PID: 1E7D PROVID: 000000 
2024/06/20 22:07:38 6C6DDD5E c   (dvbapi) Demuxer 2 ecmpid 1 CAID: 06EE ECM_PID: 13EF PROVID: 000000 
2024/06/20 22:07:38 6C6DDD5E c   (dvbapi) Demuxer 2 found 2 ECM pids and 3 STREAM pids in CA PMT
2024/06/20 22:07:38 6C6DDD5E c   (dvbapi) Demuxer 2 no suitable readers found that can be used for decoding!
2024/06/20 22:07:41 6C6DDD5E c   (dvbapi) Demuxer 0 no enabled matching ecmpids -> decoding is waiting for matching readers!
2024/06/20 22:07:42 6C6DDD5E c   (dvbapi) Demuxer 1 no enabled matching ecmpids -> decoding is waiting for matching readers!
2024/06/20 22:07:42 6C6DDD5E c   (dvbapi) Demuxer 0 stopped descrambling for program 3718 (0664@000000:3718 unknown)
2024/06/20 22:07:42 6C6DDD5E c   (dvbapi) Demuxer 1 stopped descrambling for program 3715 (06EE@000000:3715 unknown)
2024/06/20 22:07:42 6C6DDD5E c   (dvbapi) Demuxer 2 stopped descrambling for program 3717 (0664@000000:3717 unknown)
2024/06/20 22:07:42 6C6DDD5E c   (dvbapi) Demuxer 0 ecmpid 0 CAID: 0664 ECM_PID: 1E7E PROVID: 000000 
2024/06/20 22:07:42 6C6DDD5E c   (dvbapi) Demuxer 0 ecmpid 1 CAID: 06EE ECM_PID: 13F0 PROVID: 000000 
2024/06/20 22:07:42 6C6DDD5E c   (dvbapi) Demuxer 0 found 2 ECM pids and 5 STREAM pids in CA PMT
2024/06/20 22:07:42 6C6DDD5E c   (dvbapi) Demuxer 0 no suitable readers found that can be used for decoding!
2024/06/20 22:07:42 6C6DDD5E c   (dvbapi) Demuxer 1 ecmpid 0 CAID: 06EE ECM_PID: 13ED PROVID: 000000 
2024/06/20 22:07:42 6C6DDD5E c   (dvbapi) Demuxer 1 ecmpid 1 CAID: 0664 ECM_PID: 1E7C PROVID: 000000 
2024/06/20 22:07:42 6C6DDD5E c   (dvbapi) Demuxer 1 found 2 ECM pids and 5 STREAM pids in CA PMT
2024/06/20 22:07:42 6C6DDD5E c   (dvbapi) Demuxer 1 no suitable readers found that can be used for decoding!
2024/06/20 22:07:42 6C6DDD5E c   (dvbapi) Demuxer 2 ecmpid 0 CAID: 0664 ECM_PID: 1E7D PROVID: 000000 
2024/06/20 22:07:42 6C6DDD5E c   (dvbapi) Demuxer 2 ecmpid 1 CAID: 06EE ECM_PID: 13EF PROVID: 000000 
2024/06/20 22:07:42 6C6DDD5E c   (dvbapi) Demuxer 2 found 2 ECM pids and 3 STREAM pids in CA PMT
2024/06/20 22:07:42 6C6DDD5E c   (dvbapi) Demuxer 2 no suitable readers found that can be used for decoding!
2024/06/20 22:07:45 6C6DDD5E c   (dvbapi) Demuxer 0 stopped descrambling for program 3718 (0664@000000:3718 unknown)
2024/06/20 22:07:45 6C6DDD5E c   (dvbapi) Demuxer 1 stopped descrambling for program 3715 (06EE@000000:3715 unknown)
2024/06/20 22:07:45 6C6DDD5E c   (dvbapi) Demuxer 2 stopped descrambling for program 3717 (0664@000000:3717 unknown)
2024/06/20 22:07:45 6C6DDD5E c   (dvbapi) Demuxer 0 ecmpid 0 CAID: 0664 ECM_PID: 1E7E PROVID: 000000 
2024/06/20 22:07:45 6C6DDD5E c   (dvbapi) Demuxer 0 ecmpid 1 CAID: 06EE ECM_PID: 13F0 PROVID: 000000 
2024/06/20 22:07:45 6C6DDD5E c   (dvbapi) Demuxer 0 found 2 ECM pids and 5 STREAM pids in CA PMT
2024/06/20 22:07:45 6C6DDD5E c   (dvbapi) Demuxer 0 no suitable readers found that can be used for decoding!
2024/06/20 22:07:45 6C6DDD5E c   (dvbapi) Demuxer 1 ecmpid 0 CAID: 06EE ECM_PID: 13ED PROVID: 000000 
2024/06/20 22:07:45 6C6DDD5E c   (dvbapi) Demuxer 1 ecmpid 1 CAID: 0664 ECM_PID: 1E7C PROVID: 000000 
2024/06/20 22:07:45 6C6DDD5E c   (dvbapi) Demuxer 1 found 2 ECM pids and 5 STREAM pids in CA PMT
2024/06/20 22:07:45 6C6DDD5E c   (dvbapi) Demuxer 1 no suitable readers found that can be used for decoding!
2024/06/20 22:07:45 6C6DDD5E c   (dvbapi) Demuxer 2 ecmpid 0 CAID: 0664 ECM_PID: 1E7D PROVID: 000000 
2024/06/20 22:07:45 6C6DDD5E c   (dvbapi) Demuxer 2 ecmpid 1 CAID: 06EE ECM_PID: 13EF PROVID: 000000 
2024/06/20 22:07:45 6C6DDD5E c   (dvbapi) Demuxer 2 found 2 ECM pids and 3 STREAM pids in CA PMT
2024/06/20 22:07:45 6C6DDD5E c   (dvbapi) Demuxer 2 no suitable readers found that can be used for decoding!
2024/06/20 22:07:47 6C6DDD5E c   (dvbapi) Demuxer 0 stopped descrambling for program 3718 (0664@000000:3718 unknown)
2024/06/20 22:07:47 6C6DDD5E c   (dvbapi) Demuxer 1 stopped descrambling for program 3715 (06EE@000000:3715 unknown)
2024/06/20 22:07:47 6C6DDD5E c   (dvbapi) Demuxer 2 stopped descrambling for program 3717 (0664@000000:3717 unknown)

@Jalle19
Copy link
Collaborator

Jalle19 commented Jun 27, 2024

@catalinii in get_master_pmt_for_pid() it seems we need to be able to look at the PIDs subscribed on the adapter and pick the first PMT which PID is subscribed and which stream PIDs contain the PID given to the function. ad->pids seems to contain all PIDs from the transponder when this function is called though, so that can't be used. Any ideas?

@catalinii
Copy link
Owner

The idea is that minisatip will cache all PMTs for all seen transponders, so the list of pmts (and pmt-> master pmt) needs to be correct regardless of the subscribed pids.

The other reason is that the clinet can chabge channels (and subscribed pids) without chaging the transponder. Again the subscribed pids should not be relevant.

PAT/PMT scanning is an expensive operation as you need to wait for them to arrive which could take more than 1s

@surfcu
Copy link
Author

surfcu commented Oct 12, 2024

get_master_pmt_for_pid checks if vpid and apid match and assigns it as master_pmt.
In this case
340949078-9584ab23-3f87-4340-a016-08c66f0c9b9e
three channels have same vpid and apid.
Same problem will occur when two or more channels with same vpid and apid.

I think the solution would be using SID instead of master_pmt.

It was discussed before for different purposes here

@Jalle19
Copy link
Collaborator

Jalle19 commented Oct 13, 2024

I tried to fix this at one point but stalled because the fix wouldn't have been complete (would only have worked for channels that share either a video or audio PID, not both).

Going by SID sounds like a good solution.

@catalinii
Copy link
Owner

Just clarify:
A PMT contains a SID and a list of pids maked as video, audio and others.

A pid cannot be the video pid for 2 channels because it representa just one stream.

if you want to offer access to your channel (via ssh) I can take a look

@surfcu
Copy link
Author

surfcu commented Oct 13, 2024

Just clarify: A PMT contains a SID and a list of pids maked as video, audio and others.

A pid cannot be the video pid for 2 channels because it representa just one stream.

Actually they are broadcasting same content for different packages under different channel names.
And they are using same video and audio pids for different channels for saving bandwidth.

if you want to offer access to your channel (via ssh) I can take a look

I am away for business.
I will arrange it next week for you.

@catalinii
Copy link
Owner

Try the latest binary and add argument -9

@jyrts
Copy link

jyrts commented Nov 2, 2024

for me it did not work... without adding -9 all worked as before... when I added -9 at startup then oscam decoding wont work

@surfcu
Copy link
Author

surfcu commented Nov 2, 2024

It's working without any issues with -9 argument now.

@jyrts
Copy link

jyrts commented Nov 2, 2024

when i start minisatio with -9 then it looks like oscam cant decode the cannel because it is using the wrong ecm pid

@jyrts
Copy link

jyrts commented Nov 2, 2024

minisatip_nok.log
minisatip_ok.log

I add the logs with starting normally and starting with -9

@catalinii
Copy link
Owner

@jyrts the pid that contains the ecm for you is 7301 which is part of pmt pid 312 not 412.

@jyrts
Copy link

jyrts commented Nov 3, 2024

Yes, when I add -9 on startup and change pid 412 to 312 then all working good. Case closed then? :)

@surfcu surfcu closed this as completed Nov 3, 2024
@Jalle19
Copy link
Collaborator

Jalle19 commented Nov 3, 2024

Does it make sense to have this as an option, or should this simply be the default behavior?

@surfcu
Copy link
Author

surfcu commented Nov 3, 2024

What is the downside of delaying pmt scan to process_pat?

@catalinii
Copy link
Owner

Does it make sense to have this as an option, or should this simply be the default behavior?

There are 2 cases where -9 does not work when people use other clients than tvh/vdr:
-pmt pids is wrong
-no pmt pid is specified

@catalinii
Copy link
Owner

What is the downside of delaying pmt scan to process_pat?

This option disables the scan and will read only pmt pids that the client requests

@surfcu
Copy link
Author

surfcu commented Nov 4, 2024

There are 2 cases where -9 does not work when people use other clients than tvh/vdr: -pmt pids is wrong -no pmt pid is specified

According to SATIP specifications media stream object must be fully and correctly defined.

@Jalle19
Copy link
Collaborator

Jalle19 commented Nov 4, 2024

To me it seems reasonable to assume that any client looking to decrypt a channel will send the PMT PID. Are there any clients that don't do that?

@catalinii
Copy link
Owner

People using playlists or anything that does not infer pids based on the list of channels from the satellite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants