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 "media/base/audio_hardware_config.h" 6 7 using base::AutoLock; 8 using media::AudioParameters; 9 10 namespace media { 11 12 AudioHardwareConfig::AudioHardwareConfig( 13 const AudioParameters& input_params, 14 const AudioParameters& output_params) 15 : input_params_(input_params), 16 output_params_(output_params) { 17 } 18 19 AudioHardwareConfig::~AudioHardwareConfig() {} 20 21 int AudioHardwareConfig::GetOutputBufferSize() const { 22 AutoLock auto_lock(config_lock_); 23 return output_params_.frames_per_buffer(); 24 } 25 26 int AudioHardwareConfig::GetOutputSampleRate() const { 27 AutoLock auto_lock(config_lock_); 28 return output_params_.sample_rate(); 29 } 30 31 ChannelLayout AudioHardwareConfig::GetOutputChannelLayout() const { 32 AutoLock auto_lock(config_lock_); 33 return output_params_.channel_layout(); 34 } 35 36 int AudioHardwareConfig::GetOutputChannels() const { 37 AutoLock auto_lock(config_lock_); 38 return output_params_.channels(); 39 } 40 41 int AudioHardwareConfig::GetInputSampleRate() const { 42 AutoLock auto_lock(config_lock_); 43 return input_params_.sample_rate(); 44 } 45 46 ChannelLayout AudioHardwareConfig::GetInputChannelLayout() const { 47 AutoLock auto_lock(config_lock_); 48 return input_params_.channel_layout(); 49 } 50 51 int AudioHardwareConfig::GetInputChannels() const { 52 AutoLock auto_lock(config_lock_); 53 return input_params_.channels(); 54 } 55 56 media::AudioParameters 57 AudioHardwareConfig::GetInputConfig() const { 58 AutoLock auto_lock(config_lock_); 59 return input_params_; 60 } 61 62 media::AudioParameters 63 AudioHardwareConfig::GetOutputConfig() const { 64 AutoLock auto_lock(config_lock_); 65 return output_params_; 66 } 67 68 void AudioHardwareConfig::UpdateInputConfig( 69 const AudioParameters& input_params) { 70 AutoLock auto_lock(config_lock_); 71 input_params_ = input_params; 72 } 73 74 void AudioHardwareConfig::UpdateOutputConfig( 75 const AudioParameters& output_params) { 76 AutoLock auto_lock(config_lock_); 77 output_params_ = output_params; 78 } 79 80 } // namespace media 81