OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/media/webrtc_local_audio_renderer.h" | 5 #include "content/renderer/media/webrtc_local_audio_renderer.h" |
6 | 6 |
7 #include "base/atomicops.h" | 7 #include "base/atomicops.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 156 |
157 // Use the capturing source audio parameters when opening the output audio | 157 // Use the capturing source audio parameters when opening the output audio |
158 // device. Any mismatch will be compensated for by the audio output back-end. | 158 // device. Any mismatch will be compensated for by the audio output back-end. |
159 // Note that the buffer size is modified to make the full-duplex scheme less | 159 // Note that the buffer size is modified to make the full-duplex scheme less |
160 // resource intensive. By doubling the buffer size (compared to the capture | 160 // resource intensive. By doubling the buffer size (compared to the capture |
161 // side), the callback frequency of browser side callbacks will be lower and | 161 // side), the callback frequency of browser side callbacks will be lower and |
162 // tests have shown that it resolves issues with audio glitches for some | 162 // tests have shown that it resolves issues with audio glitches for some |
163 // cases where resampling is needed on the output side. | 163 // cases where resampling is needed on the output side. |
164 // TODO(henrika): verify this scheme on as many different devices and | 164 // TODO(henrika): verify this scheme on as many different devices and |
165 // combinations of sample rates as possible | 165 // combinations of sample rates as possible |
166 media::AudioParameters source_params = source_->audio_parameter(); | 166 media::AudioParameters source_params = source_->audio_parameters(); |
167 media::AudioParameters sink_params(source_params.format(), | 167 media::AudioParameters sink_params(source_params.format(), |
168 source_params.channel_layout(), | 168 source_params.channel_layout(), |
169 source_params.sample_rate(), | 169 source_params.sample_rate(), |
170 source_params.bits_per_sample(), | 170 source_params.bits_per_sample(), |
171 2 * source_params.frames_per_buffer()); | 171 2 * source_params.frames_per_buffer()); |
172 sink_ = AudioDeviceFactory::NewOutputDevice(); | 172 sink_ = AudioDeviceFactory::NewOutputDevice(); |
173 if (CommandLine::ForCurrentProcess()->HasSwitch( | 173 if (CommandLine::ForCurrentProcess()->HasSwitch( |
174 switches::kEnableWebAudioInput)) { | 174 switches::kEnableWebAudioInput)) { |
175 // TODO(henrika): we could utilize the unified audio here instead and do | 175 // TODO(henrika): we could utilize the unified audio here instead and do |
176 // sink_->InitializeIO(sink_params, 2, callback_.get()); | 176 // sink_->InitializeIO(sink_params, 2, callback_.get()); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 DVLOG(1) << "WebRtcLocalAudioRenderer::OnSourceCaptureDeviceStopped()"; | 261 DVLOG(1) << "WebRtcLocalAudioRenderer::OnSourceCaptureDeviceStopped()"; |
262 if (!Started()) | 262 if (!Started()) |
263 return; | 263 return; |
264 | 264 |
265 // The capture device has stopped and we should therefore stop all activity | 265 // The capture device has stopped and we should therefore stop all activity |
266 // as well to save resources. | 266 // as well to save resources. |
267 Stop(); | 267 Stop(); |
268 } | 268 } |
269 | 269 |
270 } // namespace content | 270 } // namespace content |
OLD | NEW |