Skip to content

Commit

Permalink
Fix RGBA data VideoFrame copyTo
Browse files Browse the repository at this point in the history
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 7cbae1c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Source/WebCore/platform/graphics/cv/VideoFrameCV.mm
Expand Up @@ -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.
Expand All @@ -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;
Expand Down

0 comments on commit 7cbae1c

Please sign in to comment.