Canardoux / flutter_sound

Flutter plugin for sound. Audio recorder and player.
Mozilla Public License 2.0
849 stars 553 forks source link

[BUG]:'The Audio Session is not in a correct state to do Recording.' #1020

Open Larpoux opened 3 months ago

Larpoux commented 3 months ago

Flutter Sound Version :

9.3.8


Severity


Platforms you faced the error


Describe the bug when I call :

     AVAudioInputNode* inputNode = [engine inputNode];
     AVAudioFormat* inputFormat = [inputNode outputFormatForBus: 0];
     double sRate = [inputFormat sampleRate];
     AVAudioChannelLayout* layout = [inputFormat channelLayout];

Sometimes I get "sRate is 0" which is not correct and layout == nil

To Reproduce Steps to reproduce the behavior:

  1. Start the Demo Example "Record to Stream"
  2. Hit the "Record" button

Logs!!!!

flutter: ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: │ #0 FlutterSoundRecorder.startRecorder (package:flutter_sound/public/flutter_sound_recorder.dart:587:13) flutter: │ #1 _RecordToStreamExampleState.record (package:example/recordToStream/record_to_stream_example.dart:139:23) flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ flutter: │ 🐛 FS:---> startRecorder flutter: └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: │ #0 FlutterSoundRecorder._startRecorder (package:flutter_sound/public/flutter_sound_recorder.dart:611:13) flutter: │ #1 FlutterSoundRecorder.startRecorder. (package:flutter_sound/public/flutter_sound_recorder.dart:589:13) flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ flutter: │ 🐛 FS:---> _startRecorder. flutter: └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── AURemoteIO.cpp:1 162 failed: 18 446 744 073 709 540 765 (enable 1, outf< 2 ch, 0 Hz, Float32, deinterleaved> inf< 2 ch, 0 Hz, Float32, deinterleaved>) Terminating app due to uncaught exception 'Invalid Audio Session state', reason: 'The Audio Session is not in a correct state to do Recording.' First throw call stack: ( 0 CoreFoundation 0x000000018048d8a8 exceptionPreprocess + 172 1 libobjc.A.dylib 0x000000018008409c objc_exception_throw + 56 2 CoreFoundation 0x000000018048d7b8 -[NSException initWithCoder:] + 0 3 Runner 0x000000010428a294 _ZN19AudioRecorderEngineC2E7t_CODECP8NSStringP19NSMutableDictionaryP14FlautoRecorder + 480 4 Runner 0x000000010428af20 _ZN19AudioRecorderEngineC1E7t_CODECP8NSStringP19NSMutableDictionaryP14FlautoRecorder + 108 5 Runner 0x0000000104289398 -[FlautoRecorder startRecorderCodec:toPath:channels:sampleRate:bitRate:] + 836 6 Runner 0x000000010428275c -[FlutterSoundRecorder startRecorder:result:] + 1184 7 Runner 0x0000000104283b20 -[FlutterSoundRecorderManager handleMethodCall:result:] + 1136 8 Flutter 0x00000001090623f0 45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 164 9 Flutter 0x0000000108a94300 _ZN7flutter25PlatformMessageHandlerIos21HandlePlatformMessageENSt3_fl10unique_ptrINS_15PlatformMessageENS1_14default_deleteIS3_EEEE_block_invoke + 108 10 libdispatch.dylib 0x00000001054940f0 _dispatch_call_block_and_release + 24 11 libdispatch.dylib 0x000000010549593c _dispatch_client_callout + 16 12 libdispatch.dylib 0x00000001054a55e4 _dispatch_main_queue_drain + 1228 13 libdispatch.dylib 0x00000001054a5108 _dispatch_main_queue_callback_4CF + 40 14 CoreFoundation 0x00000001803ee1b4 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 12 15 CoreFoundation 0x00000001803e88cc CFRunLoopRun + 1936 16 CoreFoundation 0x00000001803e7d28 CFRunLoopRunSpecific + 572 17 GraphicsServices 0x000000018e7cdbc0 GSEventRunModal + 160 18 UIKitCore 0x00000001852bafdc -[UIApplication _run] + 868 19 UIKitCore 0x00000001852bec54 UIApplicationMain + 124 20 Runner 0x00000001042752b4 main + 100 21 dyld 0x00000001044a1558 start_sim + 20 22 ??? 0x00000001045a20e0 0x0 + 4367982816 23 ??? 0xb06f800000000000 0x0 + 12713521010578554880 ) libc++abi: terminating due to uncaught exception of type NSException

github-actions[bot] commented 3 months ago

This issue is stale because it has been open 365 days with no activity. Leave a comment or this will be closed in 7 days.