Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 4e32295b2b9858d73ab68d809668879b4529dce6
https://github.com/WebKit/WebKit/commit/4e32295b2b9858d73ab68d809668879b4529dce6
Author: Ahmad Saleem <[email protected]>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M Source/WebCore/platform/graphics/cv/ImageRotationSessionVT.h
M Source/WebCore/platform/graphics/cv/ImageRotationSessionVT.mm
M Tools/TestWebKitAPI/Tests/WebCore/cocoa/ImageRotationSessionVT.cpp
Log Message:
-----------
Mirrored VideoFrame is flipped vertically instead of horizontally when baking
rotation
https://bugs.webkit.org/show_bug.cgi?id=324074
rdar://187300986
Reviewed by Youenn Fablet.
ImageRotationSessionVT::applyRotation(VideoFrame&) mapped
videoFrame.isMirrored()
to RotationProperties::flipY, which requests a vertical (top-bottom) flip via
kVTImageRotationPropertyKey_FlipVerticalOrientation. Mirroring is a horizontal
(left-right) flip everywhere else in the engine: the NativeImage sibling maps
the
horizontally-mirrored OriginTopRight orientation to flipX,
transformToRotationProperties
treats a -1 scaleX as flipX, and LocalSampleBufferDisplayLayer /
MediaPlayerPrivateMediaStreamAVFObjC apply isMirrored() as
CGAffineTransformScale(t, -1, 1).
The flag itself originates from -[AVCaptureConnection isVideoMirrored]
(front-camera
left-right mirroring). As a result, baking rotation into a mirrored frame
produced an
upside-down frame instead of a left-right mirrored one.
Map isMirrored() to flipX to match VideoToolbox semantics and the rest of the
codebase.
Adds an API test that marks the top-left quadrant of a frame, applies rotation
with
isMirrored set, and checks the marker lands top-right (horizontal flip) rather
than
bottom-left (the previous vertical flip). applyRotation(VideoFrame&) is now
exported so
the test can link against it.
Test: Tools/TestWebKitAPI/Tests/WebCore/cocoa/ImageRotationSessionVT.cpp
* Source/WebCore/platform/graphics/cv/ImageRotationSessionVT.h:
* Source/WebCore/platform/graphics/cv/ImageRotationSessionVT.mm:
(WebCore::ImageRotationSessionVT::applyRotation):
* Tools/TestWebKitAPI/Tests/WebCore/cocoa/ImageRotationSessionVT.cpp:
(TestWebKitAPI::markTopLeftQuadrant):
(TestWebKitAPI::sampleLuma):
(TestWebKitAPI::TEST(ImageRotationSessionVT, MirroredFrameFlipsHorizontally)):
(TestWebKitAPI::TEST(ImageRotationSessionVT, UnmirroredFrameIsUnchanged)):
Canonical link: https://commits.webkit.org/321697@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications