Skip to content

Commit

Permalink
fix: Ignore non-PES packets in the rollover stream (#440)
Browse files Browse the repository at this point in the history
Co-authored-by: Dzianis Dashkevich <ddashkevich@brightcove.com>
  • Loading branch information
dzianis-dashkevich and Dzianis Dashkevich committed Nov 27, 2023
1 parent 0b0e5a9 commit 2015be8
Showing 1 changed file with 14 additions and 0 deletions.
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

0 comments on commit 2015be8

Please sign in to comment.