Skip to content

Commit ee188e8

Browse files
committed
[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 bb85314 commit ee188e8

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
@@ -276,7 +276,14 @@ bool MediaPlayerPrivateGStreamerMSE::doSeek(const MediaTime& position, float rat
276276
m_player->queueTaskOnEventLoop([weakThis = WeakPtr { *this }, this] {
277277
if (!weakThis)
278278
return;
279+
bool mustPreventPositionReset = m_isWaitingForPreroll && m_isSeeking;
280+
if (mustPreventPositionReset)
281+
m_cachedPosition = currentMediaTime();
279282
didPreroll();
283+
if (mustPreventPositionReset) {
284+
propagateReadyStateToPlayer();
285+
invalidateCachedPosition();
286+
}
280287
});
281288
}
282289
}

0 commit comments

Comments
 (0)