-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Conversation
…xed uncaught exception.
Only works on Android since it requires automatic accepting of camera permissions to run.
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
packages/camera/android/src/main/java/io/flutter/plugins/camera/Camera.java
Show resolved
Hide resolved
} | ||
static Size computeBestPreviewSize(String cameraName, ResolutionPreset preset) { | ||
if (preset.ordinal() > ResolutionPreset.high.ordinal()) { | ||
preset = ResolutionPreset.high; |
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 do you set the preset to high 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.
i think it's that high res previews negatively impact performance. The current code in master is setting previewSize to be the absolute minimum resolution that's the correct aspect ratio, and is also capped at 1080 (line 37 in the original patch).
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.
Maybe you could improve to let the choice to the user here. My current use case need a stream at the highest resolution. And without this clamp, the function startPreviewWithImageStream works perfectly.
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.
It would be acceptable to set the default to high
or even medium
. But this change actually cripples the powerful Android devices that default to 1080p video even at 60fps.
packages/camera/example/pubspec.yaml
Outdated
@@ -13,6 +13,9 @@ dependencies: | |||
dev_dependencies: | |||
flutter_test: | |||
sdk: flutter | |||
flutter_driver: | |||
sdk: flutter | |||
test: 1.6.3 |
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.
Is this dependency actually used? I believe you only use flutter_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.
It was extra, removed.
enableFlutterDriverExtension(handler: (_) => completer.future); | ||
|
||
setUpAll(() async { | ||
final Directory extDir = await getApplicationDocumentsDirectory(); |
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.
Wouldn't it be better to use getTemporaryDirectory
so that you wouldn't have to delete them all each time?
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.
getTemporaryDirectory()
still needs to be deleted by us but that does make more sense. Changed.
final bool presetExactlySupported = | ||
await testCaptureImageResolution(controller, preset.key); | ||
assert( | ||
!(!previousPresetExactlySupported && |
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 always true. Did you mean to use 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.
Whoops, yes.
final bool presetExactlySupported = | ||
await testCaptureVideoResolution(controller, preset.key); | ||
assert( | ||
!(!previousPresetExactlySupported && |
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.
Same as above. Always true.
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.
Done.
packages/camera/pubspec.yaml
Outdated
sdk: flutter | ||
flutter_driver: | ||
sdk: flutter | ||
test: 1.6.3 |
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: Is this dependency used?
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.
Fixed.
A Googler has manually verified that the CLAs look good. (Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.) ℹ️ Googlers: Go here for more info. |
Manually verified the CLAs since the author gave permission for these commits to be contributed to the project in the original PR. |
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
A Googler has manually verified that the CLAs look good. (Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.) ℹ️ Googlers: Go here for more info. |
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
This PR is here to address issues in the quality of video recording for the camera plugin on Android, as well as discrepancies in quality level between Android and iOS. It also allows to control the still picture quality (which was so far only maximum quality). The existing resolution presets have been updated to match between Android and iOS, and new presets have been added. There are no breaking changes but the quality of the presets have been adjusted which will result in different picture/video quality on apps using this plugin. We believe this change is necessary as, for the same resolution preset, Android video quality was very poor and the quality on iOS was too high, generating 4k files that are too heavy to upload.
This PR is here to address issues in the quality of video recording for the camera plugin on Android, as well as discrepancies in quality level between Android and iOS. It also allows to control the still picture quality (which was so far only maximum quality). The existing resolution presets have been updated to match between Android and iOS, and new presets have been added. There are no breaking changes but the quality of the presets have been adjusted which will result in different picture/video quality on apps using this plugin. We believe this change is necessary as, for the same resolution preset, Android video quality was very poor and the quality on iOS was too high, generating 4k files that are too heavy to upload.
Description
This continues the work started in #1403 by @quentinleguennec.
Related Issues
#1186
#1107
flutter/flutter#30459
flutter/flutter#29500
flutter/flutter#26959
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?