Changeset 241437 in webkit


Ignore:
Timestamp:
Feb 13, 2019 9:45:23 AM (5 years ago)
Author:
jer.noble@apple.com
Message:

[Cocoa] Switch to CVPixelBufferGetBytesPerRow() for calculating CVPixelBuffer base address size.
https://bugs.webkit.org/show_bug.cgi?id=194580
<rdar://problem/42727739>

Reviewed by Eric Carlson.

  • platform/cocoa/CoreVideoSoftLink.cpp:
  • platform/cocoa/CoreVideoSoftLink.h:
  • platform/graphics/cv/PixelBufferConformerCV.cpp:

(WebCore::CVPixelBufferGetBytePointerCallback):
(WebCore::PixelBufferConformerCV::createImageFromPixelBuffer):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r241432 r241437  
     12019-02-13  Jer Noble  <jer.noble@apple.com>
     2
     3        [Cocoa] Switch to CVPixelBufferGetBytesPerRow() for calculating CVPixelBuffer base address size.
     4        https://bugs.webkit.org/show_bug.cgi?id=194580
     5        <rdar://problem/42727739>
     6
     7        Reviewed by Eric Carlson.
     8
     9        * platform/cocoa/CoreVideoSoftLink.cpp:
     10        * platform/cocoa/CoreVideoSoftLink.h:
     11        * platform/graphics/cv/PixelBufferConformerCV.cpp:
     12        (WebCore::CVPixelBufferGetBytePointerCallback):
     13        (WebCore::PixelBufferConformerCV::createImageFromPixelBuffer):
     14
    1152019-02-13  Antoine Quint  <graouts@apple.com>
    216
  • trunk/Source/WebCore/platform/cocoa/CoreVideoSoftLink.cpp

    r237236 r241437  
    4242SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVPixelBufferGetBytesPerRow, size_t, (CVPixelBufferRef pixelBuffer), (pixelBuffer))
    4343SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVPixelBufferGetBytesPerRowOfPlane, size_t, (CVPixelBufferRef pixelBuffer, size_t planeIndex), (pixelBuffer, planeIndex))
    44 SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVPixelBufferGetDataSize, size_t, (CVPixelBufferRef pixelBuffer), (pixelBuffer))
    4544SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVPixelBufferGetPixelFormatType, OSType, (CVPixelBufferRef pixelBuffer), (pixelBuffer))
    4645SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVPixelBufferGetBaseAddressOfPlane, void *, (CVPixelBufferRef pixelBuffer, size_t planeIndex), (pixelBuffer, planeIndex));
  • trunk/Source/WebCore/platform/cocoa/CoreVideoSoftLink.h

    r237236 r241437  
    4949SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVPixelBufferGetBytesPerRowOfPlane, size_t, (CVPixelBufferRef pixelBuffer, size_t planeIndex), (pixelBuffer, planeIndex))
    5050#define CVPixelBufferGetBytesPerRowOfPlane softLink_CoreVideo_CVPixelBufferGetBytesPerRowOfPlane
    51 SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVPixelBufferGetDataSize, size_t, (CVPixelBufferRef pixelBuffer), (pixelBuffer))
    52 #define CVPixelBufferGetDataSize softLink_CoreVideo_CVPixelBufferGetDataSize
    5351SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVPixelBufferGetPixelFormatType, OSType, (CVPixelBufferRef pixelBuffer), (pixelBuffer))
    5452#define CVPixelBufferGetPixelFormatType softLink_CoreVideo_CVPixelBufferGetPixelFormatType
  • trunk/Source/WebCore/platform/graphics/cv/PixelBufferConformerCV.cpp

    r240235 r241437  
    7777    ++info->lockCount;
    7878    void* address = CVPixelBufferGetBaseAddress(info->pixelBuffer.get());
    79     verifyImageBufferIsBigEnough(address, CVPixelBufferGetDataSize(info->pixelBuffer.get()));
    80     RELEASE_LOG_INFO(Media, "CVPixelBufferGetBytePointerCallback() returning bytePointer: %p, size: %zu", address, CVPixelBufferGetDataSize(info->pixelBuffer.get()));
     79    size_t byteLength = CVPixelBufferGetBytesPerRow(info->pixelBuffer.get()) * CVPixelBufferGetHeight(info->pixelBuffer.get());
     80
     81    verifyImageBufferIsBigEnough(address, byteLength);
     82    RELEASE_LOG_INFO(Media, "CVPixelBufferGetBytePointerCallback() returning bytePointer: %p, size: %zu", address, byteLength);
    8183    return address;
    8284}
     
    171173    CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Little | kCGImageAlphaFirst;
    172174    size_t bytesPerRow = CVPixelBufferGetBytesPerRow(buffer.get());
    173     size_t byteLength = CVPixelBufferGetDataSize(buffer.get());
     175    size_t byteLength = bytesPerRow * height;
    174176
    175177    ASSERT(byteLength);
Note: See TracChangeset for help on using the changeset viewer.