Skip to content

Commit

Permalink
rework to reset transmuxer on reset everything
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonocasey committed Oct 13, 2021
1 parent 11e7bf8 commit d61559b
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/segment-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,11 @@ export default class SegmentLoader extends videojs.EventTarget {
this.transmuxer_.postMessage({
action: 'clearAllMp4Captions'
});

// reset the cache in the transmuxer
this.transmuxer_.postMessage({
action: 'reset'
});
}
}

Expand Down Expand Up @@ -1516,13 +1521,15 @@ export default class SegmentLoader extends videojs.EventTarget {
segmentInfo.audioAppendStart = audioBufferedEnd - this.sourceUpdater_.audioTimestampOffset();
}

segmentInfo.gopsToAlignWith = gopsSafeToAlignWith(
this.gopBuffer_,
// since the transmuxer is using the actual timing values, but the time is
// adjusted by the timestmap offset, we must adjust the value here
this.currentTime_() - this.sourceUpdater_.videoTimestampOffset(),
this.timeMapping_
);
if (this.sourceUpdater_.videoBuffered().length) {
segmentInfo.gopsToAlignWith = gopsSafeToAlignWith(
this.gopBuffer_,
// since the transmuxer is using the actual timing values, but the time is
// adjusted by the timestmap offset, we must adjust the value here
this.currentTime_() - this.sourceUpdater_.videoTimestampOffset(),
this.timeMapping_
);
}

return segmentInfo;
}
Expand Down

0 comments on commit d61559b

Please sign in to comment.