<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[285517] branches/safari-612-branch/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/285517">285517</a></dd>
<dt>Author</dt> <dd>alancoon@apple.com</dd>
<dt>Date</dt> <dd>2021-11-09 11:42:03 -0800 (Tue, 09 Nov 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>Apply patch. rdar://problem/83419159</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari612branchSourceWebCoreChangeLog">branches/safari-612-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari612branchSourceWebCoreplatformgraphicsavfoundationMediaPlayerPrivateAVFoundationcpp">branches/safari-612-branch/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp</a></li>
<li><a href="#branchessafari612branchSourceWebCoreplatformgraphicsavfoundationMediaPlayerPrivateAVFoundationh">branches/safari-612-branch/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h</a></li>
<li><a href="#branchessafari612branchSourceWebCoreplatformgraphicsavfoundationcfMediaPlayerPrivateAVFoundationCFcpp">branches/safari-612-branch/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp</a></li>
<li><a href="#branchessafari612branchSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateAVFoundationObjCh">branches/safari-612-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h</a></li>
<li><a href="#branchessafari612branchSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateAVFoundationObjCmm">branches/safari-612-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari612branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (285516 => 285517)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/ChangeLog      2021-11-09 19:41:58 UTC (rev 285516)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog 2021-11-09 19:42:03 UTC (rev 285517)
</span><span class="lines">@@ -1,50 +1,54 @@
</span><del>-2021-11-08  Kocsen Chung  <kocsen_chung@apple.com>
</del><ins>+2021-11-09  Alan Coon  <alancoon@apple.com>
</ins><span class="cx"> 
</span><del>-        Cherry-pick r285333. rdar://problem/83576009
</del><ins>+        Apply patch. rdar://problem/83419159
</ins><span class="cx"> 
</span><del>-    Avoid sending video data to Web process for canvas.drawImage(video)
-    https://bugs.webkit.org/show_bug.cgi?id=230766
-    <rdar://problem/83576009>
-    
-    Reviewed by Simon Fraser.
-    
-    Using nativeImageForCurrentTime() to get the image to paint on to the
-    canvas results in a ShareableBitmap being created to send to the
-    Web process, the identifier for which we then send back to the GPU
-    process for the drawImage() call. But if we use
-    paintCurrentFrameInContext(), this uses the PaintFrameForMedia
-    message, which just sends the MediaPlayer ID and avoids the bitmap
-    creation.
-    
-    * html/canvas/CanvasRenderingContext2DBase.cpp:
-    (WebCore::CanvasRenderingContext2DBase::drawImage):
-    * platform/graphics/ImageBuffer.h:
-    (WebCore::ImageBuffer::isRemote const):
-    
-    
-    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285333 268f45cc-cd09-0410-ab3c-d52691b4dbfc
</del><ins>+    2021-11-08  Kocsen Chung  <kocsen_chung@apple.com>
</ins><span class="cx"> 
</span><del>-    2021-11-04  Cameron McCormack  <heycam@apple.com>
</del><ins>+            Cherry-pick r285333. rdar://problem/83576009
</ins><span class="cx"> 
</span><del>-            Avoid sending video data to Web process for canvas.drawImage(video)
-            https://bugs.webkit.org/show_bug.cgi?id=230766
-            <rdar://problem/83576009>
</del><ins>+        Avoid sending video data to Web process for canvas.drawImage(video)
+        https://bugs.webkit.org/show_bug.cgi?id=230766
+        <rdar://problem/83576009>
</ins><span class="cx"> 
</span><del>-            Reviewed by Simon Fraser.
</del><ins>+        Reviewed by Simon Fraser.
</ins><span class="cx"> 
</span><del>-            Using nativeImageForCurrentTime() to get the image to paint on to the
-            canvas results in a ShareableBitmap being created to send to the
-            Web process, the identifier for which we then send back to the GPU
-            process for the drawImage() call. But if we use
-            paintCurrentFrameInContext(), this uses the PaintFrameForMedia
-            message, which just sends the MediaPlayer ID and avoids the bitmap
-            creation.
</del><ins>+        Using nativeImageForCurrentTime() to get the image to paint on to the
+        canvas results in a ShareableBitmap being created to send to the
+        Web process, the identifier for which we then send back to the GPU
+        process for the drawImage() call. But if we use
+        paintCurrentFrameInContext(), this uses the PaintFrameForMedia
+        message, which just sends the MediaPlayer ID and avoids the bitmap
+        creation.
</ins><span class="cx"> 
</span><del>-            * html/canvas/CanvasRenderingContext2DBase.cpp:
-            (WebCore::CanvasRenderingContext2DBase::drawImage):
-            * platform/graphics/ImageBuffer.h:
-            (WebCore::ImageBuffer::isRemote const):
</del><ins>+        * html/canvas/CanvasRenderingContext2DBase.cpp:
+        (WebCore::CanvasRenderingContext2DBase::drawImage):
+        * platform/graphics/ImageBuffer.h:
+        (WebCore::ImageBuffer::isRemote const):
</ins><span class="cx"> 
</span><ins>+
+        git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285333 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+        2021-11-04  Cameron McCormack  <heycam@apple.com>
+
+                Avoid sending video data to Web process for canvas.drawImage(video)
+                https://bugs.webkit.org/show_bug.cgi?id=230766
+                <rdar://problem/83576009>
+
+                Reviewed by Simon Fraser.
+
+                Using nativeImageForCurrentTime() to get the image to paint on to the
+                canvas results in a ShareableBitmap being created to send to the
+                Web process, the identifier for which we then send back to the GPU
+                process for the drawImage() call. But if we use
+                paintCurrentFrameInContext(), this uses the PaintFrameForMedia
+                message, which just sends the MediaPlayer ID and avoids the bitmap
+                creation.
+
+                * html/canvas/CanvasRenderingContext2DBase.cpp:
+                (WebCore::CanvasRenderingContext2DBase::drawImage):
+                * platform/graphics/ImageBuffer.h:
+                (WebCore::ImageBuffer::isRemote const):
+
</ins><span class="cx"> 2021-11-08  Kocsen Chung  <kocsen_chung@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Cherry-pick r283470. rdar://problem/85166382
</span><span class="lines">@@ -7774,11 +7778,7 @@
</span><span class="cx">             * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
</span><span class="cx">             (WebCore::GraphicsContextGLOpenGL::reshapeDisplayBufferBacking):
</span><span class="cx"> 
</span><del>-<<<<<<< THEIRS
</del><span class="cx"> 2021-09-22  Alan Coon  <alancoon@apple.com>
</span><del>-=======
-        This is in preparation for removing content scanning completely.
->>>>>>> OURS
</del><span class="cx"> 
</span><span class="cx">         Cherry-pick r281431. rdar://problem/83429553
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari612branchSourceWebCoreplatformgraphicsavfoundationMediaPlayerPrivateAVFoundationcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp (285516 => 285517)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp      2021-11-09 19:41:58 UTC (rev 285516)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp 2021-11-09 19:42:03 UTC (rev 285517)
</span><span class="lines">@@ -95,23 +95,26 @@
</span><span class="cx"> MediaPlayerPrivateAVFoundation::MediaRenderingMode MediaPlayerPrivateAVFoundation::currentRenderingMode() const
</span><span class="cx"> {
</span><span class="cx">     if (platformLayer())
</span><del>-        return MediaRenderingToLayer;
</del><ins>+        return MediaRenderingMode::MediaRenderingToLayer;
</ins><span class="cx"> 
</span><span class="cx">     if (hasContextRenderer())
</span><del>-        return MediaRenderingToContext;
</del><ins>+        return MediaRenderingMode::MediaRenderingToContext;
</ins><span class="cx"> 
</span><del>-    return MediaRenderingNone;
</del><ins>+    return MediaRenderingMode::MediaRenderingNone;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> MediaPlayerPrivateAVFoundation::MediaRenderingMode MediaPlayerPrivateAVFoundation::preferredRenderingMode() const
</span><span class="cx"> {
</span><span class="cx">     if (assetStatus() == MediaPlayerAVAssetStatusUnknown)
</span><del>-        return MediaRenderingNone;
</del><ins>+        return MediaRenderingMode::MediaRenderingNone;
</ins><span class="cx"> 
</span><ins>+    if (m_readyState >= MediaPlayer::ReadyState::HaveMetadata && !haveBeenAskedToPaint())
+        return MediaRenderingMode::MediaRenderingToLayer;
+
</ins><span class="cx">     if (supportsAcceleratedRendering() && m_player->renderingCanBeAccelerated())
</span><del>-        return MediaRenderingToLayer;
</del><ins>+        return MediaRenderingMode::MediaRenderingToLayer;
</ins><span class="cx"> 
</span><del>-    return MediaRenderingToContext;
</del><ins>+    return MediaRenderingMode::MediaRenderingToContext;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MediaPlayerPrivateAVFoundation::setUpVideoRendering()
</span><span class="lines">@@ -122,20 +125,22 @@
</span><span class="cx">     MediaRenderingMode currentMode = currentRenderingMode();
</span><span class="cx">     MediaRenderingMode preferredMode = preferredRenderingMode();
</span><span class="cx"> 
</span><del>-    if (currentMode == preferredMode && currentMode != MediaRenderingNone)
</del><ins>+    if (currentMode == preferredMode && currentMode != MediaRenderingMode::MediaRenderingNone)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG(LOGIDENTIFIER, preferredMode);
+
</ins><span class="cx">     switch (preferredMode) {
</span><del>-    case MediaRenderingNone:
</del><ins>+    case MediaRenderingMode::MediaRenderingNone:
</ins><span class="cx">         tearDownVideoRendering();
</span><span class="cx">         break;
</span><span class="cx"> 
</span><del>-    case MediaRenderingToContext:
</del><ins>+    case MediaRenderingMode::MediaRenderingToContext:
</ins><span class="cx">         destroyVideoLayer();
</span><span class="cx">         createContextVideoRenderer();
</span><span class="cx">         break;
</span><span class="cx"> 
</span><del>-    case MediaRenderingToLayer:
</del><ins>+    case MediaRenderingMode::MediaRenderingToLayer:
</ins><span class="cx">         destroyContextVideoRenderer();
</span><span class="cx">         createVideoLayer();
</span><span class="cx">         break;
</span><span class="lines">@@ -142,7 +147,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // If using a movie layer, inform the client so the compositing tree is updated.
</span><del>-    if (currentMode == MediaRenderingToLayer || preferredMode == MediaRenderingToLayer)
</del><ins>+    if (currentMode == MediaRenderingMode::MediaRenderingToLayer || preferredMode == MediaRenderingMode::MediaRenderingToLayer)
</ins><span class="cx">         setNeedsRenderingModeChanged();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -152,6 +157,8 @@
</span><span class="cx">         return;
</span><span class="cx">     m_needsRenderingModeChanged = true;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG(LOGIDENTIFIER);
+
</ins><span class="cx">     queueTaskOnEventLoop([weakThis = makeWeakPtr(*this)] {
</span><span class="cx">         if (weakThis)
</span><span class="cx">             weakThis->renderingModeChanged();
</span><span class="lines">@@ -462,7 +469,7 @@
</span><span class="cx"> 
</span><span class="cx">     setUpVideoRendering();
</span><span class="cx"> 
</span><del>-    if (currentRenderingMode() == MediaRenderingToLayer || preferredRenderingMode() == MediaRenderingToLayer)
</del><ins>+    if (currentRenderingMode() == MediaRenderingMode::MediaRenderingToLayer || preferredRenderingMode() == MediaRenderingMode::MediaRenderingToLayer)
</ins><span class="cx">         setNeedsRenderingModeChanged();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -586,10 +593,12 @@
</span><span class="cx">     if (m_visible == visible)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG(LOGIDENTIFIER, visible);
+
</ins><span class="cx">     m_visible = visible;
</span><span class="cx">     if (visible)
</span><span class="cx">         setUpVideoRendering();
</span><del>-    
</del><ins>+
</ins><span class="cx">     platformSetVisible(visible);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1122,6 +1131,20 @@
</span><span class="cx">     return cache;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+String convertEnumerationToString(MediaPlayerPrivateAVFoundation::MediaRenderingMode enumerationValue)
+{
+    static const NeverDestroyed<String> values[] = {
+        MAKE_STATIC_STRING_IMPL("MediaRenderingNone"),
+        MAKE_STATIC_STRING_IMPL("MediaRenderingToContext"),
+        MAKE_STATIC_STRING_IMPL("MediaRenderingToLayer"),
+    };
+    static_assert(static_cast<size_t>(MediaPlayerPrivateAVFoundation::MediaRenderingMode::MediaRenderingNone) == 0, "MediaRenderingMode::MediaRenderingNone is not 0 as expected");
+    static_assert(static_cast<size_t>(MediaPlayerPrivateAVFoundation::MediaRenderingMode::MediaRenderingToContext) == 1, "MediaRenderingMode::MediaRenderingToContext is not 1 as expected");
+    static_assert(static_cast<size_t>(MediaPlayerPrivateAVFoundation::MediaRenderingMode::MediaRenderingToLayer) == 2, "MediaRenderingMode::MediaRenderingToLayer is not 2 as expected");
+    ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
+    return values[static_cast<size_t>(enumerationValue)];
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="branchessafari612branchSourceWebCoreplatformgraphicsavfoundationMediaPlayerPrivateAVFoundationh"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h (285516 => 285517)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h        2021-11-09 19:41:58 UTC (rev 285516)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h   2021-11-09 19:42:03 UTC (rev 285517)
</span><span class="lines">@@ -153,6 +153,12 @@
</span><span class="cx">     WTFLogChannel& logChannel() const final;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    enum class MediaRenderingMode : uint8_t {
+        MediaRenderingNone,
+        MediaRenderingToContext,
+        MediaRenderingToLayer
+    };
+
</ins><span class="cx"> protected:
</span><span class="cx">     explicit MediaPlayerPrivateAVFoundation(MediaPlayer*);
</span><span class="cx">     virtual ~MediaPlayerPrivateAVFoundation();
</span><span class="lines">@@ -270,7 +276,6 @@
</span><span class="cx">     static bool isUnsupportedMIMEType(const String&);
</span><span class="cx">     static const HashSet<String, ASCIICaseInsensitiveHash>& staticMIMETypeList();
</span><span class="cx"> 
</span><del>-protected:
</del><span class="cx">     void updateStates();
</span><span class="cx"> 
</span><span class="cx">     void setHasVideo(bool);
</span><span class="lines">@@ -285,7 +290,6 @@
</span><span class="cx">     void setNetworkState(MediaPlayer::NetworkState);
</span><span class="cx">     void setReadyState(MediaPlayer::ReadyState);
</span><span class="cx"> 
</span><del>-    enum MediaRenderingMode { MediaRenderingNone, MediaRenderingToContext, MediaRenderingToLayer };
</del><span class="cx">     MediaRenderingMode currentRenderingMode() const;
</span><span class="cx">     MediaRenderingMode preferredRenderingMode() const;
</span><span class="cx"> 
</span><span class="lines">@@ -294,6 +298,7 @@
</span><span class="cx">     bool isReadyForVideoSetup() const;
</span><span class="cx">     virtual void setUpVideoRendering();
</span><span class="cx">     virtual void tearDownVideoRendering();
</span><ins>+    virtual bool haveBeenAskedToPaint() const { return false; }
</ins><span class="cx">     bool hasSetUpVideoRendering() const;
</span><span class="cx"> 
</span><span class="cx">     void mainThreadCallback();
</span><span class="lines">@@ -374,6 +379,24 @@
</span><span class="cx">     bool m_needsRenderingModeChanged { false };
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+String convertEnumerationToString(MediaPlayerPrivateAVFoundation::MediaRenderingMode);
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><ins>+namespace WTF {
+
+template<typename Type>
+struct LogArgument;
+
+template<> struct EnumTraits<WebCore::MediaPlayerPrivateAVFoundation::MediaRenderingMode> {
+using values = EnumValues<
+    WebCore::MediaPlayerPrivateAVFoundation::MediaRenderingMode,
+    WebCore::MediaPlayerPrivateAVFoundation::MediaRenderingMode::MediaRenderingNone,
+    WebCore::MediaPlayerPrivateAVFoundation::MediaRenderingMode::MediaRenderingToContext,
+    WebCore::MediaPlayerPrivateAVFoundation::MediaRenderingMode::MediaRenderingToLayer
+    >;
+};
+
+}; // namespace WTF
+
</ins><span class="cx"> #endif // ENABLE(VIDEO) && USE(AVFOUNDATION)
</span></span></pre></div>
<a id="branchessafari612branchSourceWebCoreplatformgraphicsavfoundationcfMediaPlayerPrivateAVFoundationCFcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp (285516 => 285517)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp 2021-11-09 19:41:58 UTC (rev 285516)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp    2021-11-09 19:42:03 UTC (rev 285517)
</span><span class="lines">@@ -869,7 +869,7 @@
</span><span class="cx">     if (!metaDataAvailable() || context.paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    if (currentRenderingMode() == MediaRenderingToLayer && !imageGenerator(m_avfWrapper)) {
</del><ins>+    if (currentRenderingMode() == MediaRenderingMode::MediaRenderingToLayer && !imageGenerator(m_avfWrapper)) {
</ins><span class="cx">         // We're being told to render into a context, but we already have the
</span><span class="cx">         // video layer, which probably means we've been called from <canvas>.
</span><span class="cx">         createContextVideoRenderer();
</span></span></pre></div>
<a id="branchessafari612branchSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateAVFoundationObjCh"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h (285516 => 285517)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h       2021-11-09 19:41:58 UTC (rev 285516)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h  2021-11-09 19:42:03 UTC (rev 285517)
</span><span class="lines">@@ -333,6 +333,7 @@
</span><span class="cx">     bool supportsPauseAtHostTime() const final { return true; }
</span><span class="cx">     bool playAtHostTime(const MonotonicTime&) final;
</span><span class="cx">     bool pauseAtHostTime(const MonotonicTime&) final;
</span><ins>+    bool haveBeenAskedToPaint() const { return m_haveBeenAskedToPaint; }
</ins><span class="cx"> 
</span><span class="cx">     RetainPtr<AVURLAsset> m_avAsset;
</span><span class="cx">     RetainPtr<AVPlayer> m_avPlayer;
</span><span class="lines">@@ -439,6 +440,7 @@
</span><span class="cx"> #endif
</span><span class="cx">     bool m_runningModalPaint { false };
</span><span class="cx">     bool m_waitForVideoOutputMediaDataWillChangeTimedOut { false };
</span><ins>+    bool m_haveBeenAskedToPaint { false };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchessafari612branchSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateAVFoundationObjCmm"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (285516 => 285517)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm      2021-11-09 19:41:58 UTC (rev 285516)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2021-11-09 19:42:03 UTC (rev 285517)
</span><span class="lines">@@ -627,6 +627,8 @@
</span><span class="cx">     if (!m_avPlayer)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG(LOGIDENTIFIER);
+
</ins><span class="cx">     m_videoLayer = adoptNS([PAL::allocAVPlayerLayerInstance() init]);
</span><span class="cx">     [m_videoLayer setPlayer:m_avPlayer.get()];
</span><span class="cx"> 
</span><span class="lines">@@ -680,7 +682,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool MediaPlayerPrivateAVFoundationObjC::hasAvailableVideoFrame() const
</span><span class="cx"> {
</span><del>-    if (currentRenderingMode() == MediaRenderingToLayer)
</del><ins>+    if (currentRenderingMode() == MediaRenderingMode::MediaRenderingToLayer)
</ins><span class="cx">         return m_cachedIsReadyForDisplay;
</span><span class="cx"> 
</span><span class="cx">     if (m_videoOutput && (m_lastPixelBuffer || [m_videoOutput hasNewPixelBufferForItemTime:[m_avPlayerItem currentTime]]))
</span><span class="lines">@@ -1814,7 +1816,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     // We can ignore the request if we are already rendering to a layer.
</span><del>-    if (currentRenderingMode() == MediaRenderingToLayer)
</del><ins>+    if (currentRenderingMode() == MediaRenderingMode::MediaRenderingToLayer)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     // paint() is best effort, so only paint if we already have an image generator or video output available.
</span><span class="lines">@@ -2460,6 +2462,8 @@
</span><span class="cx">     if (!m_avPlayerItem || readyState() < MediaPlayer::ReadyState::HaveCurrentData)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><ins>+    m_haveBeenAskedToPaint = true;
+
</ins><span class="cx">     if (!m_videoOutput)
</span><span class="cx">         createVideoOutput();
</span><span class="cx">     ASSERT(m_videoOutput);
</span></span></pre>
</div>
</div>

</body>
</html>