-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[camera_android_camerax] Support NV21 #9853
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
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.
I notice that the diff here is a bit funky....it might be easier to look at the file itself and search for the tests that I modified there. I really only:
- Modified tests that tested logic previously in
createCamerathat I moved toinitializeCamers - Added
createCamera and initializeCamera properly set filter for resolution preset for non-video capture use casesandinitializeCamera sets camera state observer as expected.
Co-authored-by: jesswrd <[email protected]>
|
@camsim99 We should adjust the instructions on how to specifically convert from yuv format to nv21. Since the image stream still returns yuv with nv21 formatting. Or rather, I don't understand it yet haha. |
flutter/packages@86fbeec...141d8e3 2025-08-28 [email protected] Roll Flutter from c65f01d to da5523a (26 revisions) (flutter/packages#9903) 2025-08-28 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump androidx.test.espresso:espresso-core from 3.6.1 to 3.7.0 in /packages/local_auth/local_auth_android/android (flutter/packages#9916) 2025-08-28 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump androidx.test.espresso:espresso-core from 3.6.1 to 3.7.0 in /packages/google_maps_flutter/google_maps_flutter_android/android (flutter/packages#9915) 2025-08-28 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump androidx.test.espresso:espresso-core from 3.6.1 to 3.7.0 in /packages/in_app_purchase/in_app_purchase_android/android (flutter/packages#9914) 2025-08-27 [email protected] [google_fonts] Initial import (flutter/packages#9895) 2025-08-27 [email protected] [camera_android_camerax] Support NV21 (flutter/packages#9853) 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
|
@FantaMagier My understanding is that there is no further conversion work to do. The Android docs for the NV21 format that image streaming uses say:
I updated the the |
|
@camsim99 Okay, I understand, thanks for explaining! The strange thing is that I still can't transfer it with the Flutter ML Kit Package. |
|
@FantaMagier Can you open an issue for this with a minimal repro? I do want to make sure that use case works, so happy to follow up with you there. |
#9853 bumped it to 23, so updating the README. ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
This is very unfortunate. I hoped to fix the issue of google_mlkit_barcode_scanning with this but since the format group is still YUV_420_888, ml-kit throws the error in the ml-kit example here it says:
|
flutter/packages@86fbeec...141d8e3 2025-08-28 [email protected] Roll Flutter from c65f01d to da5523a (26 revisions) (flutter/packages#9903) 2025-08-28 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump androidx.test.espresso:espresso-core from 3.6.1 to 3.7.0 in /packages/local_auth/local_auth_android/android (flutter/packages#9916) 2025-08-28 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump androidx.test.espresso:espresso-core from 3.6.1 to 3.7.0 in /packages/google_maps_flutter/google_maps_flutter_android/android (flutter/packages#9915) 2025-08-28 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump androidx.test.espresso:espresso-core from 3.6.1 to 3.7.0 in /packages/in_app_purchase/in_app_purchase_android/android (flutter/packages#9914) 2025-08-27 [email protected] [google_fonts] Initial import (flutter/packages#9895) 2025-08-27 [email protected] [camera_android_camerax] Support NV21 (flutter/packages#9853) 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
flutter/packages@86fbeec...141d8e3 2025-08-28 [email protected] Roll Flutter from c65f01d to da5523a (26 revisions) (flutter/packages#9903) 2025-08-28 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump androidx.test.espresso:espresso-core from 3.6.1 to 3.7.0 in /packages/local_auth/local_auth_android/android (flutter/packages#9916) 2025-08-28 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump androidx.test.espresso:espresso-core from 3.6.1 to 3.7.0 in /packages/google_maps_flutter/google_maps_flutter_android/android (flutter/packages#9915) 2025-08-28 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump androidx.test.espresso:espresso-core from 3.6.1 to 3.7.0 in /packages/in_app_purchase/in_app_purchase_android/android (flutter/packages#9914) 2025-08-27 [email protected] [google_fonts] Initial import (flutter/packages#9895) 2025-08-27 [email protected] [camera_android_camerax] Support NV21 (flutter/packages#9853) 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
flutter/packages@86fbeec...141d8e3 2025-08-28 [email protected] Roll Flutter from c65f01d to da5523a (26 revisions) (flutter/packages#9903) 2025-08-28 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump androidx.test.espresso:espresso-core from 3.6.1 to 3.7.0 in /packages/local_auth/local_auth_android/android (flutter/packages#9916) 2025-08-28 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump androidx.test.espresso:espresso-core from 3.6.1 to 3.7.0 in /packages/google_maps_flutter/google_maps_flutter_android/android (flutter/packages#9915) 2025-08-28 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump androidx.test.espresso:espresso-core from 3.6.1 to 3.7.0 in /packages/in_app_purchase/in_app_purchase_android/android (flutter/packages#9914) 2025-08-27 [email protected] [google_fonts] Initial import (flutter/packages#9895) 2025-08-27 [email protected] [camera_android_camerax] Support NV21 (flutter/packages#9853) 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
flutter/packages@86fbeec...141d8e3 2025-08-28 [email protected] Roll Flutter from c65f01d to da5523a (26 revisions) (flutter/packages#9903) 2025-08-28 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump androidx.test.espresso:espresso-core from 3.6.1 to 3.7.0 in /packages/local_auth/local_auth_android/android (flutter/packages#9916) 2025-08-28 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump androidx.test.espresso:espresso-core from 3.6.1 to 3.7.0 in /packages/google_maps_flutter/google_maps_flutter_android/android (flutter/packages#9915) 2025-08-28 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump androidx.test.espresso:espresso-core from 3.6.1 to 3.7.0 in /packages/in_app_purchase/in_app_purchase_android/android (flutter/packages#9914) 2025-08-27 [email protected] [google_fonts] Initial import (flutter/packages#9895) 2025-08-27 [email protected] [camera_android_camerax] Support NV21 (flutter/packages#9853) 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
Implements NV21 support for image streaming.
Also bumps the CameraX version to
1.5.0-rc01! To do this, I needed to (1) bump the minimum SDK version to 23 and (2) modify a couple of unrelated tests.Fixes flutter/flutter#145961.
Pre-Review Checklist
[shared_preferences]pubspec.yamlwith 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.mdto 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.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.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