Skip to content

wpe2.38 [GSTMediaPlayer] Make fake preroll asynchronous #1232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

asurdej-comcast
Copy link

@asurdej-comcast asurdej-comcast commented Nov 14, 2023

  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'

With previous implementation the whole seek flow as executed in a single main loop cycle. As a result JS app had no chance to spot that video.seeking attribute is ever set to true. Also some apps listen to video.onseeking and expects that video.seeking attr will be true in such case that was not valid assumption.

This change fixes Spotify audio only playback seeking to buffered range on Amlogic platform that doesn't have async state changes in audio sync

The test case is to simply seek MSE audio only plaback to buffered range on proper platform and check if video.seeking attribute is ever "true"

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'
@emutavchi emutavchi requested a review from modeveci November 14, 2023 15:42
@modeveci modeveci requested a review from eocanha November 15, 2023 12:00
@eocanha
Copy link
Member

eocanha commented Dec 29, 2023

I couldn't reproduce the issue with a video (video only, no audio) on wpe-2.38 on RPI3 (video.seeking is true when onSeeking is called). Reproduced the issue with an audio-only video (video.seeking is false). I couldn't reproduce the issue upstream (video.seeking is true), so this patch is only relevant downstream and the fix upstream is part of the code to support GPUprocess (doesn't make sense to backport it to wpe-2.38). I could reproduce the issue in wpe-2.42, but branch https://github.com/WebPlatformForEmbedded/WPEWebKit/tree/calvaris/wpe-2.42/upstream, from #1266, has the upstream code that would fix the issue, so better not to port the commit there. Only if that code isn't finally merged we would need to port the patch of this PR #1232 there.

Approving and merging this PR.

@eocanha eocanha merged commit f7120b4 into WebPlatformForEmbedded:wpe-2.38 Dec 29, 2023
emutavchi pushed a commit to emutavchi/WebKitForWayland that referenced this pull request Jun 27, 2025
…ed#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'
eocanha added a commit to eocanha/WebKit that referenced this pull request Jul 1, 2025
https://bugs.webkit.org/show_bug.cgi?id=295289

Reviewed by NOBODY (OOPS!).

With the current implementation the whole seek flow as executed in a single main loop cycle. As a result, the JS app had no chance to spot that video.seeking attribute is ever set to true. Also some apps listen to video.onseeking and expects that video.seeking attribute to be true in such case. That wasn't a valid assumption.

Also, the behaviour isn't the same in <video> elements that are audio-only as in <audio> elements.

This happens on the Amlogic platform, that doesn't have asynchronous state changes on its audio sink. Spotify is broken there because of this problem.

See:
WebPlatformForEmbedded/WPEWebKit#1232
WebPlatformForEmbedded/WPEWebKit#1527

This patch calls didPreroll() also for <video> elements that are audio-only. Also makes that call async by putting it on the HTML media element task queue to make sure it is executed after dispatching 'seeking' event to JS so the
app has a chance to notice that HTMLmedia.seeking attribute is 'true'.

Original author: Andrzej Surdej <[email protected]>

* Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::doSeek): Call didPreroll() asynchronously for any media element having only audio.
eocanha added a commit to eocanha/WebKit that referenced this pull request Jul 3, 2025
https://bugs.webkit.org/show_bug.cgi?id=295289

Reviewed by NOBODY (OOPS!).

With the current implementation the whole seek flow as executed in a single main loop cycle. As a result, the JS app had no chance to spot that video.seeking attribute is ever set to true. Also some apps listen to video.onseeking and expects that video.seeking attribute to be true in such case. That wasn't a valid assumption.

Also, the behaviour isn't the same in <video> elements that are audio-only as in <audio> elements.

This happens on the Amlogic platform, that doesn't have asynchronous state changes on its audio sink. Spotify is broken there because of this problem.

See:
WebPlatformForEmbedded/WPEWebKit#1232
WebPlatformForEmbedded/WPEWebKit#1527

This patch calls didPreroll() also for <video> elements that are audio-only. Also makes that call async by putting it on the HTML media element task queue to make sure it is executed after dispatching 'seeking' event to JS so the
app has a chance to notice that HTMLmedia.seeking attribute is 'true'.

Original author: Andrzej Surdej <[email protected]>

* Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::doSeek): Find the actual final audio sink. Call didPreroll() asynchronously for any media element having only audio.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

4 participants