From f6feec3090bd8154e0ad21036812b6d89ec41adb Mon Sep 17 00:00:00 2001 From: chenliming Date: Thu, 17 Nov 2016 10:26:56 +0800 Subject: [PATCH] fix audioCapture crash --- LFLiveKit/capture/LFAudioCapture.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LFLiveKit/capture/LFAudioCapture.m b/LFLiveKit/capture/LFAudioCapture.m index a60f095c..bb565fa4 100755 --- a/LFLiveKit/capture/LFAudioCapture.m +++ b/LFLiveKit/capture/LFAudioCapture.m @@ -98,7 +98,7 @@ - (instancetype)initWithAudioConfiguration:(LFLiveAudioConfiguration *)configura - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; - dispatch_async(self.taskQueue, ^{ + dispatch_sync(self.taskQueue, ^{ if (self.componetInstance) { self.isRunning = NO; AudioOutputUnitStop(self.componetInstance); @@ -121,7 +121,7 @@ - (void)setRunning:(BOOL)running { AudioOutputUnitStart(self.componetInstance); }); } else { - dispatch_async(self.taskQueue, ^{ + dispatch_sync(self.taskQueue, ^{ self.isRunning = NO; NSLog(@"MicrophoneSource: stopRunning"); AudioOutputUnitStop(self.componetInstance); @@ -182,7 +182,7 @@ - (void)handleInterruption:(NSNotification *)notification { reason = [[[notification userInfo] objectForKey:AVAudioSessionInterruptionTypeKey] integerValue]; if (reason == AVAudioSessionInterruptionTypeBegan) { if (self.isRunning) { - dispatch_async(self.taskQueue, ^{ + dispatch_sync(self.taskQueue, ^{ NSLog(@"MicrophoneSource: stopRunning"); AudioOutputUnitStop(self.componetInstance); });