• 赚钱入口【需求资源】限时招募流量主、渠道主,站长合作;【合作模式】CPS长期分成,一次推广永久有收益。主动打款,不扣量;

iOS14 AVAudioEngine get inputNode property crash

iOS rin, seun 6个月前 (08-02) 499次浏览 0个评论

代码如下

- (void)startAudioEngine {
    NSError *error = nil;
    if (!self.audioEngine.isRunning) {
        self.audioEngine = [[AVAudioEngine alloc] init];
        AVAudioInputNode *inputNode = self.audioEngine.inputNode;
        AVAudioFormat *nativeAudioFormat = [inputNode inputFormatForBus:0];
        __weak typeof(self)weakSelf = self;
        [inputNode installTapOnBus:0 bufferSize:1024 format:nativeAudioFormat block:^(AVAudioPCMBuffer * _Nonnull buffer, AVAudioTime * _Nonnull when) {
            [weakSelf.recognitionRequest appendAudioPCMBuffer:buffer];
        }];
        [self.audioEngine prepare];
        [self.audioEngine startAndReturnError:&error];
        if (error) {
            [self stop];
            [self onError:[NSError errorWithDomain:@"startAudioEngine error" code:0 userInfo:nil]];
        }
        else {
            [self activeStatusChanged:MMSpeechRecognizerActiveStatusStared];
        }
    }
    else {
        [self stop];
        [NSError errorWithDomain:@"The audio engine is runing" code:0 userInfo:nil];
    }
}

iOS 14 在 self.audioEngine.inputNode时crash.

日志如下:

[plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x6000032144c0> F8BB1C28-BAE8-11D6-9C31-00039315CD46
HALB_IOBufferManager_Client::GetIOBuffer: the stream index is out of range
HALB_IOBufferManager_Client::GetIOBuffer: the stream index is out of range
[aqme] 255: AQDefaultDevice (1): output stream 0: null buffer
[aqme] 1778: EXCEPTION thrown (-50): error != 0
 Initialize: Mach message timeout. Apparently deadlocked. Aborting now.
CoreSimulator 725.10 - Device: iPhone 11 (003A9CF3-FDD7-4C44-8607-CAB3FDBB904B) - Runtime: iOS 14.0 (18A5301v) - DeviceType: iPhone 11

解决方法

iOS系统的错误.

这个问题Apple已经修复. 出现在Xcode Version 12.0 beta (12A6159). Version 12.0 beta 2 (12A6163b) 已经修复.

 

 

喜欢 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址