Chromium Code Reviews| Index: content/renderer/media/renderer_audio_hardware_config.h |
| diff --git a/content/renderer/media/renderer_audio_hardware_config.h b/content/renderer/media/renderer_audio_hardware_config.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5a646338403c3cfa1c2475ac0698c1f97389c170 |
| --- /dev/null |
| +++ b/content/renderer/media/renderer_audio_hardware_config.h |
| @@ -0,0 +1,57 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_RENDERER_MEDIA_RENDERER_AUDIO_HARDWARE_CONFIG_H_ |
| +#define CONTENT_RENDERER_MEDIA_RENDERER_AUDIO_HARDWARE_CONFIG_H_ |
| + |
| +#include "base/compiler_specific.h" |
|
henrika (OOO until Aug 14)
2013/01/29 10:46:49
Why do you need this one here?
DaleCurtis
2013/01/30 01:31:06
Necessary for the DISALLOW_COPY_AND_ASSIGN() macro
|
| +#include "base/synchronization/lock.h" |
| +#include "content/common/content_export.h" |
| +#include "media/base/audio_hardware_config.h" |
| + |
| +namespace content { |
| + |
| +// Provides access to the audio hardware configuration from the renderer side. |
| +class CONTENT_EXPORT RendererAudioHardwareConfig |
| + : public media::AudioHardwareConfig { |
| + public: |
| + // Must be constructed on the render thread. RendererAudioHardwareConfig |
| + // sends a synchronous IPC to retrieve the audio hardware configuration; once |
| + // complete accessors and updaters may be called from any thread. |
| + RendererAudioHardwareConfig(); |
| + virtual ~RendererAudioHardwareConfig(); |
| + |
| + // Constructor for tests which don't have a render thread. |
| + RendererAudioHardwareConfig(int output_buffer_size, int output_sample_rate, |
|
henrika (OOO until Aug 14)
2013/01/29 10:46:49
Should it be public?
DaleCurtis
2013/01/30 01:31:06
Easier if it is. Otherwise there's a bunch of ugly
|
| + int input_sample_rate, |
| + media::ChannelLayout input_channel_layout); |
| + |
| + // Accessors for the currently cached hardware configuration. Safe to call |
| + // from any thread. |
| + virtual int GetOutputBufferSize() OVERRIDE; |
| + virtual int GetOutputSampleRate() OVERRIDE; |
| + virtual int GetInputSampleRate() OVERRIDE; |
| + virtual media::ChannelLayout GetInputChannelLayout() OVERRIDE; |
| + |
| + // Allows callers to update the cached values for either input or output. The |
| + // values are paired under the assumption that these values will only be set |
| + // after an input or output device change respectively. Safe to call from |
| + // any thread. |
| + void UpdateInputConfig(int sample_rate, media::ChannelLayout channel_layout); |
|
henrika (OOO until Aug 14)
2013/01/29 10:46:49
OK, now I get it. Seen as implementation detail an
|
| + void UpdateOutputConfig(int buffer_size, int sample_rate); |
| + |
| + private: |
| + // Cached values; access is protected by |config_lock_|. |
| + base::Lock config_lock_; |
|
henrika (OOO until Aug 14)
2013/01/29 10:46:49
How is this class used today? Are all methods only
DaleCurtis
2013/01/29 19:36:00
AudioRendererMixerManager::GetMixer() may be calle
|
| + int output_buffer_size_; |
| + int output_sample_rate_; |
| + int input_sample_rate_; |
| + media::ChannelLayout input_channel_layout_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(RendererAudioHardwareConfig); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_RENDERER_MEDIA_RENDERER_AUDIO_HARDWARE_CONFIG_H_ |