-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[android_camera_camerax] Fix incorrect camera mirroring for front cameras on devices using ImageReader
Impeller backend
#9233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ImageReader
Impeller backendImageReader
Impeller backend
ImageReader
Impeller backendImageReader
Impeller backend
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These look great, thank you! Just added some suggestions for clarity in case someone has to revisit this later :)
packages/camera/camera_android_camerax/test/preview_rotation_test.dart
Outdated
Show resolved
Hide resolved
packages/camera/camera_android_camerax/test/preview_rotation_test.dart
Outdated
Show resolved
Hide resolved
This reverts commit e2fba01.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just found an extra space
@jesswrd and I worked on this PR together, so we'll need another reviewer to land this PR! |
Co-authored-by: Camille Simon <[email protected]>
// If the camera is front facing, mirror the camera preview | ||
// according to the current device orientation. | ||
Widget cameraPreview = widget.child; | ||
if (widget.facingSign == 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is == 1 the correct comparison here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah because facingSign
maps to the sign
in https://developer.android.com/media/camera/camera2/camera-preview#orientation_calculation, which is 1 for front cameras, -1 for back facing cameras. I'll add a comment to the code!
… front cameras on devices using `ImageReader` Impeller backend (flutter/packages#9233)
… front cameras on devices using `ImageReader` Impeller backend (flutter/packages#9233)
flutter/packages@6d3aaf4...c5ab57a 2025-06-13 [email protected] [flutter_svg] feat: Expose the renderStrategy property in SvgPicture (flutter/packages#9373) 2025-06-12 [email protected] [go_router] Add routing functions to GoRouteData (flutter/packages#9277) 2025-06-12 [email protected] [various] Update example apps to Swift (flutter/packages#9347) 2025-06-12 [email protected] Roll Flutter from 824868f to f79452e (94 revisions) (flutter/packages#9419) 2025-06-12 [email protected] [android_camera_camerax] Fix incorrect camera mirroring for front cameras on devices using `ImageReader` Impeller backend (flutter/packages#9233) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Fixes the incorrect camera mirroring when the front camera is used on devices that use the
ImageReader
Impeller backend. TLDR: for relevant rotated preview implementation, when the front camera is used, mirror the camera preview across the y-axis when the device is in a portrait orientation or across the x-axis when the device is in a landscape orientation.Fixes flutter/flutter#156974.
cc @jesswrd, co-author of this PR
Pre-Review Checklist
[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2 ↩3