| 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/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 media::AudioParameters GetInputConfig() const; | 35 media::AudioParameters GetInputConfig() const; |
| 36 media::AudioParameters GetOutputConfig() const; | 36 media::AudioParameters GetOutputConfig() const; |
| 37 | 37 |
| 38 // Allows callers to update the cached values for either input or output. The | 38 // Allows callers to update the cached values for either input or output. The |
| 39 // values are paired under the assumption that these values will only be set | 39 // values are paired under the assumption that these values will only be set |
| 40 // after an input or output device change respectively. Safe to call from | 40 // after an input or output device change respectively. Safe to call from |
| 41 // any thread. | 41 // any thread. |
| 42 void UpdateInputConfig(const media::AudioParameters& input_params); | 42 void UpdateInputConfig(const media::AudioParameters& input_params); |
| 43 void UpdateOutputConfig(const media::AudioParameters& output_params); | 43 void UpdateOutputConfig(const media::AudioParameters& output_params); |
| 44 | 44 |
| 45 // For clients which don't need low latency, a larger buffer size should be | |
| 46 // used to save power and CPU resources. | |
| 47 int GetHighLatencyBufferSize() const; | |
| 48 | |
| 49 // |buffer_size| should be set to 0 if a client has no preference. | |
| 50 static int GetHighLatencyBufferSize(int sample_rate, int buffer_size); | |
| 51 | |
| 52 private: | 45 private: |
| 53 // Cached values; access is protected by |config_lock_|. | 46 // Cached values; access is protected by |config_lock_|. |
| 54 mutable base::Lock config_lock_; | 47 mutable base::Lock config_lock_; |
| 55 media::AudioParameters input_params_; | 48 media::AudioParameters input_params_; |
| 56 media::AudioParameters output_params_; | 49 media::AudioParameters output_params_; |
| 57 | 50 |
| 58 DISALLOW_COPY_AND_ASSIGN(AudioHardwareConfig); | 51 DISALLOW_COPY_AND_ASSIGN(AudioHardwareConfig); |
| 59 }; | 52 }; |
| 60 | 53 |
| 61 } // namespace media | 54 } // namespace media |
| 62 | 55 |
| 63 #endif // MEDIA_BASE_AUDIO_HARDWARE_CONFIG_H_ | 56 #endif // MEDIA_BASE_AUDIO_HARDWARE_CONFIG_H_ |
| OLD | NEW |