-
Notifications
You must be signed in to change notification settings - Fork 50
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?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 { | ||
break | ||
} | ||
d.Sections = append(d.Sections, s) | ||
} | ||
return | ||
|
@@ -199,8 +202,7 @@ func parseCRC32(i *astikit.BytesIterator) (c uint32, err error) { | |
|
||
// shouldStopPSIParsing checks whether the PSI parsing should be stopped | ||
func shouldStopPSIParsing(tableID PSITableID) bool { | ||
return tableID == PSITableIDNull || | ||
tableID.isUnknown() | ||
return tableID == PSITableIDNull | ||
} | ||
|
||
// parsePSISectionHeader parses a PSI section header | ||
|
@@ -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 commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. On page 50 it says the section_length is only 10 bits:
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? |
||
|
||
// Offsets | ||
offsetSectionsStart = i.Offset() | ||
|
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
?