-
Notifications
You must be signed in to change notification settings - Fork 51
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
PSI: parse multiple sections correctly #27
base: master
Are you sure you want to change the base?
Conversation
@@ -241,7 +243,7 @@ func parsePSISectionHeader(i *astikit.BytesIterator) (h *PSISectionHeader, offse | |||
h.PrivateBit = bs[0]&0x40 > 0 | |||
|
|||
// Section length | |||
h.SectionLength = uint16(bs[0]&0xf)<<8 | uint16(bs[1]) | |||
h.SectionLength = uint16(bs[0]&3)<<8 | uint16(bs[1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: I always use this copy of spec: http://www.itu.int/rec/T-REC-H.222.0-201410-S/en
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On page 50 it says the section_length is only 10 bits:
section_length – This is a 12-bit field, the first two bits of which shall be '00'. The remaining 10 bits specify the number of bytes of the section, starting immediately following the section_length field, and including the CRC. The value in this field shall not exceed 1021 (0x3FD).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, I missed that one. Can you please fix this one in muxer as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest I don't quite get why removing || tableID.isUnknown()
would fix your issue here 🤔 Can you explain it a little bit?
data_psi.go
Outdated
@@ -120,6 +120,9 @@ func parsePSIData(i *astikit.BytesIterator) (d *PSIData, err error) { | |||
err = fmt.Errorf("astits: parsing PSI table failed: %w", err) | |||
return | |||
} | |||
if stop { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you just replace this by an else if
?
The issue was that when an unknown table was seen previously, parsing stopped altogether. This means that a known table later in the same packet (such as the program_map) was ignored altogether. |
OK, got it. In that case, I feel like doing the following would better fix the problem and clean everything behind:
What do you think? |
106bbe5
to
0df190a
Compare
cc #25