Title: [289275] branches/safari-613-branch/Source/WebCore
Revision
289275
Author
[email protected]
Date
2022-02-07 18:53:19 -0800 (Mon, 07 Feb 2022)

Log Message

Cherry-pick r288053. rdar://problem/85760433

    Unable to playback portrait videos on HTML canvas elements
    https://bugs.webkit.org/show_bug.cgi?id=235238

    Reviewed by Jer Noble.

    We need to make sure the destination pixel buffer is IOSurface-backed.
    Otherwise, VTImageRotationSession cannot rotate a pixel buffer with
    a compressed pixel format.

    Manually tested.

    Layout tests for this exist, but unless they run on an iPhone 12 or
    later HW, they won't fail. For example:
    - media/video-orientation-canvas.html

    * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
    (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastPixelBuffer):
    * platform/graphics/cv/ImageRotationSessionVT.mm:
    (WebCore::ImageRotationSessionVT::rotate):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288053 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (289274 => 289275)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-02-08 02:53:15 UTC (rev 289274)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-02-08 02:53:19 UTC (rev 289275)
@@ -1,5 +1,54 @@
 2022-02-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r288053. rdar://problem/85760433
+
+    Unable to playback portrait videos on HTML canvas elements
+    https://bugs.webkit.org/show_bug.cgi?id=235238
+    
+    Reviewed by Jer Noble.
+    
+    We need to make sure the destination pixel buffer is IOSurface-backed.
+    Otherwise, VTImageRotationSession cannot rotate a pixel buffer with
+    a compressed pixel format.
+    
+    Manually tested.
+    
+    Layout tests for this exist, but unless they run on an iPhone 12 or
+    later HW, they won't fail. For example:
+    - media/video-orientation-canvas.html
+    
+    * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+    (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastPixelBuffer):
+    * platform/graphics/cv/ImageRotationSessionVT.mm:
+    (WebCore::ImageRotationSessionVT::rotate):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288053 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-01-14  Peng Liu  <[email protected]>
+
+            Unable to playback portrait videos on HTML canvas elements
+            https://bugs.webkit.org/show_bug.cgi?id=235238
+
+            Reviewed by Jer Noble.
+
+            We need to make sure the destination pixel buffer is IOSurface-backed.
+            Otherwise, VTImageRotationSession cannot rotate a pixel buffer with
+            a compressed pixel format.
+
+            Manually tested.
+
+            Layout tests for this exist, but unless they run on an iPhone 12 or
+            later HW, they won't fail. For example:
+            - media/video-orientation-canvas.html
+
+            * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+            (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastPixelBuffer):
+            * platform/graphics/cv/ImageRotationSessionVT.mm:
+            (WebCore::ImageRotationSessionVT::rotate):
+
+2022-02-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r288031. rdar://problem/82997136
 
     [Cocoa] rVFC() isn't called for initial video load

Modified: branches/safari-613-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (289274 => 289275)


--- branches/safari-613-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2022-02-08 02:53:15 UTC (rev 289274)
+++ branches/safari-613-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2022-02-08 02:53:19 UTC (rev 289275)
@@ -2556,7 +2556,7 @@
         };
     }
 
-    if (m_imageRotationSession)
+    if (m_lastPixelBuffer && m_imageRotationSession)
         m_lastPixelBuffer = m_imageRotationSession->rotate(m_lastPixelBuffer.get());
 
     m_lastImage = nullptr;

Modified: branches/safari-613-branch/Source/WebCore/platform/graphics/cv/ImageRotationSessionVT.mm (289274 => 289275)


--- branches/safari-613-branch/Source/WebCore/platform/graphics/cv/ImageRotationSessionVT.mm	2022-02-08 02:53:15 UTC (rev 289274)
+++ branches/safari-613-branch/Source/WebCore/platform/graphics/cv/ImageRotationSessionVT.mm	2022-02-08 02:53:19 UTC (rev 289275)
@@ -102,9 +102,7 @@
             (__bridge NSString *)kCVPixelBufferHeightKey: @(m_rotatedSize.height()),
             (__bridge NSString *)kCVPixelBufferPixelFormatTypeKey: @(m_pixelFormat),
             (__bridge NSString *)kCVPixelBufferCGImageCompatibilityKey: (m_isCGImageCompatible == IsCGImageCompatible::Yes ? @YES : @NO),
-#if PLATFORM(IOS_SIMULATOR) || PLATFORM(MAC)
             (__bridge NSString *)kCVPixelBufferIOSurfacePropertiesKey : @{ }
-#endif
         };
 
         CVPixelBufferPoolRef rawPool = nullptr;
@@ -119,7 +117,7 @@
     RetainPtr<CVPixelBufferRef> result;
     CVPixelBufferRef rawRotatedBuffer = nullptr;
     auto status = CVPixelBufferPoolCreatePixelBuffer(kCFAllocatorDefault, m_rotationPool.get(), &rawRotatedBuffer);
-    if (status != kCVReturnSuccess) {
+    if (status != kCVReturnSuccess || !rawRotatedBuffer) {
         RELEASE_LOG_ERROR(WebRTC, "ImageRotationSessionVT failed creating buffer from pool with error %d", status);
         return nullptr;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to