Skip to content

Commit

Permalink
Revert "fix: audio segment on incorrect timeline HLS (#1539)"
Browse files Browse the repository at this point in the history
This reverts commit e4e0c2d.
  • Loading branch information
wseymour15 authored Sep 11, 2024
1 parent e4e0c2d commit b9f78d8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
26 changes: 14 additions & 12 deletions src/playlist-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -937,25 +937,27 @@ export class PlaylistController extends videojs.EventTarget {
this.onEndOfStream();
});

// There is the possibility of the video segment and the audio segment
// In DASH, there is the possibility of the video segment and the audio segment
// at a current time to be on different timelines. When this occurs, the player
// forwards playback to a point where these two segment types are back on the same
// timeline. This time will be just after the end of the audio segment that is on
// a previous timeline.
this.timelineChangeController_.on('audioTimelineBehind', () => {
const segmentInfo = this.audioSegmentLoader_.pendingSegment_;
if (this.sourceType_ === 'dash') {
this.timelineChangeController_.on('audioTimelineBehind', () => {
const segmentInfo = this.audioSegmentLoader_.pendingSegment_;

if (!segmentInfo || !segmentInfo.segment || !segmentInfo.segment.syncInfo) {
return;
}
if (!segmentInfo || !segmentInfo.segment || !segmentInfo.segment.syncInfo) {
return;
}

// Update the current time to just after the faulty audio segment.
// This moves playback to a spot where both audio and video segments
// are on the same timeline.
const newTime = segmentInfo.segment.syncInfo.end + 0.01;
// Update the current time to just after the faulty audio segment.
// This moves playback to a spot where both audio and video segments
// are on the same timeline.
const newTime = segmentInfo.segment.syncInfo.end + 0.01;

this.tech_.setCurrentTime(newTime);
});
this.tech_.setCurrentTime(newTime);
});
}

this.mainSegmentLoader_.on('earlyabort', (event) => {
// never try to early abort with the new ABR algorithm
Expand Down
3 changes: 2 additions & 1 deletion src/segment-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,8 @@ const checkAndFixTimelines = (segmentLoader) => {
});

if (waitingForTimelineChange && shouldFixBadTimelineChanges(segmentLoader.timelineChangeController_)) {
if (isAudioTimelineBehind(segmentLoader)) {
// Audio being behind should only happen on DASH sources.
if (segmentLoader.sourceType_ === 'dash' && isAudioTimelineBehind(segmentLoader)) {
segmentLoader.timelineChangeController_.trigger('audioTimelineBehind');
return;
}
Expand Down
2 changes: 1 addition & 1 deletion test/segment-loader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1789,7 +1789,7 @@ QUnit.module('SegmentLoader', function(hooks) {
});
});

QUnit.test('triggers event when audio timeline is behind main', function(assert) {
QUnit.test('triggers event when DASH audio timeline is behind main', function(assert) {
loader.dispose();
loader = new SegmentLoader(LoaderCommonSettings.call(this, {
loaderType: 'audio',
Expand Down

0 comments on commit b9f78d8

Please sign in to comment.