-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[camerax] Implement resolution configuration #3799
Conversation
/// The camera's resolution has changed. | ||
@override | ||
Stream<CameraResolutionChangedEvent> onCameraResolutionChanged(int cameraId) { | ||
return _cameraEvents(cameraId).whereType<CameraResolutionChangedEvent>(); |
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.
This is the same implementation as camera_android
, and it doesn't seem to be actually used in any of the federated packages.
Will re-open when I pick back up CameraX work. |
packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart
Outdated
Show resolved
Hide resolved
packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart
Outdated
Show resolved
Hide resolved
packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart
Outdated
Show resolved
Hide resolved
@@ -38,7 +38,8 @@ public static class QualitySelectorProxy { | |||
@Nullable FallbackStrategy fallbackStrategy) { | |||
// Convert each index of VideoQualityConstraint to Quality. | |||
List<Quality> qualityList = new ArrayList<Quality>(); | |||
for (Long qualityIndex : videoQualityConstraintIndexList) { | |||
for (int i = 0; i < videoQualityConstraintIndexList.size(); i++) { | |||
int qualityIndex = ((Number) videoQualityConstraintIndexList.get(i)).intValue(); |
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.
What was the issue? Its not clear to me why the previous code would fail - it looks like the logical change here is to go from: calling intValue()
on the Long
, to: casting to a Number
and then using the intValue()
implementation for Number
instead.
But I would expect either of those to work, and if they both did, would prefer the former. Does this only work with the cast to Number
added in?
packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart
Outdated
Show resolved
Hide resolved
packages/camera/camera_android_camerax/example/integration_test/integration_test.dart
Outdated
Show resolved
Hide resolved
packages/camera/camera_android_camerax/example/integration_test/integration_test.dart
Outdated
Show resolved
Hide resolved
final bool presetExactlySupported = assertExpectedDimensions( | ||
presetExpectedSizes[preset.key]!, | ||
Size(image.height.toDouble(), image.width.toDouble())); | ||
expect(!(!previousPresetExactlySupported && presetExactlySupported), |
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.
This expect is checking that (for a specific camera on the device) presetExactlySupported
is either always false or always true (across all resolutions). Is the reason here that it should either always fallback, or always be able to exactly support?
Can you add a comment either way explaining the purpose, as its not immediately clear to me from reading the test
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.
Added a comment and also re-wrote the boolean since it's overcomplicated. By the way, this is the integration test in camera_android
, so I too had to interpret these test cases. My understanding is that if one of the lower resolution presets must fall back, then we wouldn't expect the camera to suddenly be able to reach higher resolutions; that would indicate something is wrong with our logic.
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.
Replaced VideoQualityConstraint
with VideoQuality
/VideoQualityData
to take advantage of pigeon's support for enums + classes.
…camerax.dart Co-authored-by: Gray Mackall <[email protected]>
…camerax.dart Co-authored-by: Gray Mackall <[email protected]>
…camerax.dart Co-authored-by: Gray Mackall <[email protected]>
…camerax.dart Co-authored-by: Gray Mackall <[email protected]>
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!
packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart
Outdated
Show resolved
Hide resolved
videoQuality = VideoQuality.highest; | ||
break; | ||
case null: | ||
// If not preset is specified, default to CameraX's default behavior |
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.
nit: same as above
flutter/packages@22d4754...aaae5ef 2023-09-08 [email protected] [tool] Add Android dependency (gradle) option to update dependencies command (flutter/packages#4757) 2023-09-08 [email protected] [camerax] Implement resolution configuration (flutter/packages#3799) 2023-09-07 [email protected] Manual roll Flutter from 685ce14 to aea4552 (64 revisions) (flutter/packages#4870) 2023-09-07 [email protected] [rfw, ci] Regenerate goldens, manually roll #4835 (flutter/packages#4862) 2023-09-07 49699333+dependabot[bot]@users.noreply.github.com Bump actions/checkout from 3.6.0 to 4.0.0 (flutter/packages#4845) 2023-09-07 [email protected] [video_player] Add optional web options [web] (flutter/packages#4551) 2023-09-07 [email protected] [flutter_markdown] Remove `ignore: avoid_init_to_null` since the package uses Dart 3 (flutter/packages#4852) 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],[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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
* main: (83 commits) go_router_builder: support the latest pkg:analyzer (flutter#4921) Replace collection type lints with more general lint (flutter#4912) Roll Flutter from 219efce to 4e7a07a (30 revisions) (flutter#4910) [camerax] Implement `startVideoCapturing` and `onVideoRecordedEvent` (flutter#4815) [tool] Add a package inclusion filter (flutter#4904) [flutter_markdown] Fix changelog regarding minimum supported SDK version (flutter#4851) [ios_platform_images] Add integration tests (flutter#4899) [image_picker] Copy exif tags in categories II and III (flutter#4738) [google_maps_flutter_android] Fix for testToggleInfoWindow persistently flaky (flutter#4768) Roll Flutter from 7c28e8e to 219efce (16 revisions) (flutter#4901) [url_launcher] migrating iOS tests from objc to swift (flutter#4758) Roll Flutter from da676f7 to 7c28e8e (20 revisions) (flutter#4879) Bump actions/upload-artifact from 3.1.2 to 3.1.3 (flutter#4863) Roll Flutter from aea4552 to da676f7 (28 revisions) (flutter#4874) [webview_flutter_android] Added the functionality to fullscreen html5 video (flutter#3879) [tool] Add Android dependency (gradle) option to update dependencies command (flutter#4757) [camerax] Implement resolution configuration (flutter#3799) Manual roll Flutter from 685ce14 to aea4552 (64 revisions) (flutter#4870) [rfw, ci] Regenerate goldens, manually roll flutter#4835 (flutter#4862) Bump actions/checkout from 3.6.0 to 4.0.0 (flutter#4845) ...
Adds resolution configuration for all camera use cases. Also makes minor updates to related documentation.
Fixes flutter/flutter#120462.
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).