Skip to content

Commit f7120b4

Browse files
[GSTMediaPlayer] Make fake preroll asynchronous (#1232)
1) Call didPreroll() also for <video> elements that are audio-only 2) Make didPreroll() call async and put in onto HTML media element task queue to make sure it is executed after dispatching 'seeking' event to JS so app has a chance to note HTMLmedia.seeking attribute is 'true'
1 parent 7f261cd commit f7120b4

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,13 +262,22 @@ bool MediaPlayerPrivateGStreamerMSE::doSeek(const MediaTime& position, float rat
262262

263263
m_mediaSource->seekToTime(m_seekTime);
264264

265-
if (m_player && !m_player->isVideoPlayer() && m_audioSink) {
265+
if (m_player && !hasVideo() && m_audioSink) {
266266
gboolean audioSinkPerformsAsyncStateChanges;
267267
g_object_get(m_audioSink.get(), "async", &audioSinkPerformsAsyncStateChanges, nullptr);
268268
if (!audioSinkPerformsAsyncStateChanges) {
269269
// If audio-only pipeline's sink is not performing async state changes
270270
// we must simulate preroll right away as otherwise nothing will trigger it.
271-
didPreroll();
271+
272+
// Post this on HTML media element queue so it will be executed
273+
// synchonously with media events (e.g. seeking). This will ensure
274+
// that HTML element attributes (like HTMLmedia.seeking) are not reseted
275+
// before app receives "seeking" event
276+
m_player->queueTaskOnEventLoop([weakThis = WeakPtr { *this }, this] {
277+
if (!weakThis)
278+
return;
279+
didPreroll();
280+
});
272281
}
273282
}
274283

0 commit comments

Comments
 (0)