Skip to content

Commit

Permalink
fix: Allow PID change in TsParser (#5681)
Browse files Browse the repository at this point in the history
This is necessary because some Live streams change audio or video PID
when there are ads.
  • Loading branch information
avelad authored and joeyparrish committed Oct 4, 2023
1 parent 88a8035 commit ac8bb85
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/util/ts_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ shaka.util.TsParser = class {
// for example
// NOTE this is only the PID of the track as found in TS,
// but we are not using this for MP4 track IDs.
if (this.videoPid_ == null) {
if (parsedPIDs.video != -1) {
this.videoPid_ = parsedPIDs.video;
this.videoCodec_ = parsedPIDs.videoCodec;
}
if (this.audioPid_ == null) {
if (parsedPIDs.audio != -1) {
this.audioPid_ = parsedPIDs.audio;
this.audioCodec_ = parsedPIDs.audioCodec;
}
if (this.id3Pid_ == null) {
if (parsedPIDs.id3 != -1) {
this.id3Pid_ = parsedPIDs.id3;
}

Expand Down
2 changes: 1 addition & 1 deletion test/util/ts_parser_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ describe('TsParser', () => {
const codecs = new shaka.util.TsParser().parse(tsSegment)
.getCodecs();
expect(codecs.audio).toBe('aac');
expect(codecs.video).toBe('');
expect(codecs.video).toBe(null);
});
});

0 comments on commit ac8bb85

Please sign in to comment.