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 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 // If we're initialized, we must have an audio unit. | 695 // If we're initialized, we must have an audio unit. |
696 RTC_DCHECK(audio_unit_); | 696 RTC_DCHECK(audio_unit_); |
697 | 697 |
698 bool should_initialize_audio_unit = false; | 698 bool should_initialize_audio_unit = false; |
699 bool should_uninitialize_audio_unit = false; | 699 bool should_uninitialize_audio_unit = false; |
700 bool should_start_audio_unit = false; | 700 bool should_start_audio_unit = false; |
701 bool should_stop_audio_unit = false; | 701 bool should_stop_audio_unit = false; |
702 | 702 |
703 switch (audio_unit_->GetState()) { | 703 switch (audio_unit_->GetState()) { |
704 case VoiceProcessingAudioUnit::kInitRequired: | 704 case VoiceProcessingAudioUnit::kInitRequired: |
| 705 RTCLog(@"VPAU state: InitRequired"); |
705 RTC_NOTREACHED(); | 706 RTC_NOTREACHED(); |
706 break; | 707 break; |
707 case VoiceProcessingAudioUnit::kUninitialized: | 708 case VoiceProcessingAudioUnit::kUninitialized: |
| 709 RTCLog(@"VPAU state: Uninitialized"); |
708 should_initialize_audio_unit = can_play_or_record; | 710 should_initialize_audio_unit = can_play_or_record; |
709 should_start_audio_unit = should_initialize_audio_unit && | 711 should_start_audio_unit = should_initialize_audio_unit && |
710 (playing_ || recording_); | 712 (playing_ || recording_); |
711 break; | 713 break; |
712 case VoiceProcessingAudioUnit::kInitialized: | 714 case VoiceProcessingAudioUnit::kInitialized: |
| 715 RTCLog(@"VPAU state: Initialized"); |
713 should_start_audio_unit = | 716 should_start_audio_unit = |
714 can_play_or_record && (playing_ || recording_); | 717 can_play_or_record && (playing_ || recording_); |
715 should_uninitialize_audio_unit = !can_play_or_record; | 718 should_uninitialize_audio_unit = !can_play_or_record; |
716 break; | 719 break; |
717 case VoiceProcessingAudioUnit::kStarted: | 720 case VoiceProcessingAudioUnit::kStarted: |
| 721 RTCLog(@"VPAU state: Started"); |
718 RTC_DCHECK(playing_ || recording_); | 722 RTC_DCHECK(playing_ || recording_); |
719 should_stop_audio_unit = !can_play_or_record; | 723 should_stop_audio_unit = !can_play_or_record; |
720 should_uninitialize_audio_unit = should_stop_audio_unit; | 724 should_uninitialize_audio_unit = should_stop_audio_unit; |
721 break; | 725 break; |
722 } | 726 } |
723 | 727 |
724 if (should_initialize_audio_unit) { | 728 if (should_initialize_audio_unit) { |
725 RTCLog(@"Initializing audio unit for UpdateAudioUnit"); | 729 RTCLog(@"Initializing audio unit for UpdateAudioUnit"); |
726 ConfigureAudioSession(); | 730 ConfigureAudioSession(); |
727 SetupAudioBuffersForActiveAudioSession(); | 731 SetupAudioBuffersForActiveAudioSession(); |
728 if (!audio_unit_->Initialize(playout_parameters_.sample_rate())) { | 732 if (!audio_unit_->Initialize(playout_parameters_.sample_rate())) { |
729 RTCLogError(@"Failed to initialize audio unit."); | 733 RTCLogError(@"Failed to initialize audio unit."); |
730 return; | 734 return; |
731 } | 735 } |
732 } | 736 } |
733 | 737 |
734 if (should_start_audio_unit) { | 738 if (should_start_audio_unit) { |
735 RTCLog(@"Starting audio unit for UpdateAudioUnit"); | 739 RTCLog(@"Starting audio unit for UpdateAudioUnit"); |
| 740 // Log session settings before trying to start audio streaming. |
| 741 RTCAudioSession* session = [RTCAudioSession sharedInstance]; |
| 742 RTCLog(@"%@", session); |
736 if (!audio_unit_->Start()) { | 743 if (!audio_unit_->Start()) { |
737 RTCLogError(@"Failed to start audio unit."); | 744 RTCLogError(@"Failed to start audio unit."); |
738 return; | 745 return; |
739 } | 746 } |
740 } | 747 } |
741 | 748 |
742 if (should_stop_audio_unit) { | 749 if (should_stop_audio_unit) { |
743 RTCLog(@"Stopping audio unit for UpdateAudioUnit"); | 750 RTCLog(@"Stopping audio unit for UpdateAudioUnit"); |
744 if (!audio_unit_->Stop()) { | 751 if (!audio_unit_->Stop()) { |
745 RTCLogError(@"Failed to stop audio unit."); | 752 RTCLogError(@"Failed to stop audio unit."); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 | 838 |
832 // All I/O should be stopped or paused prior to deactivating the audio | 839 // All I/O should be stopped or paused prior to deactivating the audio |
833 // session, hence we deactivate as last action. | 840 // session, hence we deactivate as last action. |
834 [session lockForConfiguration]; | 841 [session lockForConfiguration]; |
835 UnconfigureAudioSession(); | 842 UnconfigureAudioSession(); |
836 [session endWebRTCSession:nil]; | 843 [session endWebRTCSession:nil]; |
837 [session unlockForConfiguration]; | 844 [session unlockForConfiguration]; |
838 } | 845 } |
839 | 846 |
840 } // namespace webrtc | 847 } // namespace webrtc |
OLD | NEW |