Repository: flutter
Issue: Video Record Failed on some Devices when set >=veryHigh. The ResolutionPreset is not auto-downgrade to a proper one
Labels: e: device-specific,platform-android,p: camera,package,P2,team-android,triaged-android

Looks like old issue but still appear.
I set ResolutionPreset.veryHigh. The takePicture() is working fine but RecordVideo() is "freeze". I'm using the latest version 0.10.0. It can be reproduced easily with example code (https://github.com/flutter/plugins/tree/main/packages/camera/camera). And just like a lot of discussions mentioned the ResolutionPreset.medium may make it work, me too. I set high and medium, they both works. From LogCat, I found a message "Surface with size (w=1920, h=1080) and format 0x1 is not valid, size not in valid set: [1440x1080, 1280x960, 1088x1088, 1280x720, 960x540, 720x480, 640x480, 352x288, 320x240, 176x144]". Looks like the setting "veryHigh" is asking 1920x1080, it's out of what the camera supportable resolution then failed. In "resolution_preset.dart", that said "If a preset is not available on the camera being used a preset of lower quality will be selected automatically.", but not really happen. It's just generating failure. Could team review again whether the "automatic selection" can really work to resolve it? Thanks!


**[Device] Oppo A79
[OS] Android 7.1.1
[Code] Camera 0.10.0 example (https://github.com/flutter/plugins/tree/main/packages/camera/camera)
[Camera] Both front and back camera failed
[Symptom] Freeze when startRecordVideo(). If do stopRecordVideo(), the file size is 0 byte.
[Pass] ResolutionPreset.high, ResolutionPreset.medium, ResolutionPreset.low
[Fail] ResolutionPreset.veryHigh, ResolutionPreset.ultraHigh, ResolutionPreset.max**


My flutter doctor:
C:\src\flutter\bin\flutter.bat doctor --verbose
Flutter assets will be downloaded from https://storage.flutter-io.cn/. Make sure you trust this source!
[√] Flutter (Channel stable, 2.10.3, on Microsoft Windows [Version 10.0.22000.739], locale zh-TW)
• Flutter version 2.10.3 at C:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7e9793dee1 (5 months ago), 2022-03-02 11:23:12 -0600
• Engine revision bd539267b4
• Dart version 2.16.1
• DevTools version 2.9.2
• Pub download mirror https://pub.flutter-io.cn/
• Flutter download mirror https://storage.flutter-io.cn/

[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at C:\Users\Jemmy_Wu\AppData\Local\Android\Sdk
• Platform android-33, build-tools 31.0.0
• ANDROID_HOME = C:\Users\Jemmy_Wu\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
• All Android licenses accepted.

[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.10.0)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.10.31321.278
• Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2021.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)

[√] Connected device (4 available)
• OPPO A79 (mobile) • S4NZ9L7HWG6SSC8P • android-arm64 • Android 7.1.1 (API 25)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22000.739]
• Chrome (web) • chrome • web-javascript • Google Chrome 103.0.5060.66
• Edge (web) • edge • web-javascript • Microsoft Edge 103.0.1264.62

[√] HTTP Host Availability
• All required HTTP hosts are available

• No issues found!
Process finished with exit code 0