From cbbb704c08ce5a71a65478d2b37df27f6193870f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Velad=20Galv=C3=A1n?= Date: Thu, 11 Apr 2024 08:24:33 +0200 Subject: [PATCH] revert: Fix potential AV sync issues after seek or adaptation (#6435) This reverts #4886, which was found to cause issues with fetching segments after seeking. Closes #5785 Re-open #4589 --- lib/media/streaming_engine.js | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/lib/media/streaming_engine.js b/lib/media/streaming_engine.js index 0ccc552ae4..8289ce6ef0 100644 --- a/lib/media/streaming_engine.js +++ b/lib/media/streaming_engine.js @@ -881,7 +881,6 @@ shaka.media.StreamingEngine = class { // The playhead might be seeking on startup, if a start time is set, so // start "seeked" as true. seeked: true, - needsResync: false, recovering: false, hasError: false, operation: null, @@ -1248,11 +1247,6 @@ shaka.media.StreamingEngine = class { shaka.log.v1( logPrefix, 'looking up segment from new stream endTime:', time); - // Using a new iterator means we need to resync the stream in sequence - // mode. The buffered range might not align perfectly with the last - // segment end time, so we may end up repeating a segment. Resyncing - // makes this safe to do. - mediaState.needsResync = true; mediaState.segmentIterator = mediaState.stream.segmentIndex.getIteratorForTime(time); const ref = mediaState.segmentIterator && @@ -1879,9 +1873,7 @@ shaka.media.StreamingEngine = class { // Across discontinuity bounds, we should resync timestamps for // sequence mode playbacks. The next segment appended should // land at its theoretical timestamp from the segment index. - if (reference.discontinuitySequence != lastDiscontinuitySequence || - mediaState.needsResync) { - mediaState.needsResync = false; + if (reference.discontinuitySequence != lastDiscontinuitySequence) { operations.push(this.playerInterface_.mediaSourceEngine.resync( mediaState.type, reference.startTime)); } @@ -2591,7 +2583,6 @@ shaka.media.StreamingEngine.PlayerInterface; * clearBufferSafeMargin: number, * clearingBuffer: boolean, * seeked: boolean, - * needsResync: boolean, * adaptation: boolean, * recovering: boolean, * hasError: boolean, @@ -2646,9 +2637,6 @@ shaka.media.StreamingEngine.PlayerInterface; * True indicates that the presentation just seeked. * @property {boolean} adaptation * True indicates that the presentation just automatically switched variants. - * @property {boolean} needsResync - * True indicates that the stream needs to be resynced in sequence mode, - * regardless of discontinuity sequence. * @property {boolean} recovering * True indicates that the last segment was not appended because it could not * fit in the buffer.