Skip to content
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

[camera] Crash while recording with camera at ultraHigh resolution preset #69874

Closed
orestesgaolin opened this issue Nov 5, 2020 · 7 comments · Fixed by flutter/packages#6901
Labels
c: crash Stack traces logged to the console c: fatal crash Crashes that terminate the process e: OS-version specific Affects only some versions of the relevant operating system found in release: 1.22 Found to occur in 1.22 has reproducible steps The issue has been confirmed reproducible and is ready to work on p: camera The camera plugin P2 Important issues not at the top of the work list package flutter/packages repository. See also p: labels. platform-ios iOS applications specifically r: fixed Issue is closed as already fixed in a newer version team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team

Comments

@orestesgaolin
Copy link
Contributor

Steps to Reproduce

  1. Run camera plugin example on iPhone 6S running iOS 14.1
  2. Change resolution preset to ultraHigh as shown below
    controller = CameraController(
      cameraDescription,
      ResolutionPreset.ultraHigh,
      enableAudio: enableAudio,
    );
  3. Select back camera and start recording
  4. The app crashes. Following error can be seen in the iOS console:
    14:00:39.537142 0100 Runner *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '*** -[AVAssetWriterInputPixelBufferAdaptor appendPixelBuffer:withPresentationTime:] A pixel buffer cannot be appended when readyForMoreMediaData is NO.' *** First throw call stack: (0x1b1ae1114 0x1c537dcb4 0x1b8ff1a10 0x1b8fef120 0x1b8ff4880 0x104352028 0x1c9f34ff0 0x1c9f34d50 0x1c9ff4248 0x1ca246524 0x1b171a280 0x1b16bf56c 0x1b16d028c 0x1b16c2e70 0x1b16c3a84 0x1b16cd518 0x1f780f5a4 0x1f7812874)

Expected results:

The recording continues just fine without error

Actual results:

Logs
14:00:07.705240 0100	Runner	Initializing connection
14:00:07.705327 0100	Runner	Removing all cached process handles
14:00:07.709995 0100	Runner	Sending handshake request attempt #1 to server
14:00:07.714123 0100	Runner	FBSWorkspace connecting to endpoint : <BSServiceConnectionEndpoint: 0x2803aa4c0; target: com.apple.frontboard.systemappservices; service: com.apple.frontboard.workspace-service>
14:00:07.719775 0100	Runner	FBSWorkspace registering source: <FBSWorkspaceScenesClient: 0x283da9260>
14:00:07.745348 0100	Runner	FBSWorkspace connected to endpoint : <BSServiceConnectionEndpoint: 0x2803aa4c0; target: com.apple.frontboard.systemappservices; service: com.apple.frontboard.workspace-service>
14:00:07.745404 0100	Runner	Added observer for process assertions expiration warning: <_RBSExpirationWarningClient: 0x2816a6d60>
14:00:07.767479 0100	Runner	Registering for test daemon availability notify post.
14:00:07.767605 0100	Runner	Creating connection to com.apple.runningboard
14:00:07.767668 0100	Runner	notify_get_state check indicated test daemon not ready.
14:00:07.973824 0100	Runner	Handshake succeeded
14:00:07.981595 0100	Runner	Identity resolved as application<io.flutter.plugins.cameraExample>
14:00:08.174659 0100	Runner	flutter: Observatory listening on http://127.0.0.1:57798/
14:00:08.553775 0100	Runner	Hang detected: 0.65s (overlaps extended launch)
14:00:08.554024 0100	Runner	Hang detected: 0.65s (always-on hang reporting)
14:00:08.554199 0100	Runner	Hang detected: 0.65s (under capture threshold, reporting to aggd)
14:00:09.812644 0100	Runner	container_system_group_path_for_identifier: success
14:00:09.812732 0100	Runner	Got system group container path from MCM for systemgroup.com.apple.configurationprofiles: /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
14:00:11.780730 0100	Runner	Received configuration update from daemon (initial)
14:00:28.662975 0100	Runner	[CLIoHidInterface] Adding new Device with usage pair {65280, 3}
14:00:28.710613 0100	Runner	[CLIoHidInterface] invalidating hid service refs
14:00:28.710796 0100	Runner	[CLIoHidInterface] Refreshing service refs
14:00:28.710942 0100	Runner	[CLIoHidInterface] Event system client initialized successfully
14:00:28.711282 0100	Runner	[CLIoHidInterface] Checking matching property Built-In = 1 for service ref 0x2824b8120
14:00:28.711375 0100	Runner	[CLIoHidInterface] Service ref with usage pair {65280, 3} is 0x2824b8120
14:00:28.711529 0100	Runner	[CLIoHidInterface] invalidating hid service refs
14:00:28.711709 0100	Runner	[CLIoHidInterface] Refreshing service refs
14:00:28.711898 0100	Runner	[CLIoHidInterface] Checking matching property Built-In = 1 for service ref 0x2824b8120
14:00:28.712002 0100	Runner	[CLIoHidInterface] Service ref with usage pair {65280, 3} is 0x2824b8120
14:00:28.713121 0100	Runner	[CLIoHidInterface] Property for usage pair {65280, 3}: {BatchInterval = 10000} was set successfully
14:00:28.713361 0100	Runner	[CLIoHidInterface] Property for usage pair {65280, 3}: {ReportInterval = 10000} was set successfully
14:00:36.698935 0100	Runner	AudioComponentPluginMgr.mm:792   First wildcard component search: acdc/lpcm/0x00000000
14:00:36.702372 0100	Runner	AudioComponentPluginMgr.mm:961   component registrations changed
14:00:36.708954 0100	Runner	    AVAudioSession_iOS.mm:289   Posting AVAudioSessionRouteChangeNotification. Reason: AVAudioSessionRouteChangeReasonCategoryChange
14:00:39.537142 0100	Runner	*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '*** -[AVAssetWriterInputPixelBufferAdaptor appendPixelBuffer:withPresentationTime:] A pixel buffer cannot be appended when readyForMoreMediaData is NO.'
*** First throw call stack:
(0x1b1ae1114 0x1c537dcb4 0x1b8ff1a10 0x1b8fef120 0x1b8ff4880 0x104352028 0x1c9f34ff0 0x1c9f34d50 0x1c9ff4248 0x1ca246524 0x1b171a280 0x1b16bf56c 0x1b16d028c 0x1b16c2e70 0x1b16c3a84 0x1b16cd518 0x1f780f5a4 0x1f7812874)

