-
Notifications
You must be signed in to change notification settings - Fork 239
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
iOS crash due to recording sampleRate != device's supported sampleRate #109
Comments
Thank you for the detailed report very helpful. I'll check out those links and see what I can do. I have seen posts about the sample rate problem and it seemed likely that the plugin was susceptible to it but I hadn't yet had any reports in the wild so I was being hopeful. |
@sowens-csd if this helps in any way I did the implementation of Google Streaming Speech API in both Kotlin and Swift and it worked very well (but the issue was Google Speech API is too expensive for my project).
|
This didn't make it into 2.3.0 but I'll try to get it into a patch release. |
@sowens-csd I tried a few fixes to set
Any results on your side? |
tried this solution too and it didn't make the things OK. As a result, the 1st listening is successful and any subsequent doesn't return any result.
|
If you have time could you try this experimental fix? The version on main right now has some new code to uninitialize the audio unit which, according to some threads, may address this issue. If this doesn't work I'll add a sample rate parameter to the initialization but it would be nice if we didn't need more parameterization. |
I tried out the |
Thanks for trying! I'll add the sample rate as an option to the initialize for now. |
The latest version on main now supports a I'll also continue to try to find the right way to reliably avoid the sample rate crash. This still seems like a workaround that shouldn't be required. |
2.4.0 is now available with this change. I'm going to leave this issue open while I look for a more permanent solution. |
I believe this issue was fixed as of 4.2.0 with a change to the way the sample rate is established for new sessions. Closing this, please open new issues if anyone sees it again. |
At first, thank you so much for this nice plugin. It works great on Android and is well documented.
There is a corner case that makes SR fail on some older iOS devices due to not correctly set sampleRate.
Reproducible on:
Not reproducible on:
Issue
Fatal Exception: com.apple.coreaudio.avfaudio required condition is false: format.sampleRate == hwFormat.sampleRate
Fatal Exception: com.apple.coreaudio.avfaudio
0 CoreFoundation 0x1c1243180 __exceptionPreprocess
1 libobjc.A.dylib 0x1c041b9f8 objc_exception_throw
2 CoreFoundation 0x1c115c88c +[_CFXNotificationTokenRegistration keyCallbacks]
3 AVFAudio 0x1c70b8244 AVAE_RaiseException(NSString*, ...)
4 AVFAudio 0x1c70b787c _AVAE_Check(char const*, int, char const*, char const*, bool)
5 AVFAudio 0x1c7158224 AVAudioIONodeImpl::SetOutputFormat(unsigned long, AVAudioFormat*)
6 AVFAudio 0x1c710e39c AUGraphNodeBaseV3::CreateRecordingTap(unsigned long, unsigned int, AVAudioFormat*, void (AVAudioPCMBuffer*, AVAudioTime*) block_pointer)
7 AVFAudio 0x1c70eae70 AVAudioEngineGraph::InstallTapOnNode(AVAudioNode*, unsigned long, unsigned int, AVAudioFormat*, void (AVAudioPCMBuffer*, AVAudioTime*) block_pointer)
8 AVFAudio 0x1c716391c AVAudioEngineImpl::InstallTapOnNode(AVAudioNode*, unsigned long, unsigned int, AVAudioFormat*, void (AVAudioPCMBuffer*, AVAudioTime*) block_pointer)
9 AVFAudio 0x1c7152be8 -[AVAudioNode installTapOnBus:bufferSize:format:block:]
10 speech_to_text 0x101f0f1d4 (Missing)
11 speech_to_text 0x101f0d7b4 (Missing)
12 speech_to_text 0x101f0db74 (Missing)
13 Flutter 0x100d6ef40 (Missing)
14 Flutter 0x100d08db0 (Missing)
15 Flutter 0x100d5f4c0 (Missing)
16 Flutter 0x100d18c90 (Missing)
17 Flutter 0x100d1a908 (Missing)
18 CoreFoundation 0x1c11d5554 CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION
19 CoreFoundation 0x1c11d5284 __CFRunLoopDoTimer
20 CoreFoundation 0x1c11d4ab8 __CFRunLoopDoTimers
21 CoreFoundation 0x1c11cfa08 __CFRunLoopRun
22 CoreFoundation 0x1c11cefb4 CFRunLoopRunSpecific
23 GraphicsServices 0x1c33d079c GSEventRunModal
24 UIKitCore 0x1ed876c38 UIApplicationMain
25 Runner 0x1007bc290 main + 22 (AppDelegate.swift:22)
26 libdyld.dylib 0x1c0c928e0 start
My analysis result
Possible solutions
Source of info
PS: I'd very much appreciate a fix in the upcoming 2.3.0 version!
The text was updated successfully, but these errors were encountered: