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 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 // the native audio unit buffer size. Use a reasonable capacity to avoid | 762 // the native audio unit buffer size. Use a reasonable capacity to avoid |
763 // reallocations while audio is played to reduce risk of glitches. | 763 // reallocations while audio is played to reduce risk of glitches. |
764 RTC_DCHECK(audio_device_buffer_); | 764 RTC_DCHECK(audio_device_buffer_); |
765 const size_t capacity_in_bytes = 2 * playout_parameters_.GetBytesPerBuffer(); | 765 const size_t capacity_in_bytes = 2 * playout_parameters_.GetBytesPerBuffer(); |
766 fine_audio_buffer_.reset(new FineAudioBuffer( | 766 fine_audio_buffer_.reset(new FineAudioBuffer( |
767 audio_device_buffer_, playout_parameters_.sample_rate(), capacity_in_bytes
)); | 767 audio_device_buffer_, playout_parameters_.sample_rate(), capacity_in_bytes
)); |
768 } | 768 } |
769 | 769 |
770 bool AudioDeviceIOS::CreateAudioUnit() { | 770 bool AudioDeviceIOS::CreateAudioUnit() { |
771 RTC_DCHECK(!audio_unit_); | 771 RTC_DCHECK(!audio_unit_); |
| 772 RTCLog(@"CreateAudioUnit"); |
772 | 773 |
773 audio_unit_.reset(new VoiceProcessingAudioUnit(this)); | 774 audio_unit_.reset(new VoiceProcessingAudioUnit(this)); |
774 if (!audio_unit_->Init()) { | 775 if (!audio_unit_->Init()) { |
775 audio_unit_.reset(); | 776 audio_unit_.reset(); |
776 return false; | 777 return false; |
777 } | 778 } |
778 | 779 |
779 return true; | 780 return true; |
780 } | 781 } |
781 | 782 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 RTCLogError(@"Failed to begin WebRTC session: %@", | 921 RTCLogError(@"Failed to begin WebRTC session: %@", |
921 error.localizedDescription); | 922 error.localizedDescription); |
922 return false; | 923 return false; |
923 } | 924 } |
924 | 925 |
925 // If we are ready to play or record, initialize the audio unit. | 926 // If we are ready to play or record, initialize the audio unit. |
926 if (session.canPlayOrRecord) { | 927 if (session.canPlayOrRecord) { |
927 ConfigureAudioSession(); | 928 ConfigureAudioSession(); |
928 SetupAudioBuffersForActiveAudioSession(); | 929 SetupAudioBuffersForActiveAudioSession(); |
929 audio_unit_->Initialize(playout_parameters_.sample_rate()); | 930 audio_unit_->Initialize(playout_parameters_.sample_rate()); |
| 931 } else { |
| 932 RTCLogWarning(@"Not ready to start play or record yet."); |
930 } | 933 } |
931 | 934 |
932 // Release the lock. | 935 // Release the lock. |
933 [session unlockForConfiguration]; | 936 [session unlockForConfiguration]; |
934 | 937 |
935 return true; | 938 return true; |
936 } | 939 } |
937 | 940 |
938 void AudioDeviceIOS::ShutdownPlayOrRecord() { | 941 void AudioDeviceIOS::ShutdownPlayOrRecord() { |
939 LOGI() << "ShutdownPlayOrRecord"; | 942 LOGI() << "ShutdownPlayOrRecord"; |
(...skipping 15 matching lines...) Expand all Loading... |
955 | 958 |
956 // All I/O should be stopped or paused prior to deactivating the audio | 959 // All I/O should be stopped or paused prior to deactivating the audio |
957 // session, hence we deactivate as last action. | 960 // session, hence we deactivate as last action. |
958 [session lockForConfiguration]; | 961 [session lockForConfiguration]; |
959 UnconfigureAudioSession(); | 962 UnconfigureAudioSession(); |
960 [session endWebRTCSession:nil]; | 963 [session endWebRTCSession:nil]; |
961 [session unlockForConfiguration]; | 964 [session unlockForConfiguration]; |
962 } | 965 } |
963 | 966 |
964 } // namespace webrtc | 967 } // namespace webrtc |
OLD | NEW |