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

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

Issue 11416350: Tab Audio Mirroring: WebContentsAudioInputStream is a new implementation which represents the lifet… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed issues with losing mirroring on tab navigations. Created 7 years, 11 months 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) 2013 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 // An AudioInputStream which provides a loop-back of all audio output generated
6 // by the RenderView associated with a WebContents instance. The single stream
7 // of data is produced by format-converting and mixing all audio output from a
8 // RenderView. In other words, WebContentsAudioInputStream provides tab-level
9 // audio mirroring.
10 //
11 // The implementation observes a WebContents instance (which represents a
12 // browser tab) so that it can track the replacement of RenderViews due to
13 // navigation, crash/reload, etc. events; and take appropriate actions to
14 // provide a seamless, uninterrupted mirroring experience.
15
16 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_WEB_CONTENTS_AUDIO_INPUT_STREAM_H_
17 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_WEB_CONTENTS_AUDIO_INPUT_STREAM_H_
18
19 #include <string>
20
21 #include "base/memory/ref_counted.h"
22 #include "content/common/content_export.h"
23 #include "media/audio/audio_io.h"
24
25 namespace base {
26 class MessageLoopProxy;
27 }
28
29 namespace media {
30 class AudioParameters;
31 class VirtualAudioInputStream;
32 }
33
34 namespace content {
35
36 class AudioMirroringManager;
37 class WebContentsTracker;
38
39 class CONTENT_EXPORT WebContentsAudioInputStream
40 : NON_EXPORTED_BASE(public media::AudioInputStream) {
41 public:
42 virtual ~WebContentsAudioInputStream();
tommi (sloooow) - chröme 2013/01/14 14:06:48 since the object deletes itself (as per the commen
miu 2013/01/14 21:53:03 Done.
43
44 // media::AudioInputStream implementation
45 virtual bool Open() OVERRIDE;
46 virtual void Start(AudioInputCallback* callback) OVERRIDE;
47 virtual void Stop() OVERRIDE;
48 virtual void Close() OVERRIDE;
49 virtual double GetMaxVolume() OVERRIDE;
50 virtual void SetVolume(double volume) OVERRIDE;
51 virtual double GetVolume() OVERRIDE;
52 virtual void SetAutomaticGainControl(bool enabled) OVERRIDE;
53 virtual bool GetAutomaticGainControl() OVERRIDE;
54
55 // Create a new audio mirroring session. |device_id| should be in the format
56 // accepted by WebContentsCaptureUtil::ExtractTabCaptureTarget(). The
57 // returned object self-destructs once Close() is called.
58 static WebContentsAudioInputStream* Create(
59 const std::string& device_id,
60 const media::AudioParameters& params,
61 base::MessageLoopProxy* message_loop);
62
63 private:
64 friend class WebContentsAudioInputStreamTest;
65
66 class Impl;
67
68 WebContentsAudioInputStream(
69 int render_process_id, int render_view_id,
70 base::MessageLoopProxy* message_loop,
71 AudioMirroringManager* mirroring_manager,
72 const scoped_refptr<WebContentsTracker>& tracker,
73 media::VirtualAudioInputStream* mixer_stream);
74
75 scoped_refptr<Impl> impl_;
tommi (sloooow) - chröme 2013/01/14 14:06:48 add a comment about why we're using a pimpl. (I'm
miu 2013/01/14 21:53:03 Done. (Comment added for the forward decl a few l
76
77 DISALLOW_COPY_AND_ASSIGN(WebContentsAudioInputStream);
78 };
79
80 } // namespace content
81
82 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_WEB_CONTENTS_AUDIO_INPUT_STREAM_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698