Fix M2TS probing when PAT packet is not found in first three packets #5252
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR will...
Fix MPEG2-TS probing when PAT packet is not found in the first three packets.
Why is this Pull Request needed?
Sometimes HLS assets with segmented M2TS streams have segments that do not begin with PAT and PMT packets. Despite this not being spec compliant it is widely supported. Recent changes to TS probing in v1.3 broke support for segments like this (#5251).
Are there any points in the code the reviewer needs to double check?
As long as we find a sync byte and every following 188 byte packet starts with the same sync byte, keep looking for the PAT packet before passing the probe test. TS segments without a PAT (and no MAP in the Playlist to provide it) are not usable. It's worth noting that HLS.js does not support M2TS MAP init segments or implicit init segments when byteranges are used, but this is only commonly found in I-FRAME Playlists which also remain unsupported.
Resolves issues:
Fixes regression in #5251
Checklist