carp-dk / carp-dk/carp.sensing-flutter
[carp_audio_package] error in iOS when app in background
- Dominant language
- Dart
- Stars
- 84
- Forks
- 31
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 6
Description
I get an error when I use `AudioSamplingPackage.NOISE` from `carp_audio_package 0.30.1` in my sampling scheme.
The app runs fine when in foreground. When the app is in background, I get the following error after a while:
```
flutter: [CAMS DEBUG] Writing data point to file - type: dk.cachet.carp.activity
[aurioc] AURemoteIO.cpp:1600:Start: AUIOClient_StartIO failed (561145187)
[avae] AVAEInternal.h:109 [AVAudioEngineGraph.mm:1545:Start: (err = PerformCommand(*ioNode, kAUStartIO, NULL, 0)): error 561145187
audio_streamer/SwiftAudioStreamerPlugin.swift:82: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=com.apple.coreaudio.avfaudio Code=561145187 "(null)" UserInfo={failed call=err = PerformCommand(*ioNode, kAUStartIO, NULL, 0)}
audio_streamer/SwiftAudioStreamerPlugin.swift:82: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=com.apple.coreaudio.avfaudio Code=561145187 "(null)" UserInfo={failed call=err = PerformCommand(*ioNode, kAUStartIO, NULL, 0)}
* thread #1, queue = 'com.apple.main-thread', stop reason = Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=com.apple.coreaudio.avfaudio Code=561145187 "(null)" UserInfo={failed call=err = PerformCommand(*ioNode, kAUStartIO, NULL, 0)}
frame #0: 0x000000019ca0eeac libswiftCore.dylib`_swift_runtime_on_report
libswiftCore.dylib`_swift_runtime_on_report:
-> 0x19ca0eeac <+0>: ret
libswiftCore.dylib`_swift_reportToDebugger:
0x19ca0eeb0 <+0>: b 0x19ca0eeac ; _swift_runtime_on_report
libswiftCore.dylib`_swift_shouldReportFatalErrorsToDebugger:
0x19ca0eeb4 <+0>: adrp x8, 337468
0x19ca0eeb8 <+4>: ldrb w0, [x8, #0x299]
```
After this error, the app stops. When I only use other CARP packages (e.g. from `context`, `device` and `sensor`), the app keeps working, also in background.
I added everything to plist that should be there according to `carp_audio_package`.
Thank you for your help!
flutter doctor -v
```
[✓] Flutter (Channel stable, 2.2.1, on macOS 11.5.2 20G95 darwin-x64, locale en-BE)
• Flutter version 2.2.1 at /Users/app/flutter
• Framework revision 02c026b03c (4 months ago), 2021-05-27 12:24:44 -0700
• Engine revision 0fdb562ac8
• Dart version 2.13.1
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/merijnmestdagh/Library/Android/sdk
• Platform android-30, build-tools 29.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5.1, Build version 12E507
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.2)
• Android Studio at /Applications/Android Studio.app/Contents
• 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.8+10-b944.6916264)
[✓] Connected device (2 available)
• Merijn’s iPhone (mobile) • 00008020-0009601E1199002E • ios • iOS 14.8
• Chrome (web) • chrome • web-javascript • Google Chrome 93.0.4577.82
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the failure with AudioSamplingPackage.NOISE while the iOS app is in the background, using the reported Flutter and Xcode versions as context. Inspect SwiftAudioStreamerPlugin.swift at line 82 and trace the background audio start that produces the shown Core Audio error. Done means the app no longer stops when background sampling starts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, ios, swift
- Domain
- audio-video-rtc, mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100