Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_BASE_AUDIO_HARDWARE_CONFIG_H_ | 5 #ifndef MEDIA_BASE_AUDIO_HARDWARE_CONFIG_H_ |
| 6 #define MEDIA_BASE_AUDIO_HARDWARE_CONFIG_H_ | 6 #define MEDIA_BASE_AUDIO_HARDWARE_CONFIG_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
| 10 #include "media/audio/audio_parameters.h" | |
| 10 #include "media/base/channel_layout.h" | 11 #include "media/base/channel_layout.h" |
| 11 #include "media/base/media_export.h" | 12 #include "media/base/media_export.h" |
| 12 | 13 |
| 13 namespace media { | 14 namespace media { |
| 14 | 15 |
| 15 // Provides thread safe access to the audio hardware configuration. | 16 // Provides thread safe access to the audio hardware configuration. |
| 16 class MEDIA_EXPORT AudioHardwareConfig { | 17 class MEDIA_EXPORT AudioHardwareConfig { |
| 17 public: | 18 public: |
| 18 AudioHardwareConfig(int output_buffer_size, int output_sample_rate, | 19 AudioHardwareConfig(const media::AudioParameters& input_params, |
| 19 int input_sample_rate, | 20 const media::AudioParameters& output_params); |
| 20 ChannelLayout input_channel_layout); | |
| 21 virtual ~AudioHardwareConfig(); | 21 virtual ~AudioHardwareConfig(); |
| 22 | 22 |
| 23 // Accessors for the currently cached hardware configuration. Safe to call | 23 // Accessors for the currently cached hardware configuration. Safe to call |
| 24 // from any thread. | 24 // from any thread. |
| 25 int GetOutputBufferSize(); | 25 int GetOutputBufferSize(); |
| 26 int GetOutputSampleRate(); | 26 int GetOutputSampleRate(); |
| 27 ChannelLayout GetOutputChannelLayout(); | |
| 28 int GetOutputChannels(); | |
| 29 | |
| 27 int GetInputSampleRate(); | 30 int GetInputSampleRate(); |
| 28 ChannelLayout GetInputChannelLayout(); | 31 ChannelLayout GetInputChannelLayout(); |
| 32 int GetInputChannels(); | |
| 29 | 33 |
| 30 // Allows callers to update the cached values for either input or output. The | 34 // Allows callers to update the cached values for either input or output. The |
| 31 // values are paired under the assumption that these values will only be set | 35 // values are paired under the assumption that these values will only be set |
| 32 // after an input or output device change respectively. Safe to call from | 36 // after an input or output device change respectively. Safe to call from |
| 33 // any thread. | 37 // any thread. |
| 38 // TODO(crogers): These methods should be updated to take AudioParameters! | |
|
DaleCurtis
2013/03/06 19:19:30
Seems like that should be done in this CL? You're
| |
| 34 void UpdateInputConfig(int sample_rate, media::ChannelLayout channel_layout); | 39 void UpdateInputConfig(int sample_rate, media::ChannelLayout channel_layout); |
| 35 void UpdateOutputConfig(int buffer_size, int sample_rate); | 40 void UpdateOutputConfig(int buffer_size, int sample_rate); |
| 36 | 41 |
| 37 private: | 42 private: |
| 38 // Cached values; access is protected by |config_lock_|. | 43 // Cached values; access is protected by |config_lock_|. |
| 39 base::Lock config_lock_; | 44 base::Lock config_lock_; |
| 40 int output_buffer_size_; | 45 media::AudioParameters input_params_; |
| 41 int output_sample_rate_; | 46 media::AudioParameters output_params_; |
| 42 int input_sample_rate_; | |
| 43 ChannelLayout input_channel_layout_; | |
| 44 | 47 |
| 45 DISALLOW_COPY_AND_ASSIGN(AudioHardwareConfig); | 48 DISALLOW_COPY_AND_ASSIGN(AudioHardwareConfig); |
| 46 }; | 49 }; |
| 47 | 50 |
| 48 } // namespace media | 51 } // namespace media |
| 49 | 52 |
| 50 #endif // MEDIA_BASE_AUDIO_HARDWARE_CONFIG_H_ | 53 #endif // MEDIA_BASE_AUDIO_HARDWARE_CONFIG_H_ |
| OLD | NEW |