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.
5 #include "media/base/audio_hardware_config.h"
8 using media::AudioParameters
;
12 AudioHardwareConfig::AudioHardwareConfig(
13 const AudioParameters
& input_params
,
14 const AudioParameters
& output_params
)
15 : input_params_(input_params
),
16 output_params_(output_params
) {
19 AudioHardwareConfig::~AudioHardwareConfig() {}
21 int AudioHardwareConfig::GetOutputBufferSize() const {
22 AutoLock
auto_lock(config_lock_
);
23 return output_params_
.frames_per_buffer();
26 int AudioHardwareConfig::GetOutputSampleRate() const {
27 AutoLock
auto_lock(config_lock_
);
28 return output_params_
.sample_rate();
31 ChannelLayout
AudioHardwareConfig::GetOutputChannelLayout() const {
32 AutoLock
auto_lock(config_lock_
);
33 return output_params_
.channel_layout();
36 int AudioHardwareConfig::GetOutputChannels() const {
37 AutoLock
auto_lock(config_lock_
);
38 return output_params_
.channels();
41 int AudioHardwareConfig::GetInputSampleRate() const {
42 AutoLock
auto_lock(config_lock_
);
43 return input_params_
.sample_rate();
46 ChannelLayout
AudioHardwareConfig::GetInputChannelLayout() const {
47 AutoLock
auto_lock(config_lock_
);
48 return input_params_
.channel_layout();
51 int AudioHardwareConfig::GetInputChannels() const {
52 AutoLock
auto_lock(config_lock_
);
53 return input_params_
.channels();
56 media::AudioParameters
57 AudioHardwareConfig::GetInputConfig() const {
58 AutoLock
auto_lock(config_lock_
);
62 media::AudioParameters
63 AudioHardwareConfig::GetOutputConfig() const {
64 AutoLock
auto_lock(config_lock_
);
65 return output_params_
;
68 void AudioHardwareConfig::UpdateInputConfig(
69 const AudioParameters
& input_params
) {
70 AutoLock
auto_lock(config_lock_
);
71 input_params_
= input_params
;
74 void AudioHardwareConfig::UpdateOutputConfig(
75 const AudioParameters
& output_params
) {
76 AutoLock
auto_lock(config_lock_
);
77 output_params_
= output_params
;