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

Unified Diff: content/browser/renderer_host/media/audio_renderer_host.h

Issue 11413078: Tab Audio Capture: Browser-side connect/disconnect functionality. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed WCAIS threading issue (methods called on audio thread). Addressed hclam's review comments. 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/audio_renderer_host.h
diff --git a/content/browser/renderer_host/media/audio_renderer_host.h b/content/browser/renderer_host/media/audio_renderer_host.h
index 43e9395ac50ff90293b55f24cda1c8a1e59c78cf..6d9f3b8549efc41d4d14e76cf246f28652a5e68b 100644
--- a/content/browser/renderer_host/media/audio_renderer_host.h
+++ b/content/browser/renderer_host/media/audio_renderer_host.h
@@ -61,13 +61,15 @@ namespace content {
class MediaObserver;
class ResourceContext;
+class WebContentsAudioInputStream;
class CONTENT_EXPORT AudioRendererHost
: public BrowserMessageFilter,
public media::AudioOutputController::EventHandler {
public:
// Called from UI thread from the owner of this object.
- AudioRendererHost(media::AudioManager* audio_manager,
+ AudioRendererHost(int render_process_id,
+ media::AudioManager* audio_manager,
MediaObserver* media_observer);
// BrowserMessageFilter implementation.
@@ -83,6 +85,19 @@ class CONTENT_EXPORT AudioRendererHost
virtual void OnError(media::AudioOutputController* controller,
int error_code) OVERRIDE;
+ // Start/stop mirroring all audio output streams associated with
+ // |render_view_id| to |destination|.
+ void StartMirroring(
Alpha Left Google 2012/11/26 22:59:59 What if StartMirroring and StopMirroring are stati
miu 2012/11/28 05:05:01 Done.
+ int render_view_id,
+ const scoped_refptr<WebContentsAudioInputStream>& destination);
+ void StopMirroring(
+ int render_view_id,
+ const scoped_refptr<WebContentsAudioInputStream>& destination);
+
+ // Return the AudioRendererHost instance for a render process.
+ static scoped_refptr<AudioRendererHost> FromRenderProcessID(
+ int render_process_id);
+
private:
friend class AudioRendererHostTest;
friend class BrowserThread;
@@ -94,6 +109,8 @@ class CONTENT_EXPORT AudioRendererHost
struct AudioEntry;
typedef std::map<int, AudioEntry*> AudioEntryMap;
+ typedef std::map<int, WebContentsAudioInputStream*> MirrorSessionMap;
+
virtual ~AudioRendererHost();
// Methods called on IO thread ----------------------------------------------
@@ -106,6 +123,10 @@ class CONTENT_EXPORT AudioRendererHost
const media::AudioParameters& params,
int input_channels);
+ // Associate |render_view_id| as the producer of audio for the stream
+ // referenced by |stream_id|.
+ void OnAssociateStreamWithProducer(int stream_id, int render_view_id);
+
// Play the audio stream referenced by |stream_id|.
void OnPlayStream(int stream_id);
@@ -160,9 +181,22 @@ class CONTENT_EXPORT AudioRendererHost
media::AudioOutputController* LookupControllerByIdForTesting(int stream_id);
+ void DoStartMirroring(
+ int render_view_id,
+ const scoped_refptr<WebContentsAudioInputStream>& destination);
+ void DoStopMirroring(
+ int render_view_id,
+ const scoped_refptr<WebContentsAudioInputStream>& destination);
+
+ // ID of the RenderProcessImpl that owns this instance.
+ const int render_process_id_;
+
// A map of stream IDs to audio sources.
AudioEntryMap audio_entries_;
+ // A map of render view IDs to the destination for active mirroring sessions.
+ MirrorSessionMap mirror_sessions_;
+
media::AudioManager* audio_manager_;
MediaObserver* media_observer_;

Powered by Google App Engine
This is Rietveld 408576698