音频单元subType为kAudioUnitSubType_VoiceProcessingIO,使用kAudioOutputUnitProperty_CurrentDevice为音频单元设置设备ID
OSStatus result = AudioOutputUnitStop(audio_unit);
result = AudioUnitUninitialize(audio_unit);
result = AudioComponentInstanceDispose(audio_unit);线程跟踪:
3 ExceptionHandling 0x00007fff3c64ef31 -[NSExceptionHandler _handleException:mask:] + 364
4 ExceptionHandling 0x00007fff3c64ecac NSExceptionHandlerUncaughtSignalHandler + 35
5 libsystem_platform.dylib 0x00007fff204d3d7d _sigtramp + 29
6 CoreFoundation 0x00007fff2050f381 CFStringGetLength + 11
7 CoreFoundation 0x00007fff205225c7 CFStringCompare + 24
8 CoreAudio 0x00007fff221e83f5 _ZN9HALDevice4DuckEfPK14AudioTimeStampf + 921
9 CoreAudio 0x00007fff21d3ed48 AudioDeviceDuck + 843
10 AudioDSP 0x00000001390d7d4a _Z14DuckOtherAudiojff + 51
11 AudioDSP 0x0000000139213e06 _ZN16AUVoiceProcessor22DestroyAggregateDeviceEv + 974
12 AudioDSP 0x0000000139215459 _ZN16AUVoiceProcessorD2Ev + 417
13 AudioDSP 0x00000001392efdec _ZN13ComponentBase8AP_CloseEPv + 30
14 AudioToolboxCore 0x00007fff219e4b6a AudioComponentInstanceDispose + 55发布于 2021-04-28 11:20:41
您正在处理一个音频实例,然后将其停止。
请注意,AudioOutputUnitStop可能不会立即停止音频单元,因为音频线程异步运行。如果您在停止音频单元后延迟半秒,那么其他线程很可能会在那时停止,然后您可以更安全地处理它的资源。
https://stackoverflow.com/questions/67260345
复制相似问题