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/location.h" | 7 #include "base/location.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 DVLOG(1) << "WebRtcLocalAudioRenderer::ReconfigureSink()"; | 256 DVLOG(1) << "WebRtcLocalAudioRenderer::ReconfigureSink()"; |
257 | 257 |
258 if (source_params_.Equals(params)) | 258 if (source_params_.Equals(params)) |
259 return; | 259 return; |
260 | 260 |
261 // Reset the |source_params_|, |sink_params_| and |loopback_fifo_| to match | 261 // Reset the |source_params_|, |sink_params_| and |loopback_fifo_| to match |
262 // the new format. | 262 // the new format. |
263 | 263 |
264 source_params_ = params; | 264 source_params_ = params; |
265 | 265 |
266 sink_params_ = media::AudioParameters(source_params_.format(), | 266 sink_params_ = media::AudioParameters( |
267 source_params_.channel_layout(), source_params_.sample_rate(), | 267 source_params_.format(), source_params_.channel_layout(), |
268 source_params_.bits_per_sample(), | 268 source_params_.sample_rate(), source_params_.bits_per_sample(), |
269 WebRtcAudioRenderer::GetOptimalBufferSize(source_params_.sample_rate(), | 269 WebRtcAudioRenderer::GetOptimalBufferSize(source_params_.sample_rate(), |
270 frames_per_buffer_), | 270 frames_per_buffer_), |
271 source_params_.effects()); | 271 std::vector<media::Point>(), source_params_.effects()); |
272 | 272 |
273 { | 273 { |
274 // Note: The max buffer is fairly large, but will rarely be used. | 274 // Note: The max buffer is fairly large, but will rarely be used. |
275 // Cast needs the buffer to hold at least one second of audio. | 275 // Cast needs the buffer to hold at least one second of audio. |
276 // The clock accuracy is set to 20ms because clock accuracy is | 276 // The clock accuracy is set to 20ms because clock accuracy is |
277 // ~15ms on windows. | 277 // ~15ms on windows. |
278 media::AudioShifter* const new_shifter = new media::AudioShifter( | 278 media::AudioShifter* const new_shifter = new media::AudioShifter( |
279 base::TimeDelta::FromSeconds(2), | 279 base::TimeDelta::FromSeconds(2), |
280 base::TimeDelta::FromMilliseconds(20), | 280 base::TimeDelta::FromMilliseconds(20), |
281 base::TimeDelta::FromSeconds(20), | 281 base::TimeDelta::FromSeconds(20), |
(...skipping 12 matching lines...) Expand all Loading... |
294 if (sink_started_) { | 294 if (sink_started_) { |
295 sink_->Stop(); | 295 sink_->Stop(); |
296 sink_started_ = false; | 296 sink_started_ = false; |
297 } | 297 } |
298 | 298 |
299 sink_ = AudioDeviceFactory::NewOutputDevice(source_render_frame_id_); | 299 sink_ = AudioDeviceFactory::NewOutputDevice(source_render_frame_id_); |
300 MaybeStartSink(); | 300 MaybeStartSink(); |
301 } | 301 } |
302 | 302 |
303 } // namespace content | 303 } // namespace content |
OLD | NEW |