[webkit-changes] [WebKit/WebKit] c0a2b3: <audio> and <video> loadeddata events not fired on...

Jean-Yves Avenard noreply at github.com
Tue Mar 12 14:42:00 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c0a2b3040d2d0424bd082eafba7f3922fe7641f0
      https://github.com/WebKit/WebKit/commit/c0a2b3040d2d0424bd082eafba7f3922fe7641f0
  Author: Jean-Yves Avenard <jya at apple.com>
  Date:   2024-03-12 (Tue, 12 Mar 2024)

  Changed paths:
    A LayoutTests/http/tests/media/audio-load-loadeddata-expected.txt
    A LayoutTests/http/tests/media/audio-load-loadeddata.html
    M LayoutTests/platform/ios/TestExpectations
    M Source/WebCore/platform/graphics/MediaPlayer.cpp
    M Source/WebCore/platform/graphics/MediaPlayer.h
    M Source/WebCore/platform/graphics/MediaPlayerPrivate.h
    M Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp
    M Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h
    M Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.messages.in
    M Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp
    M Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h

  Log Message:
  -----------
  <audio> and <video> loadeddata events not fired on page load
https://bugs.webkit.org/show_bug.cgi?id=270837
rdar://124079735

Reviewed by Eric Carlson.

The HTMLMediaElement would call MediaPlayer::prepareToPlay() on the first MediaPlayerPrivate
created which may not be the one we end up using.
The code assumed that as soon as a MediaPlayer was created, we could call prepareToPlay on
it which in the case of the MediaPlayerPrivateAVFobjC would start loading the content.
Since we enabled the WebM player, the assumption no longer applied, multiple players could
be used until we find one that can play the content.
If the GPU process was enabled, the behaviour was racy as the GPUP's MediaPlayer
may not have been created yet.

The site would set a HTMLMediaElement's source to a mp3 file, without using an explicit
extension nor having the server provide the mime-type. As such, we have to try in
succession all MediaPlayerPrivate until we can find one that can load the content.
We cache the call to prepareToPlay() and re-issue it on all new MediaPlayerPrivate once
created.

Added test.

* LayoutTests/http/tests/media/audio-load-loadeddata-expected.txt: Added.
* LayoutTests/http/tests/media/audio-load-loadeddata.html: Added.
* LayoutTests/platform/ios/TestExpectations: All media tests are disabled on iOS, force this one to run.
* Source/WebCore/platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::loadWithNextMediaEngine):
(WebCore::MediaPlayer::prepareToPlay):
* Source/WebCore/platform/graphics/MediaPlayer.h:
* Source/WebCore/platform/graphics/MediaPlayerPrivate.h:
(WebCore::MediaPlayerPrivateInterface::prepareForPlayback):
* Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::prepareForPlayback):
* Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h:
* Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
* Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::prepareForPlayback):
* Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h:

Canonical link: https://commits.webkit.org/275997@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list