From 848177551c24d826a39e850406c1e11e7f5a243d Mon Sep 17 00:00:00 2001 From: AG Liber Date: Tue, 16 Feb 2021 22:15:46 -0800 Subject: [PATCH] fix(iOS): prevent crash with headset/bluetooth (#294) --- ios/Voice/Voice.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Voice/Voice.m b/ios/Voice/Voice.m index 780dec8a..0fc2af69 100644 --- a/ios/Voice/Voice.m +++ b/ios/Voice/Voice.m @@ -224,7 +224,7 @@ - (void) setupAndStartRecognizing:(NSString*)localeStr { [mixer installTapOnBus:0 bufferSize:1024 format:recordingFormat block:^(AVAudioPCMBuffer * _Nonnull buffer, AVAudioTime * _Nonnull when) { //Volume Level Metering //Buffer frame can be reduced, if you need more output values - [buffer setFrameLength:4096]; + [buffer setFrameLength: buffer.frameCapacity]; UInt32 inNumberFrames = buffer.frameLength; float LEVEL_LOWPASS_TRIG = 0.5; if(buffer.format.channelCount>0)