Changeset 288053 in webkit


Ignore:
Timestamp:
Jan 14, 2022 11:30:01 PM (6 months ago)
Author:
Peng Liu
Message:

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):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r288052 r288053  
     12022-01-14  Peng Liu  <peng.liu6@apple.com>
     2
     3        Unable to playback portrait videos on HTML canvas elements
     4        https://bugs.webkit.org/show_bug.cgi?id=235238
     5
     6        Reviewed by Jer Noble.
     7
     8        We need to make sure the destination pixel buffer is IOSurface-backed.
     9        Otherwise, VTImageRotationSession cannot rotate a pixel buffer with
     10        a compressed pixel format.
     11
     12        Manually tested.
     13
     14        Layout tests for this exist, but unless they run on an iPhone 12 or
     15        later HW, they won't fail. For example:
     16        - media/video-orientation-canvas.html
     17
     18        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
     19        (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastPixelBuffer):
     20        * platform/graphics/cv/ImageRotationSessionVT.mm:
     21        (WebCore::ImageRotationSessionVT::rotate):
     22
    1232022-01-14  Frederic Wang  <fwang@igalia.com>
    224
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm

    r288031 r288053  
    25572557    }
    25582558
    2559     if (m_imageRotationSession)
     2559    if (m_lastPixelBuffer && m_imageRotationSession)
    25602560        m_lastPixelBuffer = m_imageRotationSession->rotate(m_lastPixelBuffer.get());
    25612561
  • trunk/Source/WebCore/platform/graphics/cv/ImageRotationSessionVT.mm

    r281950 r288053  
    103103            (__bridge NSString *)kCVPixelBufferPixelFormatTypeKey: @(m_pixelFormat),
    104104            (__bridge NSString *)kCVPixelBufferCGImageCompatibilityKey: (m_isCGImageCompatible == IsCGImageCompatible::Yes ? @YES : @NO),
    105 #if PLATFORM(IOS_SIMULATOR) || PLATFORM(MAC)
    106105            (__bridge NSString *)kCVPixelBufferIOSurfacePropertiesKey : @{ }
    107 #endif
    108106        };
    109107
     
    120118    CVPixelBufferRef rawRotatedBuffer = nullptr;
    121119    auto status = CVPixelBufferPoolCreatePixelBuffer(kCFAllocatorDefault, m_rotationPool.get(), &rawRotatedBuffer);
    122     if (status != kCVReturnSuccess) {
     120    if (status != kCVReturnSuccess || !rawRotatedBuffer) {
    123121        RELEASE_LOG_ERROR(WebRTC, "ImageRotationSessionVT failed creating buffer from pool with error %d", status);
    124122        return nullptr;
Note: See TracChangeset for help on using the changeset viewer.