Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 744 } | 744 } |
| 745 } | 745 } |
| 746 | 746 |
| 747 if (should_uninitialize_audio_unit) { | 747 if (should_uninitialize_audio_unit) { |
| 748 RTCLog(@"Uninitializing audio unit for UpdateAudioUnit"); | 748 RTCLog(@"Uninitializing audio unit for UpdateAudioUnit"); |
| 749 audio_unit_->Uninitialize(); | 749 audio_unit_->Uninitialize(); |
| 750 UnconfigureAudioSession(); | 750 UnconfigureAudioSession(); |
| 751 } | 751 } |
| 752 } | 752 } |
| 753 | 753 |
| 754 void AudioDeviceIOS::ConfigureAudioSession() { | 754 bool AudioDeviceIOS::ConfigureAudioSession() { |
| 755 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 755 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 756 RTCLog(@"Configuring audio session."); | 756 RTCLog(@"Configuring audio session."); |
| 757 if (has_configured_session_) { | 757 if (has_configured_session_) { |
| 758 RTCLogWarning(@"Audio session already configured."); | 758 RTCLogWarning(@"Audio session already configured."); |
| 759 return; | 759 return false; |
| 760 } | 760 } |
| 761 RTCAudioSession* session = [RTCAudioSession sharedInstance]; | 761 RTCAudioSession* session = [RTCAudioSession sharedInstance]; |
| 762 [session lockForConfiguration]; | 762 [session lockForConfiguration]; |
| 763 [session configureWebRTCSession:nil]; | 763 bool success = [session configureWebRTCSession:nil]; |
| 764 [session unlockForConfiguration]; | 764 [session unlockForConfiguration]; |
| 765 has_configured_session_ = true; | 765 if (success) { |
|
tkchin_webrtc
2017/04/21 20:36:11
nit: can just set to has_configured_session_ above
| |
| 766 RTCLog(@"Configured audio session."); | 766 has_configured_session_ = true; |
| 767 RTCLog(@"Configured audio session."); | |
| 768 } else { | |
| 769 RTCLog(@"Failed to configure audio session."); | |
| 770 } | |
| 771 return success; | |
| 767 } | 772 } |
| 768 | 773 |
| 769 void AudioDeviceIOS::UnconfigureAudioSession() { | 774 void AudioDeviceIOS::UnconfigureAudioSession() { |
| 770 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 775 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 771 RTCLog(@"Unconfiguring audio session."); | 776 RTCLog(@"Unconfiguring audio session."); |
| 772 if (!has_configured_session_) { | 777 if (!has_configured_session_) { |
| 773 RTCLogWarning(@"Audio session already unconfigured."); | 778 RTCLogWarning(@"Audio session already unconfigured."); |
| 774 return; | 779 return; |
| 775 } | 780 } |
| 776 RTCAudioSession* session = [RTCAudioSession sharedInstance]; | 781 RTCAudioSession* session = [RTCAudioSession sharedInstance]; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 831 | 836 |
| 832 // All I/O should be stopped or paused prior to deactivating the audio | 837 // All I/O should be stopped or paused prior to deactivating the audio |
| 833 // session, hence we deactivate as last action. | 838 // session, hence we deactivate as last action. |
| 834 [session lockForConfiguration]; | 839 [session lockForConfiguration]; |
| 835 UnconfigureAudioSession(); | 840 UnconfigureAudioSession(); |
| 836 [session endWebRTCSession:nil]; | 841 [session endWebRTCSession:nil]; |
| 837 [session unlockForConfiguration]; | 842 [session unlockForConfiguration]; |
| 838 } | 843 } |
| 839 | 844 |
| 840 } // namespace webrtc | 845 } // namespace webrtc |
| OLD | NEW |