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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 } | 268 } |
269 | 269 |
270 if (source_params_.Equals(params)) | 270 if (source_params_.Equals(params)) |
271 return; | 271 return; |
272 | 272 |
273 // Reset the |source_params_|, |sink_params_| and |loopback_fifo_| to match | 273 // Reset the |source_params_|, |sink_params_| and |loopback_fifo_| to match |
274 // the new format. | 274 // the new format. |
275 | 275 |
276 source_params_ = params; | 276 source_params_ = params; |
277 | 277 |
278 sink_params_ = media::AudioParameters(source_params_.format(), | 278 sink_params_ = media::AudioParameters( |
279 source_params_.channel_layout(), source_params_.sample_rate(), | 279 source_params_.format(), source_params_.channel_layout(), |
280 source_params_.bits_per_sample(), | 280 source_params_.sample_rate(), source_params_.bits_per_sample(), |
281 WebRtcAudioRenderer::GetOptimalBufferSize(source_params_.sample_rate(), | 281 WebRtcAudioRenderer::GetOptimalBufferSize(source_params_.sample_rate(), |
282 frames_per_buffer_), | 282 frames_per_buffer_), |
| 283 std::vector<media::Point>(), |
283 // If DUCKING is enabled on the source, it needs to be enabled on the | 284 // If DUCKING is enabled on the source, it needs to be enabled on the |
284 // sink as well. | 285 // sink as well. |
285 source_params_.effects() | implicit_ducking_effect); | 286 source_params_.effects() | implicit_ducking_effect); |
286 | 287 |
287 { | 288 { |
288 // Note: The max buffer is fairly large, but will rarely be used. | 289 // Note: The max buffer is fairly large, but will rarely be used. |
289 // Cast needs the buffer to hold at least one second of audio. | 290 // Cast needs the buffer to hold at least one second of audio. |
290 // The clock accuracy is set to 20ms because clock accuracy is | 291 // The clock accuracy is set to 20ms because clock accuracy is |
291 // ~15ms on windows. | 292 // ~15ms on windows. |
292 media::AudioShifter* const new_shifter = new media::AudioShifter( | 293 media::AudioShifter* const new_shifter = new media::AudioShifter( |
(...skipping 15 matching lines...) Expand all Loading... |
308 if (sink_started_) { | 309 if (sink_started_) { |
309 sink_->Stop(); | 310 sink_->Stop(); |
310 sink_started_ = false; | 311 sink_started_ = false; |
311 } | 312 } |
312 | 313 |
313 sink_ = AudioDeviceFactory::NewOutputDevice(source_render_frame_id_); | 314 sink_ = AudioDeviceFactory::NewOutputDevice(source_render_frame_id_); |
314 MaybeStartSink(); | 315 MaybeStartSink(); |
315 } | 316 } |
316 | 317 |
317 } // namespace content | 318 } // namespace content |
OLD | NEW |