| 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..9a03ce8a6602a8dff1dfb227a223cd9de720441c
|
| --- /dev/null
|
| +++ b/content/renderer/media/renderer_audio_hardware_config.h
|
| @@ -0,0 +1,50 @@
|
| +// 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"
|
| +#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();
|
| +
|
| + // 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);
|
| + void UpdateOutputConfig(int buffer_size, int sample_rate);
|
| +
|
| + private:
|
| + // Cached values; access is protected by |config_lock_|.
|
| + base::Lock config_lock_;
|
| + int output_buffer_size_;
|
| + int output_sample_rate_;
|
| + int input_sample_rate_;
|
| + media::ChannelLayout input_channel_layout_;
|
| +};
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_RENDERER_MEDIA_RENDERER_AUDIO_HARDWARE_CONFIG_H_
|
|
|