⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 290874 in webkit


Ignore:
Timestamp:
Mar 6, 2022, 9:28:26 AM (5 years ago)
Author:
eric.carlson@apple.com
Message:

Push HTMLMediaElement renderer's contentBox rect to GPU process
​https://bugs.webkit.org/show_bug.cgi?id=237444
rdar://84869202

Reviewed by Jer Noble.

Source/WebCore:

No new tests. This is a speculative fix, with new logging, for an issue I haven't
been able to reproduce.

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::updateRenderer): Push mediaPlayerContentBoxRect to the
media player.

  • platform/graphics/MediaPlayer.cpp:

(WebCore::MediaPlayer::playerContentBoxRectChanged): Pass rect to platform player.

  • platform/graphics/MediaPlayer.h:
  • platform/graphics/MediaPlayerPrivate.h:

(WebCore::MediaPlayerPrivateInterface::playerContentBoxRectChanged):

Source/WebKit:

  • GPUProcess/media/RemoteMediaPlayerProxy.cpp:

(WebKit::RemoteMediaPlayerProxy::RemoteMediaPlayerProxy): Configuration now has
playerContentBoxRect.
(WebKit::RemoteMediaPlayerProxy::mediaPlayerContentBoxRect const):
(WebKit::RemoteMediaPlayerProxy::playerContentBoxRectChanged): Update playerContentBoxRect.

  • GPUProcess/media/RemoteMediaPlayerProxy.h:
  • GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
  • GPUProcess/media/RemoteMediaPlayerProxyConfiguration.h:

(WebKit::RemoteMediaPlayerProxyConfiguration::encode const):
(WebKit::RemoteMediaPlayerProxyConfiguration::decode):

  • GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm:

(WebKit::RemoteMediaPlayerProxy::setVideoInlineSizeIfPossible): Convert from static
function so we can log.
(WebKit::RemoteMediaPlayerProxy::mediaPlayerFirstVideoFrameAvailable): Add logging.
(WebKit::RemoteMediaPlayerProxy::mediaPlayerRenderingModeChanged): Ditto.
(WebKit::RemoteMediaPlayerProxy::setVideoInlineSizeFenced): Ditto.
(WebKit::setVideoInlineSizeIfPossible): Deleted.

  • WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:

(WebKit::MediaPlayerPrivateRemote::playerContentBoxRectChanged):

  • WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
  • WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:

(WebKit::RemoteMediaPlayerManager::createRemoteMediaPlayer):

