Title: [241437] trunk/Source/WebCore
Revision
241437
Author
jer.no...@apple.com
Date
2019-02-13 09:45:23 -0800 (Wed, 13 Feb 2019)

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (241436 => 241437)


--- trunk/Source/WebCore/ChangeLog	2019-02-13 17:12:57 UTC (rev 241436)
+++ trunk/Source/WebCore/ChangeLog	2019-02-13 17:45:23 UTC (rev 241437)
@@ -1,3 +1,17 @@
+2019-02-13  Jer Noble  <jer.no...@apple.com>
+
+        [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):
+
 2019-02-13  Antoine Quint  <grao...@apple.com>
 
         Support simulated mouse events on iOS based on a PlatformTouchEvent

Modified: trunk/Source/WebCore/platform/cocoa/CoreVideoSoftLink.cpp (241436 => 241437)


--- trunk/Source/WebCore/platform/cocoa/CoreVideoSoftLink.cpp	2019-02-13 17:12:57 UTC (rev 241436)
+++ trunk/Source/WebCore/platform/cocoa/CoreVideoSoftLink.cpp	2019-02-13 17:45:23 UTC (rev 241437)
@@ -41,7 +41,6 @@
 SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVPixelBufferGetBaseAddress, void*, (CVPixelBufferRef pixelBuffer), (pixelBuffer))
 SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVPixelBufferGetBytesPerRow, size_t, (CVPixelBufferRef pixelBuffer), (pixelBuffer))
 SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVPixelBufferGetBytesPerRowOfPlane, size_t, (CVPixelBufferRef pixelBuffer, size_t planeIndex), (pixelBuffer, planeIndex))
-SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVPixelBufferGetDataSize, size_t, (CVPixelBufferRef pixelBuffer), (pixelBuffer))
 SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVPixelBufferGetPixelFormatType, OSType, (CVPixelBufferRef pixelBuffer), (pixelBuffer))
 SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVPixelBufferGetBaseAddressOfPlane, void *, (CVPixelBufferRef pixelBuffer, size_t planeIndex), (pixelBuffer, planeIndex));
 SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVPixelBufferLockBaseAddress, CVReturn, (CVPixelBufferRef pixelBuffer, CVOptionFlags lockFlags), (pixelBuffer, lockFlags))

Modified: trunk/Source/WebCore/platform/cocoa/CoreVideoSoftLink.h (241436 => 241437)


--- trunk/Source/WebCore/platform/cocoa/CoreVideoSoftLink.h	2019-02-13 17:12:57 UTC (rev 241436)
+++ trunk/Source/WebCore/platform/cocoa/CoreVideoSoftLink.h	2019-02-13 17:45:23 UTC (rev 241437)
@@ -48,8 +48,6 @@
 #define CVPixelBufferGetBytesPerRow softLink_CoreVideo_CVPixelBufferGetBytesPerRow
 SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVPixelBufferGetBytesPerRowOfPlane, size_t, (CVPixelBufferRef pixelBuffer, size_t planeIndex), (pixelBuffer, planeIndex))
 #define CVPixelBufferGetBytesPerRowOfPlane softLink_CoreVideo_CVPixelBufferGetBytesPerRowOfPlane
-SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVPixelBufferGetDataSize, size_t, (CVPixelBufferRef pixelBuffer), (pixelBuffer))
-#define CVPixelBufferGetDataSize softLink_CoreVideo_CVPixelBufferGetDataSize
 SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVPixelBufferGetPixelFormatType, OSType, (CVPixelBufferRef pixelBuffer), (pixelBuffer))
 #define CVPixelBufferGetPixelFormatType softLink_CoreVideo_CVPixelBufferGetPixelFormatType
 SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVPixelBufferGetBaseAddressOfPlane, void *, (CVPixelBufferRef pixelBuffer, size_t planeIndex), (pixelBuffer, planeIndex));

Modified: trunk/Source/WebCore/platform/graphics/cv/PixelBufferConformerCV.cpp (241436 => 241437)


--- trunk/Source/WebCore/platform/graphics/cv/PixelBufferConformerCV.cpp	2019-02-13 17:12:57 UTC (rev 241436)
+++ trunk/Source/WebCore/platform/graphics/cv/PixelBufferConformerCV.cpp	2019-02-13 17:45:23 UTC (rev 241437)
@@ -76,8 +76,10 @@
 
     ++info->lockCount;
     void* address = CVPixelBufferGetBaseAddress(info->pixelBuffer.get());
-    verifyImageBufferIsBigEnough(address, CVPixelBufferGetDataSize(info->pixelBuffer.get()));
-    RELEASE_LOG_INFO(Media, "CVPixelBufferGetBytePointerCallback() returning bytePointer: %p, size: %zu", address, CVPixelBufferGetDataSize(info->pixelBuffer.get()));
+    size_t byteLength = CVPixelBufferGetBytesPerRow(info->pixelBuffer.get()) * CVPixelBufferGetHeight(info->pixelBuffer.get());
+
+    verifyImageBufferIsBigEnough(address, byteLength);
+    RELEASE_LOG_INFO(Media, "CVPixelBufferGetBytePointerCallback() returning bytePointer: %p, size: %zu", address, byteLength);
     return address;
 }
 
@@ -170,7 +172,7 @@
 
     CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Little | kCGImageAlphaFirst;
     size_t bytesPerRow = CVPixelBufferGetBytesPerRow(buffer.get());
-    size_t byteLength = CVPixelBufferGetDataSize(buffer.get());
+    size_t byteLength = bytesPerRow * height;
 
     ASSERT(byteLength);
     if (!byteLength)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to