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

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

Issue 1930393002: Switch stream creation and closing in Chrome audio rendering from IPC to Mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unique_ptr for Binding Created 4 years, 7 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 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 4f2747be94790027c10675da740f38ef16530e7b..d629f22b5c1b047187c466e76faaa83ce13be5a3 100644
--- a/content/browser/renderer_host/media/audio_renderer_host.h
+++ b/content/browser/renderer_host/media/audio_renderer_host.h
@@ -73,6 +73,7 @@ class AudioParameters;
namespace content {
class AudioMirroringManager;
+class AudioOutputImpl;
class MediaInternals;
class MediaStreamManager;
class MediaStreamUIProxy;
@@ -88,10 +89,22 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
MediaStreamManager* media_stream_manager,
const ResourceContext::SaltCallback& salt_callback);
+ // Creates an audio output stream with the specified format.
+ // Upon success/failure, the peer is notified via the NotifyStreamCreated
+ // message.
+ virtual void CreateStream(int stream_id,
+ int render_frame_id,
+ const media::AudioParameters& params,
+ AudioOutputImpl* audio_output_impl);
+
+ // Close the audio stream referenced by |stream_id|.
+ virtual void CloseStream(int stream_id);
+
// Calls |callback| with the list of AudioOutputControllers for this object.
void GetOutputControllers(
const RenderProcessHost::GetAudioOutputControllersCallback&
callback) const;
+ media::AudioLog* get_audio_log() { return audio_log_.get(); }
// BrowserMessageFilter implementation.
void OnChannelClosing() override;
@@ -105,13 +118,19 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
// Returns true if any streams managed by the RenderFrame identified by
// |render_frame_id| are actively playing. Can be called from any thread.
bool RenderFrameHasActiveAudio(int render_frame_id) const;
+ void CleanAudioOutputImpl(AudioOutputImpl* audio_output_impl);
private:
+ friend class AudioEntry;
+ friend class AudioOutputImplTest;
friend class AudioRendererHostTest;
friend class BrowserThread;
friend class base::DeleteHelper<AudioRendererHost>;
friend class MockAudioRendererHost;
+ friend class MockAudioOutputAudioRendererHost;
+ friend class MockAudioOutputStreamAudioRendererHost;
friend class TestAudioRendererHost;
+
FRIEND_TEST_ALL_PREFIXES(AudioRendererHostTest, CreateMockStream);
FRIEND_TEST_ALL_PREFIXES(AudioRendererHostTest, MockStreamDataConversation);
@@ -149,22 +168,12 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
const std::string& device_id,
const url::Origin& security_origin);
- // Creates an audio output stream with the specified format.
- // Upon success/failure, the peer is notified via the NotifyStreamCreated
- // message.
- void OnCreateStream(int stream_id,
- int render_frame_id,
- const media::AudioParameters& params);
-
// Play the audio stream referenced by |stream_id|.
void OnPlayStream(int stream_id);
// Pause the audio stream referenced by |stream_id|.
void OnPauseStream(int stream_id);
- // Close the audio stream referenced by |stream_id|.
- void OnCloseStream(int stream_id);
-
// Set the volume of the audio stream referenced by |stream_id|.
void OnSetVolume(int stream_id, double volume);
@@ -183,15 +192,16 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
// Start the actual creation of an audio stream, after the device
// authorization process is complete.
- void DoCreateStream(int stream_id,
- int render_frame_id,
- const media::AudioParameters& params,
- const std::string& device_unique_id);
+ virtual void DoCreateStream(int stream_id,
+ int render_frame_id,
+ const media::AudioParameters& params,
+ const std::string& device_unique_id,
+ AudioOutputImpl* audio_output_impl);
// Complete the process of creating an audio stream. This will set up the
// shared memory or shared socket in low latency mode and send the
// NotifyStreamCreated message to the peer.
- void DoCompleteCreation(int stream_id);
+ virtual void DoCompleteCreation(int stream_id);
// Send playing/paused status to the renderer.
void DoNotifyStreamStateChanged(int stream_id, bool is_playing);
@@ -205,7 +215,7 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
// AudioOutputController after it has closed.
void DeleteEntry(std::unique_ptr<AudioEntry> entry);
- // Send an error message to the renderer, then close the stream.
+ // Send an error message to the client, then close the stream.
void ReportErrorAndClose(int stream_id);
// A helper method to look up a AudioEntry identified by |stream_id|.
« no previous file with comments | « content/browser/media/audio_output_stream_impl_unittest.cc ('k') | content/browser/renderer_host/media/audio_renderer_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698