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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 Terminate(); | 114 Terminate(); |
115 } | 115 } |
116 | 116 |
117 void AudioDeviceIOS::AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) { | 117 void AudioDeviceIOS::AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) { |
118 LOGI() << "AttachAudioBuffer"; | 118 LOGI() << "AttachAudioBuffer"; |
119 RTC_DCHECK(audioBuffer); | 119 RTC_DCHECK(audioBuffer); |
120 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 120 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
121 audio_device_buffer_ = audioBuffer; | 121 audio_device_buffer_ = audioBuffer; |
122 } | 122 } |
123 | 123 |
124 int32_t AudioDeviceIOS::Init() { | 124 AudioDeviceGeneric::InitStatus AudioDeviceIOS::Init() { |
125 LOGI() << "Init"; | 125 LOGI() << "Init"; |
126 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 126 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
127 if (initialized_) { | 127 if (initialized_) { |
128 return 0; | 128 return InitStatus::OK; |
129 } | 129 } |
130 #if !defined(NDEBUG) | 130 #if !defined(NDEBUG) |
131 LogDeviceInfo(); | 131 LogDeviceInfo(); |
132 #endif | 132 #endif |
133 // Store the preferred sample rate and preferred number of channels already | 133 // Store the preferred sample rate and preferred number of channels already |
134 // here. They have not been set and confirmed yet since configureForWebRTC | 134 // here. They have not been set and confirmed yet since configureForWebRTC |
135 // is not called until audio is about to start. However, it makes sense to | 135 // is not called until audio is about to start. However, it makes sense to |
136 // store the parameters now and then verify at a later stage. | 136 // store the parameters now and then verify at a later stage. |
137 RTCAudioSessionConfiguration* config = | 137 RTCAudioSessionConfiguration* config = |
138 [RTCAudioSessionConfiguration webRTCConfiguration]; | 138 [RTCAudioSessionConfiguration webRTCConfiguration]; |
139 playout_parameters_.reset(config.sampleRate, | 139 playout_parameters_.reset(config.sampleRate, |
140 config.outputNumberOfChannels); | 140 config.outputNumberOfChannels); |
141 record_parameters_.reset(config.sampleRate, | 141 record_parameters_.reset(config.sampleRate, |
142 config.inputNumberOfChannels); | 142 config.inputNumberOfChannels); |
143 // Ensure that the audio device buffer (ADB) knows about the internal audio | 143 // Ensure that the audio device buffer (ADB) knows about the internal audio |
144 // parameters. Note that, even if we are unable to get a mono audio session, | 144 // parameters. Note that, even if we are unable to get a mono audio session, |
145 // we will always tell the I/O audio unit to do a channel format conversion | 145 // we will always tell the I/O audio unit to do a channel format conversion |
146 // to guarantee mono on the "input side" of the audio unit. | 146 // to guarantee mono on the "input side" of the audio unit. |
147 UpdateAudioDeviceBuffer(); | 147 UpdateAudioDeviceBuffer(); |
148 initialized_ = true; | 148 initialized_ = true; |
149 return 0; | 149 return InitStatus::OK; |
150 } | 150 } |
151 | 151 |
152 int32_t AudioDeviceIOS::Terminate() { | 152 int32_t AudioDeviceIOS::Terminate() { |
153 LOGI() << "Terminate"; | 153 LOGI() << "Terminate"; |
154 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 154 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
155 if (!initialized_) { | 155 if (!initialized_) { |
156 return 0; | 156 return 0; |
157 } | 157 } |
158 StopPlayout(); | 158 StopPlayout(); |
159 StopRecording(); | 159 StopRecording(); |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 | 841 |
842 // All I/O should be stopped or paused prior to deactivating the audio | 842 // All I/O should be stopped or paused prior to deactivating the audio |
843 // session, hence we deactivate as last action. | 843 // session, hence we deactivate as last action. |
844 [session lockForConfiguration]; | 844 [session lockForConfiguration]; |
845 UnconfigureAudioSession(); | 845 UnconfigureAudioSession(); |
846 [session endWebRTCSession:nil]; | 846 [session endWebRTCSession:nil]; |
847 [session unlockForConfiguration]; | 847 [session unlockForConfiguration]; |
848 } | 848 } |
849 | 849 |
850 } // namespace webrtc | 850 } // namespace webrtc |
OLD | NEW |