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/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 275 |
276 if (source_params_ == params) | 276 if (source_params_ == params) |
277 return; | 277 return; |
278 | 278 |
279 // Reset the |source_params_|, |sink_params_| and |loopback_fifo_| to match | 279 // Reset the |source_params_|, |sink_params_| and |loopback_fifo_| to match |
280 // the new format. | 280 // the new format. |
281 | 281 |
282 source_params_ = params; | 282 source_params_ = params; |
283 | 283 |
284 sink_params_ = media::AudioParameters(source_params_.format(), | 284 sink_params_ = media::AudioParameters(source_params_.format(), |
285 source_params_.channel_layout(), source_params_.channels(), | 285 source_params_.channel_layout(), source_params_.sample_rate(), |
286 source_params_.input_channels(), source_params_.sample_rate(), | |
287 source_params_.bits_per_sample(), | 286 source_params_.bits_per_sample(), |
288 #if defined(OS_ANDROID) | 287 #if defined(OS_ANDROID) |
289 // On Android, input and output use the same sample rate. In order to | 288 // On Android, input and output use the same sample rate. In order to |
290 // use the low latency mode, we need to use the buffer size suggested by | 289 // use the low latency mode, we need to use the buffer size suggested by |
291 // the AudioManager for the sink. It will later be used to decide | 290 // the AudioManager for the sink. It will later be used to decide |
292 // the buffer size of the shared memory buffer. | 291 // the buffer size of the shared memory buffer. |
293 frames_per_buffer_, | 292 frames_per_buffer_, |
294 #else | 293 #else |
295 2 * source_params_.frames_per_buffer(), | 294 2 * source_params_.frames_per_buffer(), |
296 #endif | 295 #endif |
(...skipping 28 matching lines...) Expand all Loading... |
325 sink_->Stop(); | 324 sink_->Stop(); |
326 sink_started_ = false; | 325 sink_started_ = false; |
327 } | 326 } |
328 | 327 |
329 sink_ = AudioDeviceFactory::NewOutputDevice(source_render_view_id_, | 328 sink_ = AudioDeviceFactory::NewOutputDevice(source_render_view_id_, |
330 source_render_frame_id_); | 329 source_render_frame_id_); |
331 MaybeStartSink(); | 330 MaybeStartSink(); |
332 } | 331 } |
333 | 332 |
334 } // namespace content | 333 } // namespace content |
OLD | NEW |