OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/renderer/media/renderer_audio_hardware_config.h" |
| 6 |
| 7 #include "content/common/view_messages.h" |
| 8 #include "content/renderer/render_thread_impl.h" |
| 9 |
| 10 namespace content { |
| 11 |
| 12 RendererAudioHardwareConfig::RendererAudioHardwareConfig() |
| 13 : output_buffer_size_(0), |
| 14 output_sample_rate_(0), |
| 15 input_sample_rate_(0), |
| 16 input_channel_layout_(media::CHANNEL_LAYOUT_NONE) { |
| 17 CHECK(RenderThreadImpl::current()); |
| 18 RenderThreadImpl::current()->Send(new ViewHostMsg_GetAudioHardwareConfig( |
| 19 &output_buffer_size_, &output_sample_rate_, &input_sample_rate_, |
| 20 &input_channel_layout_)); |
| 21 } |
| 22 |
| 23 RendererAudioHardwareConfig::~RendererAudioHardwareConfig() {} |
| 24 |
| 25 int RendererAudioHardwareConfig::GetOutputBufferSize() { |
| 26 base::AutoLock auto_lock(config_lock_); |
| 27 return output_buffer_size_; |
| 28 } |
| 29 |
| 30 int RendererAudioHardwareConfig::GetOutputSampleRate() { |
| 31 base::AutoLock auto_lock(config_lock_); |
| 32 return output_sample_rate_; |
| 33 } |
| 34 |
| 35 int RendererAudioHardwareConfig::GetInputSampleRate() { |
| 36 base::AutoLock auto_lock(config_lock_); |
| 37 return input_sample_rate_; |
| 38 } |
| 39 |
| 40 media::ChannelLayout RendererAudioHardwareConfig::GetInputChannelLayout() { |
| 41 base::AutoLock auto_lock(config_lock_); |
| 42 return input_channel_layout_; |
| 43 } |
| 44 |
| 45 void RendererAudioHardwareConfig::UpdateInputConfig( |
| 46 int sample_rate, media::ChannelLayout channel_layout) { |
| 47 base::AutoLock auto_lock(config_lock_); |
| 48 input_sample_rate_ = sample_rate; |
| 49 input_channel_layout_ = channel_layout; |
| 50 } |
| 51 |
| 52 void RendererAudioHardwareConfig::UpdateOutputConfig(int buffer_size, |
| 53 int sample_rate) { |
| 54 base::AutoLock auto_lock(config_lock_); |
| 55 output_buffer_size_ = buffer_size; |
| 56 output_sample_rate_ = sample_rate; |
| 57 } |
| 58 |
| 59 } // namespace content |
OLD | NEW |