Skip to content
Permalink
Browse files
Fix RGBA data VideoFrame copyTo
https://bugs.webkit.org/show_bug.cgi?id=247717
rdar://102160471

Reviewed by Eric Carlson.

* Source/WebCore/platform/graphics/cv/VideoFrameCV.mm:
(WebCore::VideoFrame::copyTo):
Copy the number of bytes and not the number of pixels.

Canonical link: https://commits.webkit.org/256534@main
  • Loading branch information
youennf committed Nov 10, 2022
1 parent 5919cb3 commit 7cbae1c1f4b5ae8a346085fb9e543746d39c9bd8
Showing 1 changed file with 6 additions and 3 deletions.
@@ -354,7 +354,9 @@ static void copyPlane(uint8_t* destination, const uint8_t* source, uint64_t sour
ComputedPlaneLayout planeLayout;
if (!computedPlaneLayout.isEmpty())
planeLayout = computedPlaneLayout[0];
auto planeLayouts = copyRGBData(span, planeLayout, this->pixelBuffer(), [](auto* destination, auto* source, size_t pixelCount) {
auto planeLayouts = copyRGBData(span, planeLayout, this->pixelBuffer(), [](auto* destination, auto* source, size_t byteLength) {
ASSERT(!(byteLength % 4));
auto pixelCount = byteLength / 4;
size_t i = 0;
while (pixelCount-- > 0) {
// ARGB -> RGBA.
@@ -373,8 +375,9 @@ static void copyPlane(uint8_t* destination, const uint8_t* source, uint64_t sour
ComputedPlaneLayout planeLayout;
if (!computedPlaneLayout.isEmpty())
planeLayout = computedPlaneLayout[0];
auto planeLayouts = copyRGBData(span, planeLayout, this->pixelBuffer(), [](auto* destination, auto* source, size_t pixelCount) {
std::memcpy(destination, source, pixelCount * 4);

auto planeLayouts = copyRGBData(span, planeLayout, this->pixelBuffer(), [](auto* destination, auto* source, size_t byteLength) {
std::memcpy(destination, source, byteLength);
});
callback(WTFMove(planeLayouts));
return;

0 comments on commit 7cbae1c

Please sign in to comment.