Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: webrtc/modules/audio_device/ios/audio_device_ios.mm

Issue 2079383002: Avoid race when stopping audio unit on iOS (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/modules/audio_device/ios/voice_processing_audio_unit.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 815
816 // Release the lock. 816 // Release the lock.
817 [session unlockForConfiguration]; 817 [session unlockForConfiguration];
818 818
819 return true; 819 return true;
820 } 820 }
821 821
822 void AudioDeviceIOS::ShutdownPlayOrRecord() { 822 void AudioDeviceIOS::ShutdownPlayOrRecord() {
823 LOGI() << "ShutdownPlayOrRecord"; 823 LOGI() << "ShutdownPlayOrRecord";
824 824
825 // Stop the audio unit to prevent any additional audio callbacks.
826 audio_unit_->Stop();
827
825 // Close and delete the voice-processing I/O unit. 828 // Close and delete the voice-processing I/O unit.
826 audio_unit_.reset(); 829 audio_unit_.reset();
827 830
828 // Remove audio session notification observers. 831 // Remove audio session notification observers.
829 RTCAudioSession* session = [RTCAudioSession sharedInstance]; 832 RTCAudioSession* session = [RTCAudioSession sharedInstance];
830 [session removeDelegate:audio_session_observer_]; 833 [session removeDelegate:audio_session_observer_];
831 834
832 // All I/O should be stopped or paused prior to deactivating the audio 835 // All I/O should be stopped or paused prior to deactivating the audio
833 // session, hence we deactivate as last action. 836 // session, hence we deactivate as last action.
834 [session lockForConfiguration]; 837 [session lockForConfiguration];
835 UnconfigureAudioSession(); 838 UnconfigureAudioSession();
836 [session endWebRTCSession:nil]; 839 [session endWebRTCSession:nil];
837 [session unlockForConfiguration]; 840 [session unlockForConfiguration];
838 } 841 }
839 842
840 } // namespace webrtc 843 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/audio_device/ios/voice_processing_audio_unit.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698