| Index: content/browser/renderer_host/media/web_contents_audio_input_stream.h
|
| diff --git a/content/browser/renderer_host/media/web_contents_audio_input_stream.h b/content/browser/renderer_host/media/web_contents_audio_input_stream.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..1299a6db89240663c385910f4a2f3e98a9681887
|
| --- /dev/null
|
| +++ b/content/browser/renderer_host/media/web_contents_audio_input_stream.h
|
| @@ -0,0 +1,83 @@
|
| +// Copyright (c) 2012 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_BROWSER_RENDERER_HOST_MEDIA_WEB_CONTENTS_AUDIO_INPUT_STREAM_H_
|
| +#define CONTENT_BROWSER_RENDERER_HOST_MEDIA_WEB_CONTENTS_AUDIO_INPUT_STREAM_H_
|
| +
|
| +#include <set>
|
| +#include <string>
|
| +
|
| +#include "base/memory/ref_counted.h"
|
| +#include "base/memory/weak_ptr.h"
|
| +#include "content/common/content_export.h"
|
| +#include "media/audio/audio_io.h"
|
| +
|
| +namespace media {
|
| +class DivertedAudioOutputStream;
|
| +}
|
| +
|
| +namespace content {
|
| +
|
| +class AudioRendererHost;
|
| +
|
| +class CONTENT_EXPORT WebContentsAudioInputStream
|
| + : NON_EXPORTED_BASE(public media::AudioInputStream),
|
| + public base::SupportsWeakPtr<WebContentsAudioInputStream> {
|
| + public:
|
| + // Construct from the a |device_id| string of the form:
|
| + // "render_process_id:render_view_id"
|
| + static WebContentsAudioInputStream* Create(const std::string& device_id);
|
| +
|
| + virtual ~WebContentsAudioInputStream();
|
| +
|
| + // media::AudioInputStream implementation
|
| + virtual bool Open() OVERRIDE;
|
| + virtual void Start(AudioInputCallback* callback) OVERRIDE;
|
| + virtual void Stop() OVERRIDE;
|
| + virtual void Close() OVERRIDE;
|
| + virtual double GetMaxVolume() OVERRIDE;
|
| + virtual void SetVolume(double volume) OVERRIDE;
|
| + virtual double GetVolume() OVERRIDE;
|
| + virtual void SetAutomaticGainControl(bool enabled) OVERRIDE;
|
| + virtual bool GetAutomaticGainControl() OVERRIDE;
|
| +
|
| + // Begin pulling data from the given AudioOutputStream. Caller retains
|
| + // ownership.
|
| + void AddAudioOutputStream(media::DivertedAudioOutputStream* aos);
|
| +
|
| + // Stop pulling data from the given AudioOutputStream. After this method
|
| + // returns, the caller can safely destroy the AOS.
|
| + void RemoveAudioOutputStream(media::DivertedAudioOutputStream* aos);
|
| +
|
| + private:
|
| + class AudioRendererHostTracker;
|
| +
|
| + enum State {
|
| + kIdle,
|
| + kStarting,
|
| + kRecording,
|
| + kStopping,
|
| + kClosed
|
| + };
|
| +
|
| + WebContentsAudioInputStream(int render_process_id, int render_view_id);
|
| +
|
| + void OnTargetChanged(int render_process_id, int render_view_id);
|
| +
|
| + State state_;
|
| +
|
| + int target_render_process_id_;
|
| + int target_render_view_id_;
|
| + scoped_refptr<AudioRendererHost> target_host_;
|
| +
|
| + scoped_refptr<AudioRendererHostTracker> tracker_;
|
| +
|
| + std::set<media::DivertedAudioOutputStream*> streams_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(WebContentsAudioInputStream);
|
| +};
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_WEB_CONTENTS_AUDIO_INPUT_STREAM_H_
|
|
|