[✓] Flutter (Channel stable, 1.22.3, on Mac OS X 10.15.7 19H2, locale pl-PL)
    • Flutter version 1.22.3 at /Users/dominik/fvm/versions/stable
    • Framework revision 8874f21e79 (7 days ago), 2020-10-29 14:14:35 -0700
    • Engine revision a1440ca392
    • Dart version 2.10.3

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/dominik/Library/Android/sdk
    • Platform android-30, build-tools 29.0.2
    • ANDROID_HOME = /Users/dominik/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.1, Build version 12A7403
    • CocoaPods version 1.10.0

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 49.0.2
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.50.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.16.0

[✓] Connected device (1 available)
    • iPhone (Dominik) (mobile) • f96e187ec1f51b6be1830c7965a482dc653765d2 • ios • iOS 14.1
    ! Error: iPhone (Dominik) is busy: Copying cache files from device. Xcode will continue when iPhone (Dominik) is finished. (code -10)

• No issues found!
@darshankawar
Copy link
Member

Issue replicable on latest stable and on 1.22.2 using iphone 6s and OS 14. App crashes when selecting back camera and trying to record.
Works well on Android.

flutter doctor -v
[✓] Flutter (Channel stable, 1.22.2, on Mac OS X 10.15.4 19E2269, locale en-IN)
    • Flutter version 1.22.2 at /Users/dhs/documents/Fluttersdk/flutter
    • Framework revision 84f3d28555 (3 weeks ago), 2020-10-15 16:26:19 -0700
    • Engine revision b8752bbfff
    • Dart version 2.10.2

 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
    • Android SDK at /Users/dhs/Library/Android/sdk
    • Platform android-30, build-tools 30.0.0
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.0.1, Build version 12A7300
    • CocoaPods version 1.9.3

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 46.0.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.50.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.15.1

[✓] Connected device (1 available)
    • Darshan's iphone (mobile) • 21150b119064aecc249dfcfe05e259197461ce23 • ios
      • iOS 14.0

• No issues found!



@darshankawar darshankawar added found in release: 1.22 Found to occur in 1.22 has reproducible steps The issue has been confirmed reproducible and is ready to work on p: camera The camera plugin p: first party c: crash Stack traces logged to the console c: fatal crash Crashes that terminate the process platform-ios iOS applications specifically labels Nov 5, 2020
@TahaTesser TahaTesser added the e: OS-version specific Affects only some versions of the relevant operating system label Nov 11, 2020
@jmagman
Copy link
Member

