Chromium Code Reviews| 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( | |
|
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
| |
| 19 &output_buffer_size_, &output_sample_rate_, &input_sample_rate_, | |
| 20 &input_channel_layout_)); | |
| 21 } | |
| 22 | |
| 23 RendererAudioHardwareConfig::RendererAudioHardwareConfig( | |
| 24 int output_buffer_size, int output_sample_rate, | |
| 25 int input_sample_rate, media::ChannelLayout input_channel_layout) | |
| 26 : output_buffer_size_(output_buffer_size), | |
| 27 output_sample_rate_(output_sample_rate), | |
| 28 input_sample_rate_(input_sample_rate), | |
| 29 input_channel_layout_(input_channel_layout) { | |
| 30 } | |
| 31 | |
| 32 RendererAudioHardwareConfig::~RendererAudioHardwareConfig() {} | |
| 33 | |
| 34 int RendererAudioHardwareConfig::GetOutputBufferSize() { | |
| 35 base::AutoLock auto_lock(config_lock_); | |
| 36 return output_buffer_size_; | |
| 37 } | |
| 38 | |
| 39 int RendererAudioHardwareConfig::GetOutputSampleRate() { | |
| 40 base::AutoLock auto_lock(config_lock_); | |
| 41 return output_sample_rate_; | |
| 42 } | |
| 43 | |
| 44 int RendererAudioHardwareConfig::GetInputSampleRate() { | |
| 45 base::AutoLock auto_lock(config_lock_); | |
| 46 return input_sample_rate_; | |
| 47 } | |
| 48 | |
| 49 media::ChannelLayout RendererAudioHardwareConfig::GetInputChannelLayout() { | |
| 50 base::AutoLock auto_lock(config_lock_); | |
| 51 return input_channel_layout_; | |
| 52 } | |
| 53 | |
| 54 void RendererAudioHardwareConfig::UpdateInputConfig( | |
| 55 int sample_rate, media::ChannelLayout channel_layout) { | |
| 56 base::AutoLock auto_lock(config_lock_); | |
| 57 input_sample_rate_ = sample_rate; | |
| 58 input_channel_layout_ = channel_layout; | |
| 59 } | |
| 60 | |
| 61 void RendererAudioHardwareConfig::UpdateOutputConfig(int buffer_size, | |
| 62 int sample_rate) { | |
| 63 base::AutoLock auto_lock(config_lock_); | |
| 64 output_buffer_size_ = buffer_size; | |
| 65 output_sample_rate_ = sample_rate; | |
| 66 } | |
| 67 | |
| 68 } // namespace content | |
| OLD | NEW |