sherpa-onnx icon indicating copy to clipboard operation
sherpa-onnx copied to clipboard

iOS app is working great on OS 16.2 but crashing for OS 17.3 while launching the app

Open Joisar opened this issue 6 months ago • 7 comments

I had followed exact steps mentioned here: https://k2-fsa.github.io/sherpa/onnx/ios/build-sherpa-onnx-swift.html

Please help to fix for OS 17.3

Thanks

Here is the crash log,

*** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: IsFormatSampleRateAndChannelCountValid(format)' *** First throw call stack: ( 0 CoreFoundation 0x000000010e1f428d __exceptionPreprocess + 242 1 libobjc.A.dylib 0x000000010c5e0894 objc_exception_throw + 48 2 CoreFoundation 0x000000010e1f4097 +[NSException raise:format:] + 0 3 AVFAudio 0x000000010d0668a9 _Z19AVAE_RaiseExceptionP8NSStringz + 156 4 AVFAudio 0x000000010d0c1f24 _ZN17AUGraphNodeBaseV318CreateRecordingTapEmjP13AVAudioFormatU13block_pointerFvP16AVAudioPCMBufferP11AVAudioTimeE + 766 5 AVFAudio 0x000000010d12e9c3 -[AVAudioNode installTapOnBus:bufferSize:format:block:] + 1456 6 SherpaOnnx 0x000000010247d7af $s10SherpaOnnx14ViewControllerC12initRecorderyyF + 1311 7 SherpaOnnx 0x000000010247c958 $s10SherpaOnnx14ViewControllerC11viewDidLoadyyF + 664 8 SherpaOnnx 0x000000010247c9ac $s10SherpaOnnx14ViewControllerC11viewDidLoadyyFTo + 28 9 UIKitCore 0x000000012ba58e39 -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 80 10 UIKitCore 0x000000012ba5ecab -[UIViewController loadViewIfRequired] + 1340 11 UIKitCore 0x000000012ba5f092 -[UIViewController view] + 27 12 UIKitCore 0x000000012c46a901 -[UIWindow addRootViewControllerViewIfPossible] + 330 13 UIKitCore 0x000000012c469f96 -[UIWindow _updateLayerOrderingAndSetLayerHidden:actionBlock:] + 291 14 UIKitCore 0x000000012c46b507 -[UIWindow _setHidden:forced:] + 411 15 UIKitCore 0x000000012c4804cc -[UIWindow _mainQueue_makeKeyAndVisible] + 47 16 UIKitCore Z 0x000000012c76c90a -[UIWindowScene _performDeferredInitialWindowUpdateForConnection] + 236 17 UIKitCore 0x000000012b55223e +[UIScene _sceneForFBSScene:create:withSession:connectionOptions:] + 1639 18 UIKitCore 0x000000012c426b40 -[UIApplication _connectUISceneFromFBSScene:transitionContext:] + 1117 19 UIKitCore 0x000000012c426f0e -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 506 20 UIKitCore 0x000000012bd32f66 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 353 21 FrontBoardServices 0x00000001187506ad -[FBSScene _callOutQueue_didCreateWithTransitionContext:completion:] + 406 22 FrontBoardServices 0x00000001187827bb __92-[FBSWorkspaceScenesClient createSceneWithIdentity:parameters:transitionContext:completion:]_block_invoke.254 + 279 23 FrontBoardServices 0x0000000118760313 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 213 24 FrontBoardServices 0x00000001187824b5 __92-[FBSWorkspaceScenesClient createSceneWithIdentity:parameters:transitionContext:completion:]_block_invoke + 328 25 libdispatch.dylib 0x000000010cfb6d3a _dispatch_client_callout + 8 26 libdispatch.dylib 0x000000010cfba802 _dispatch_block_invoke_direct + 500 27 FrontBoardServices 0x00000001187ade3d FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 30 28 FrontBoardServices 0x00000001187add17 -[FBSMainRunLoopSerialQueue _targetQueue_performNextIfPossible] + 188 29 FrontBoardServices 0x00000001187ade65 -[FBSMainRunLoopSerialQueue _performNextFromRunLoopSource] + 19 30 CoreFoundation 0x000000010e150d0f CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 31 CoreFoundation 0x000000010e150c51 __CFRunLoopDoSource0 + 157 32 C oreFoundation 0x000000010e1504b2 __CFRunLoopDoSources0 + 315 33 CoreFoundation 0x000000010e14ab83 __CFRunLoopRun + 919 34 CoreFoundation 0x000000010e14a409 CFRunLoopRunSpecific + 557 35 GraphicsServices 0x00000001104f9187 GSEventRunModal + 137 36 UIKitCore 0x000000012c4253a2 -[UIApplication _run] + 972 37 UIKitCore 0x000000012c429e10 UIApplicationMain + 123 38 UIKitCore 0x000000012b4d4e03 __swift_destroy_boxed_opaque_existential_1Tm + 12707 39 SherpaOnnx 0x0000000102489bd8 $sSo21UIApplicationDelegateP5UIKitE4mainyyFZ + 104 40 SherpaOnnx 0x0000000102489b67 $s10SherpaOnnx11AppDelegateC5$mainyyFZ + 39 41 SherpaOnnx 0x0000000102489c58 main + 24 42 dyld 0x000000010c4603ee start_sim + 10 43 ??? RF 0x0000000203ffc41f 0x0 + 8657028127 ) libc++abi: terminating due to uncaught exception of type NSException com.k2-fsa.org.SherpaOnnx: 72793

Joisar avatar Jan 28 '24 00:01 Joisar

There is a similar issue at https://stackoverflow.com/questions/74516660/ios-app-crashes-with-required-condition-is-false-isformatsamplerateandchannelc

Could you have a look?

csukuangfj avatar Jan 29 '24 08:01 csukuangfj

@csukuangfj Yes, I had tried that as well before posting here. Unfortunately, it didn't work. It still crashes always on latest OS version.

Joisar avatar Jan 29 '24 10:01 Joisar

same issue on ios 17.0

zj1123581321 avatar Mar 28 '24 05:03 zj1123581321

have you tried the ios-swiftui example?

csukuangfj avatar Mar 28 '24 06:03 csukuangfj

have you tried the ios-swiftui example?

Yes, I get the same error for both ios-swift & ios-swiftui attempts.

Thread 1: "required condition is false: IsFormatSampleRateAndChannelCountValid(format)"

image

zj1123581321 avatar Mar 28 '24 06:03 zj1123581321

By the way, this repo is for sherpa-onnx. Does it work with sherpa-onnx?

csukuangfj avatar Mar 28 '24 06:03 csukuangfj

https://stackoverflow.com/questions/41805381/avaudioengine-inputnode-installtap-crash-when-restarting-recording 貌似是模拟器的问题,缺少麦克风,真机试试吧

sukeyang avatar Apr 28 '24 09:04 sukeyang