jmagman commented Nov 11, 2020

\cc @bparrishMines

@hellohuanlin
Copy link
Contributor

hellohuanlin commented Dec 28, 2021

I had the same crash when playing around with camera plugin.

From the doc:

If readyForMoreMediaData becomes NO for a real-time source, the client may need to drop samples or consider reducing the data rate of appended samples.

I think for now we should just drop the sample, but in the future we should consider reducing the data rate after receiving system pressure (by monitoring systemPressureState).

@darshankawar
Copy link
Member

Verified this issue by running the plugin example on latest master version with iPhone 6s (OS 15.3.1) and recorded using back camera which worked properly without throwing any error. The console log I get is below while recording:

console log

Running pod install...                                           1,491ms
Running Xcode build...                                                  
 └─Compiling, linking and signing...                         5.3s
Xcode build done.                                           28.0s
[VERBOSE-2:FlutterDartVMServicePublisher.mm(147)] Could not register as server for FlutterDartVMServicePublisher, permission denied. Check your 'Local Network' permissions for this app in the Privacy section of the system Settings.
Installing and launching...                                        28.6s
[VERBOSE-2:FlutterDartVMServicePublisher.mm(147)] Could not register as server for FlutterDartVMServicePublisher, permission denied. Check your 'Local Network' permissions for this app in the Privacy section of the system Settings.
Syncing files to device Darshan's iphone...                        173ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

A Dart VM Service on Darshan's iphone is available at: http://127.0.0.1:56661/qOsJXYZ6P0Q=/
fopen failed for data file: errno = 2 (No such file or directory)
Errors found! Invalidating cache...
The Flutter DevTools debugger and profiler on Darshan's iphone is available at: http://127.0.0.1:9102?uri=http://127.0.0.1:56661/qOsJXYZ6P0Q=/
fopen failed for data file: errno = 2 (No such file or directory)
Errors found! Invalidating cache...
The selected imageFormatGroup is not supported by iOS. Defaulting to brga8888
[ServicesDaemonManager] interruptionHandler is called. -[FontServicesDaemonManager connection]_block_invoke
The selected imageFormatGroup is not supported by iOS. Defaulting to brga8888
The selected imageFormatGroup is not supported by iOS. Defaulting to brga8888

Application finished.
dhs@Dhss-MacBook-Pro example % 

Channel master, 3.9.0-7.0.pre.32, on macOS 12.2.1 21D62 darwin-x64, locale en-GB)

@orestesgaolin Although I didn't verify this on OS 14 on which this issue was originally reported, is there a way for you to verify the same using latest plugin version and framework version to see if the crash still persist at your end ?

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Mar 15, 2023
@github-actions
Copy link

github-actions bot commented Apr 5, 2023

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now.
If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones.
Thanks for your contribution.

@github-actions github-actions bot closed this as completed Apr 5, 2023
iOS Platform - first party plugin and package review automation moved this from Awaiting triage to Engineer reviewed Apr 5, 2023
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 19, 2023
@flutter-triage-bot flutter-triage-bot bot added the package flutter/packages repository. See also p: labels. label Jul 5, 2023
@flutter flutter unlocked this conversation May 13, 2024
@hellohuanlin hellohuanlin reopened this May 13, 2024
iOS Platform - first party plugin and package review automation moved this from Engineer reviewed to Awaiting triage May 13, 2024
@darshankawar darshankawar added team-ios Owned by iOS platform team and removed waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds labels May 13, 2024
@cbracken cbracken added the triaged-ios Triaged by iOS platform team label May 22, 2024
iOS Platform - first party plugin and package review automation moved this from Awaiting triage to Engineer reviewed Jul 17, 2024
@darshankawar darshankawar added the r: fixed Issue is closed as already fixed in a newer version label Jul 18, 2024
Copy link

github-actions bot commented Aug 1, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: crash Stack traces logged to the console c: fatal crash Crashes that terminate the process e: OS-version specific Affects only some versions of the relevant operating system found in release: 1.22 Found to occur in 1.22 has reproducible steps The issue has been confirmed reproducible and is ready to work on p: camera The camera plugin P2 Important issues not at the top of the work list package flutter/packages repository. See also p: labels. platform-ios iOS applications specifically r: fixed Issue is closed as already fixed in a newer version team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team
Projects
7 participants