Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Side by Side Diff: content/browser/renderer_host/media/web_contents_audio_input_stream.h

Issue 11413078: Tab Audio Capture: Browser-side connect/disconnect functionality. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 CONTENT_BROWSER_RENDERER_HOST_MEDIA_WEB_CONTENTS_AUDIO_INPUT_STREAM_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_WEB_CONTENTS_AUDIO_INPUT_STREAM_H_
7
8 #include <set>
9 #include <string>
10
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h"
13 #include "content/common/content_export.h"
14 #include "media/audio/audio_io.h"
15
16 namespace media {
17 class DivertedAudioOutputStream;
18 }
19
20 namespace content {
21
22 class AudioRendererHost;
23
24 class CONTENT_EXPORT WebContentsAudioInputStream
25 : NON_EXPORTED_BASE(public media::AudioInputStream),
26 public base::SupportsWeakPtr<WebContentsAudioInputStream> {
27 public:
28 // Construct from the a |device_id| string of the form:
29 // "render_process_id:render_view_id"
30 static WebContentsAudioInputStream* Create(const std::string& device_id);
31
32 virtual ~WebContentsAudioInputStream();
33
34 // media::AudioInputStream implementation
35 virtual bool Open() OVERRIDE;
36 virtual void Start(AudioInputCallback* callback) OVERRIDE;
37 virtual void Stop() OVERRIDE;
38 virtual void Close() OVERRIDE;
39 virtual double GetMaxVolume() OVERRIDE;
40 virtual void SetVolume(double volume) OVERRIDE;
41 virtual double GetVolume() OVERRIDE;
42 virtual void SetAutomaticGainControl(bool enabled) OVERRIDE;
43 virtual bool GetAutomaticGainControl() OVERRIDE;
44
45 // Begin pulling data from the given AudioOutputStream. Caller retains
46 // ownership.
47 void AddAudioOutputStream(media::DivertedAudioOutputStream* aos);
48
49 // Stop pulling data from the given AudioOutputStream. After this method
50 // returns, the caller can safely destroy the AOS.
51 void RemoveAudioOutputStream(media::DivertedAudioOutputStream* aos);
52
53 private:
54 class AudioRendererHostTracker;
55
56 enum State {
57 kIdle,
58 kStarting,
59 kRecording,
60 kStopping,
61 kClosed
62 };
63
64 WebContentsAudioInputStream(int render_process_id, int render_view_id);
65
66 void OnTargetChanged(int render_process_id, int render_view_id);
67
68 State state_;
69
70 int target_render_process_id_;
71 int target_render_view_id_;
72 scoped_refptr<AudioRendererHost> target_host_;
73
74 scoped_refptr<AudioRendererHostTracker> tracker_;
75
76 std::set<media::DivertedAudioOutputStream*> streams_;
77
78 DISALLOW_COPY_AND_ASSIGN(WebContentsAudioInputStream);
79 };
80
81 } // namespace content
82
83 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_WEB_CONTENTS_AUDIO_INPUT_STREAM_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698