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