Skip to content

Commit

Permalink
Exiting of pip mode does not render well for for MediaStream videos
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=268750
rdar://122314896

Reviewed by Eric Carlson.

Our listener to bound changes is not useful when hacing the layer in GPUProcess and doing UI side rendering.
It kicks in when entering pip mode, which messes up the rendering computation.
Disable it in that case.

Manually tested.

* Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
* Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::rootLayerBoundsDidChange):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoLayerSizeFenced):

Canonical link: https://commits.webkit.org/276086@main
  • Loading branch information
youennf committed Mar 14, 2024
1 parent 71f803e commit 42ce839
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ class MediaPlayerPrivateMediaStreamAVFObjC final
bool m_waitingForFirstImage { false };
bool m_isActiveVideoTrackEnabled { true };
bool m_hasEnqueuedBlackFrame { false };
bool m_isMediaLayerRehosting { true };

uint64_t m_sampleCount { 0 };
uint64_t m_lastVideoFrameMetadataSampleCount { 0 };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,9 @@ static inline CGAffineTransform videoTransformationMatrix(VideoFrame& videoFrame

void MediaPlayerPrivateMediaStreamAVFObjC::rootLayerBoundsDidChange()
{
if (!m_isMediaLayerRehosting)
return;

Locker locker { m_sampleBufferDisplayLayerLock };
if (m_sampleBufferDisplayLayer)
m_sampleBufferDisplayLayer->updateBoundsAndPosition(m_sampleBufferDisplayLayer->rootLayer().bounds);
Expand Down Expand Up @@ -1198,6 +1201,8 @@ static inline CGAffineTransform videoTransformationMatrix(VideoFrame& videoFrame

void MediaPlayerPrivateMediaStreamAVFObjC::setVideoLayerSizeFenced(const FloatSize& size, WTF::MachSendRight&& fence)
{
m_isMediaLayerRehosting = false;

if (!m_sampleBufferDisplayLayer || size.isEmpty())
return;

Expand Down

0 comments on commit 42ce839

Please sign in to comment.