Skip to content

Commit 575c59b

Browse files
eocanhacalvaris
authored andcommitted
[MSE][GStreamer] Prevent currentTime reset on preroll when audio sink is non-async
https://bugs.webkit.org/show_bug.cgi?id=269587 Reviewed by Xabier Rodriguez-Calvar. When doing an initial seek (during preroll) on an MSE content that is audio-only on platforms whose audio sink is not asynchronous (eg: on Broadcom Nexus devices), the manually triggered preroll introduced by https://commits.webkit.org/268845@main causes an invalidation of the currentTime cached position. This causes a temporary currentTime 0 value that creates a drop to HaveMetadata in the MediaSource readyState, causing a number of problems. See: #1211 This patch remembers seek position as a cached value on an initial seek during preroll when the audio sink can't perform asynchronous state changes. Based on a patch by Jacek Skiba <jacek.skiba@consult.red> * Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: (WebCore::MediaPlayerPrivateGStreamerMSE::doSeek): Cache the previous position (the seek position) before the manual preroll and then immediately propagate the readyState to the player and invalidate the cached position after the preroll, so the new position is the one resulting from the preroll to the seek target position. Canonical link: https://commits.webkit.org/274971@main
1 parent b347fee commit 575c59b

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,14 @@ bool MediaPlayerPrivateGStreamerMSE::doSeek(const SeekTarget& target, float rate
211211
if (!audioSinkPerformsAsyncStateChanges) {
212212
// If audio-only pipeline's sink is not performing async state changes
213213
// we must simulate preroll right away as otherwise nothing will trigger it.
214+
bool mustPreventPositionReset = m_isWaitingForPreroll && m_isSeeking;
215+
if (mustPreventPositionReset)
216+
m_cachedPosition = currentTime();
214217
didPreroll();
218+
if (mustPreventPositionReset) {
219+
propagateReadyStateToPlayer();
220+
invalidateCachedPosition();
221+
}
215222
}
216223
}
217224
});

0 commit comments

Comments
 (0)