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 #ifndef MEDIA_BASE_AUDIO_HARDWARE_CONFIG_H_ | |
| 6 #define MEDIA_BASE_AUDIO_HARDWARE_CONFIG_H_ | |
| 7 | |
| 8 #include "base/compiler_specific.h" | |
| 9 #include "base/synchronization/lock.h" | |
| 10 #include "media/base/channel_layout.h" | |
| 11 #include "media/base/media_export.h" | |
| 12 | |
| 13 namespace media { | |
| 14 | |
| 15 // Provides thread safe access to the audio hardware configuration from the | |
| 16 // renderer side. | |
|
scherkus (not reviewing)
2013/01/31 02:33:33
nit: renderer isn't important here, but rather tha
DaleCurtis
2013/01/31 19:50:00
Done.
| |
| 17 class MEDIA_EXPORT AudioHardwareConfig { | |
| 18 public: | |
| 19 AudioHardwareConfig(int output_buffer_size, int output_sample_rate, | |
| 20 int input_sample_rate, | |
| 21 ChannelLayout input_channel_layout); | |
| 22 virtual ~AudioHardwareConfig(); | |
| 23 | |
| 24 // Accessors for the currently cached hardware configuration. Safe to call | |
| 25 // from any thread. | |
| 26 int GetOutputBufferSize(); | |
| 27 int GetOutputSampleRate(); | |
| 28 int GetInputSampleRate(); | |
| 29 ChannelLayout GetInputChannelLayout(); | |
| 30 | |
| 31 // Allows callers to update the cached values for either input or output. The | |
| 32 // values are paired under the assumption that these values will only be set | |
| 33 // after an input or output device change respectively. Safe to call from | |
| 34 // any thread. | |
| 35 void UpdateInputConfig(int sample_rate, media::ChannelLayout channel_layout); | |
| 36 void UpdateOutputConfig(int buffer_size, int sample_rate); | |
| 37 | |
| 38 private: | |
| 39 // Cached values; access is protected by |config_lock_|. | |
| 40 base::Lock config_lock_; | |
| 41 int output_buffer_size_; | |
| 42 int output_sample_rate_; | |
| 43 int input_sample_rate_; | |
| 44 ChannelLayout input_channel_layout_; | |
| 45 | |
| 46 DISALLOW_COPY_AND_ASSIGN(AudioHardwareConfig); | |
| 47 }; | |
| 48 | |
| 49 } // namespace media | |
| 50 | |
| 51 #endif // MEDIA_BASE_AUDIO_HARDWARE_CONFIG_H_ | |
| OLD | NEW |