Chromium Code Reviews| Index: content/renderer/media/renderer_audio_hardware_config.cc |
| diff --git a/content/renderer/media/renderer_audio_hardware_config.cc b/content/renderer/media/renderer_audio_hardware_config.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c488603d01bfeaa376e763a459c6ff805e2d2732 |
| --- /dev/null |
| +++ b/content/renderer/media/renderer_audio_hardware_config.cc |
| @@ -0,0 +1,68 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "content/renderer/media/renderer_audio_hardware_config.h" |
| + |
| +#include "content/common/view_messages.h" |
| +#include "content/renderer/render_thread_impl.h" |
| + |
| +namespace content { |
| + |
| +RendererAudioHardwareConfig::RendererAudioHardwareConfig() |
| + : output_buffer_size_(0), |
| + output_sample_rate_(0), |
| + input_sample_rate_(0), |
| + input_channel_layout_(media::CHANNEL_LAYOUT_NONE) { |
| + CHECK(RenderThreadImpl::current()); |
| + RenderThreadImpl::current()->Send(new ViewHostMsg_GetAudioHardwareConfig( |
|
henrika (OOO until Aug 14)
2013/01/29 10:46:49
Is it OK to call a sync IPC from a ctor? It just f
DaleCurtis
2013/01/29 19:36:00
Why do you think it's riskier? Also what's riskier
henrika (OOO until Aug 14)
2013/01/30 10:10:06
I am just used to always making as lightweight tas
|
| + &output_buffer_size_, &output_sample_rate_, &input_sample_rate_, |
| + &input_channel_layout_)); |
| +} |
| + |
| +RendererAudioHardwareConfig::RendererAudioHardwareConfig( |
| + int output_buffer_size, int output_sample_rate, |
| + int input_sample_rate, media::ChannelLayout input_channel_layout) |
| + : output_buffer_size_(output_buffer_size), |
| + output_sample_rate_(output_sample_rate), |
| + input_sample_rate_(input_sample_rate), |
| + input_channel_layout_(input_channel_layout) { |
| +} |
| + |
| +RendererAudioHardwareConfig::~RendererAudioHardwareConfig() {} |
| + |
| +int RendererAudioHardwareConfig::GetOutputBufferSize() { |
| + base::AutoLock auto_lock(config_lock_); |
| + return output_buffer_size_; |
| +} |
| + |
| +int RendererAudioHardwareConfig::GetOutputSampleRate() { |
| + base::AutoLock auto_lock(config_lock_); |
| + return output_sample_rate_; |
| +} |
| + |
| +int RendererAudioHardwareConfig::GetInputSampleRate() { |
| + base::AutoLock auto_lock(config_lock_); |
| + return input_sample_rate_; |
| +} |
| + |
| +media::ChannelLayout RendererAudioHardwareConfig::GetInputChannelLayout() { |
| + base::AutoLock auto_lock(config_lock_); |
| + return input_channel_layout_; |
| +} |
| + |
| +void RendererAudioHardwareConfig::UpdateInputConfig( |
| + int sample_rate, media::ChannelLayout channel_layout) { |
| + base::AutoLock auto_lock(config_lock_); |
| + input_sample_rate_ = sample_rate; |
| + input_channel_layout_ = channel_layout; |
| +} |
| + |
| +void RendererAudioHardwareConfig::UpdateOutputConfig(int buffer_size, |
| + int sample_rate) { |
| + base::AutoLock auto_lock(config_lock_); |
| + output_buffer_size_ = buffer_size; |
| + output_sample_rate_ = sample_rate; |
| +} |
| + |
| +} // namespace content |