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

fix: ignore non-pes packets in the rollover stream #440

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions lib/m2ts/timestamp-rollover-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ var TimestampRolloverStream = function(type) {
this.type_ = type || TYPE_SHARED;

this.push = function(data) {
/**
* Rollover stream expects data from elementary stream.
* Elementary stream can push forward 2 types of data
* - Parsed Video/Audio/Timed-metadata PES (packetized elementary stream) packets
* - Tracks metadata from PMT (Program Map Table)
* Rollover stream expects pts/dts info to be available, since it stores lastDTS
* We should ignore non-PES packets since they may override lastDTS to undefined.
* lastDTS is important to signal the next segments
* about rollover from the previous segments.
*/
if (data.type === 'metadata') {
this.trigger('data', data);
return;
}

// Any "shared" rollover streams will accept _all_ data. Otherwise,
// streams will only accept data that matches their type.
Expand Down