Location:
trunk/Source
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r290872 r290874  
     12022-03-06  Eric Carlson  <eric.carlson@apple.com>
     2
     3        Push HTMLMediaElement renderer's contentBox rect to GPU process
     4        https://bugs.webkit.org/show_bug.cgi?id=237444
     5        rdar://84869202
     6
     7        Reviewed by Jer Noble.
     8
     9        No new tests. This is a speculative fix, with new logging, for an issue I haven't
     10        been able to reproduce.
     11
     12        * html/HTMLMediaElement.cpp:
     13        (WebCore::HTMLMediaElement::updateRenderer): Push mediaPlayerContentBoxRect to the
     14        media player.
     15        * platform/graphics/MediaPlayer.cpp:
     16        (WebCore::MediaPlayer::playerContentBoxRectChanged): Pass rect to platform player.
     17        * platform/graphics/MediaPlayer.h:
     18        * platform/graphics/MediaPlayerPrivate.h:
     19        (WebCore::MediaPlayerPrivateInterface::playerContentBoxRectChanged):
     20
    1212022-03-05  Simon Fraser  <simon.fraser@apple.com>
    222
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r290778 r290874  
    895895    if (m_mediaControlsHost)
    896896        m_mediaControlsHost->updateCaptionDisplaySizes();
     897
     898    if (m_player)
     899        m_player->playerContentBoxRectChanged(mediaPlayerContentBoxRect());
    897900}
    898901
  • trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp

    r290470 r290874  
    17791779}
    17801780
     1781void MediaPlayer::playerContentBoxRectChanged(const LayoutRect& rect)
     1782{
     1783    m_private->playerContentBoxRectChanged(rect);
     1784}
     1785
    17811786#if PLATFORM(COCOA)
    17821787void MediaPlayer::onNewVideoFrameMetadata(VideoFrameMetadata&& metadata, RetainPtr<CVPixelBufferRef>&& buffer)
  • trunk/Source/WebCore/platform/graphics/MediaPlayer.h

    r290470 r290874  
    696696    void stopVideoFrameMetadataGathering();
    697697
     698    void playerContentBoxRectChanged(const LayoutRect&);
     699
    698700private:
    699701    MediaPlayer(MediaPlayerClient&);
  • trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h

    r290590 r290874  
    327327    virtual void stopVideoFrameMetadataGathering() { }
    328328
     329    virtual void playerContentBoxRectChanged(const LayoutRect&) { }
     330
    329331    virtual void setResourceOwner(const ProcessIdentity&) { }
    330332};
  • trunk/Source/WebKit/ChangeLog

    r290863 r290874  
     12022-03-06  Eric Carlson  <eric.carlson@apple.com>
     2
     3        Push HTMLMediaElement renderer's contentBox rect to GPU process
     4        https://bugs.webkit.org/show_bug.cgi?id=237444
     5        rdar://84869202
     6
     7        Reviewed by Jer Noble.
     8
     9        * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
     10        (WebKit::RemoteMediaPlayerProxy::RemoteMediaPlayerProxy): Configuration now has
     11        playerContentBoxRect.
     12        (WebKit::RemoteMediaPlayerProxy::mediaPlayerContentBoxRect const):
     13        (WebKit::RemoteMediaPlayerProxy::playerContentBoxRectChanged): Update playerContentBoxRect.
     14        * GPUProcess/media/RemoteMediaPlayerProxy.h:
     15        * GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
     16
     17        * GPUProcess/media/RemoteMediaPlayerProxyConfiguration.h:
     18        (WebKit::RemoteMediaPlayerProxyConfiguration::encode const):
     19        (WebKit::RemoteMediaPlayerProxyConfiguration::decode):
     20
     21        * GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm:
     22        (WebKit::RemoteMediaPlayerProxy::setVideoInlineSizeIfPossible): Convert from static
     23        function so we can log.
     24        (WebKit::RemoteMediaPlayerProxy::mediaPlayerFirstVideoFrameAvailable): Add logging.
     25        (WebKit::RemoteMediaPlayerProxy::mediaPlayerRenderingModeChanged): Ditto.
     26        (WebKit::RemoteMediaPlayerProxy::setVideoInlineSizeFenced): Ditto.
     27        (WebKit::setVideoInlineSizeIfPossible): Deleted.
     28
     29        * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
     30        (WebKit::MediaPlayerPrivateRemote::playerContentBoxRectChanged):
     31        * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
     32
     33        * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
     34        (WebKit::RemoteMediaPlayerManager::createRemoteMediaPlayer):
     35
    1362022-03-04  Sihui Liu  <sihui_liu@apple.com>
    237
  • trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp

    r290590 r290874  
    9292    m_typesRequiringHardwareSupport = m_configuration.mediaContentTypesRequiringHardwareSupport;
    9393    m_renderingCanBeAccelerated = m_configuration.renderingCanBeAccelerated;
     94    m_playerContentBoxRect = m_configuration.playerContentBoxRect;
    9495    m_player = MediaPlayer::create(*this, m_engineIdentifier);
    9596    if (auto* playerPrivate = m_player->playerPrivate())
    … …  
    479480}
    480481
     482LayoutRect RemoteMediaPlayerProxy::mediaPlayerContentBoxRect() const
     483{
     484    return m_playerContentBoxRect;
     485}
     486
    481487const Vector<WebCore::ContentType>& RemoteMediaPlayerProxy::mediaContentTypesRequiringHardwareSupport() const
    482488{
    … …  
    11301136}
    11311137
     1138void RemoteMediaPlayerProxy::playerContentBoxRectChanged(const WebCore::LayoutRect& contentRect)
     1139{
     1140    m_playerContentBoxRect = contentRect;
     1141}
     1142
    11321143#if !RELEASE_LOG_DISABLED
    11331144WTFLogChannel& RemoteMediaPlayerProxy::logChannel() const
  • trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h

    r290590 r290874  
    279279    bool mediaPlayerShouldUsePersistentCache() const final;
    280280    const String& mediaPlayerMediaCacheDirectory() const final;
     281    WebCore::LayoutRect mediaPlayerContentBoxRect() const final;
    281282
    282283    void textTrackRepresentationBoundsChanged(const WebCore::IntRect&) final;
    … …  
    330331#endif
    331332
     333    void playerContentBoxRectChanged(const WebCore::LayoutRect&);
     334
    332335    bool mediaPlayerPausedOrStalled() const;
    333336    void currentTimeChanged(const MediaTime&);
    334337
    335338#if PLATFORM(COCOA)
     339    void setVideoInlineSizeIfPossible(const WebCore::FloatSize&);
    336340    void nativeImageForCurrentTime(CompletionHandler<void(std::optional<WTF::MachSendRight>&&, WebCore::DestinationColorSpace)>&&);
    337341    void colorSpace(CompletionHandler<void(WebCore::DestinationColorSpace)>&&);
    … …  
    376380    WebCore::FloatSize m_videoInlineSize;
    377381    float m_videoContentScale { 1.0 };
     382    WebCore::LayoutRect m_playerContentBoxRect;
    378383
    379384    bool m_bufferedChanged { true };
  • trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.messages.in

    r290175 r290874  
    134134    StartVideoFrameMetadataGathering()
    135135    StopVideoFrameMetadataGathering()
     136
     137    PlayerContentBoxRectChanged(WebCore::LayoutRect contentRect)
    136138}
    137139
  • trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxyConfiguration.h

    r289697 r290874  
    3030#include <WebCore/ContentType.h>
    3131#include <WebCore/FourCC.h>
     32#include <WebCore/LayoutRect.h>
    3233#include <WebCore/PlatformTextTrack.h>
    3334#include <WebCore/SecurityOriginData.h>
    … …  
    4748    std::optional<Vector<WebCore::FourCC>> allowedMediaAudioCodecIDs;
    4849    std::optional<Vector<WebCore::FourCC>> allowedMediaCaptionFormatTypes;
    49 
     50    WebCore::LayoutRect playerContentBoxRect;
    5051    Vector<String> preferredAudioCharacteristics;
    5152#if ENABLE(AVF_CAPTIONS)
    … …  
    7172        encoder << allowedMediaAudioCodecIDs;
    7273        encoder << allowedMediaCaptionFormatTypes;
     74        encoder << playerContentBoxRect;
    7375        encoder << preferredAudioCharacteristics;
    7476#if ENABLE(AVF_CAPTIONS)
    … …  
    9597            && decoder.decode(configuration.allowedMediaAudioCodecIDs)
    9698            && decoder.decode(configuration.allowedMediaCaptionFormatTypes)
     99            && decoder.decode(configuration.playerContentBoxRect)
    97100            && decoder.decode(configuration.preferredAudioCharacteristics)
    98101#if ENABLE(AVF_CAPTIONS)
  • trunk/Source/WebKit/GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm

    r288315 r290874  
    3939namespace WebKit {
    4040
    41 static void setVideoInlineSizeIfPossible(LayerHostingContext& context, const WebCore::FloatSize& size)
     41void RemoteMediaPlayerProxy::setVideoInlineSizeIfPossible(const WebCore::FloatSize& size)
    4242{
    43     if (!context.rootLayer() || size.isEmpty())
     43    if (!m_inlineLayerHostingContext->rootLayer() || size.isEmpty())
    4444        return;
     45
     46    ALWAYS_LOG(LOGIDENTIFIER, size.width(), "x", size.height());
    4547
    4648    // We do not want animations here.
    4749    [CATransaction begin];
    4850    [CATransaction setDisableActions:YES];
    49     [context.rootLayer() setFrame:CGRectMake(0, 0, size.width(), size.height())];
     51    [m_inlineLayerHostingContext->rootLayer() setFrame:CGRectMake(0, 0, size.width(), size.height())];
    5052    [CATransaction commit];
    5153}
    … …  
    6769void RemoteMediaPlayerProxy::mediaPlayerFirstVideoFrameAvailable()
    6870{
    69     // Initially the size of the platformLayer may be 0x0 because we do not provide mediaPlayerContentBoxRect() in this class.
    70     setVideoInlineSizeIfPossible(*m_inlineLayerHostingContext, m_videoInlineSize);
     71    ALWAYS_LOG(LOGIDENTIFIER);
     72    setVideoInlineSizeIfPossible(m_videoInlineSize);
    7173    m_webProcessConnection->send(Messages::MediaPlayerPrivateRemote::FirstVideoFrameAvailable(), m_id);
    7274}
    … …  
    7476void RemoteMediaPlayerProxy::mediaPlayerRenderingModeChanged()
    7577{
     78    ALWAYS_LOG(LOGIDENTIFIER);
    7679    m_inlineLayerHostingContext->setRootLayer(m_player->platformLayer());
    7780    m_webProcessConnection->send(Messages::MediaPlayerPrivateRemote::RenderingModeChanged(), m_id);
    … …  
    7982void RemoteMediaPlayerProxy::setVideoInlineSizeFenced(const WebCore::FloatSize& size, const WTF::MachSendRight& machSendRight)
    8083{
     84    ALWAYS_LOG(LOGIDENTIFIER, size.width(), "x", size.height());
    8185    m_inlineLayerHostingContext->setFencePort(machSendRight.sendRight());
    8286
    8387    m_videoInlineSize = size;
    84     setVideoInlineSizeIfPossible(*m_inlineLayerHostingContext, size);
     88    setVideoInlineSizeIfPossible(size);
    8589}
    8690
  • trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp

    r290676 r290874  
    14171417}
    14181418
     1419void MediaPlayerPrivateRemote::playerContentBoxRectChanged(const LayoutRect& contentRect)
     1420{
     1421    connection().send(Messages::RemoteMediaPlayerProxy::PlayerContentBoxRectChanged(contentRect), m_id);
     1422}
     1423
    14191424void MediaPlayerPrivateRemote::requestResource(RemoteMediaResourceIdentifier remoteMediaResourceIdentifier, WebCore::ResourceRequest&& request, WebCore::PlatformMediaResourceLoader::LoadOptions options, CompletionHandler<void()>&& completionHandler)
    14201425{
  • trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h

    r290470 r290874  
    413413    void stopVideoFrameMetadataGathering() final;
    414414
     415    void playerContentBoxRectChanged(const WebCore::LayoutRect&) final;
     416
    415417#if PLATFORM(COCOA)
    416418    void pushVideoFrameMetadata(WebCore::VideoFrameMetadata&&, RetainPtr<CVPixelBufferRef>&&);
  • trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.cpp

    r290329 r290874  
    174174    proxyConfiguration.allowedMediaAudioCodecIDs = player->allowedMediaAudioCodecIDs();
    175175    proxyConfiguration.allowedMediaCaptionFormatTypes = player->allowedMediaCaptionFormatTypes();
     176    proxyConfiguration.playerContentBoxRect = player->playerContentBoxRect();
    176177
    177178    auto identifier = MediaPlayerIdentifier::generate();
Note: See TracChangeset for help on using the changeset viewer.