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

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: Created 4 years, 8 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 b4e9d3f329a009039635d0fc80ed1d0cba4e7133..34afa053e2b36e4c92952175e3905ad42af331aa 100644
--- a/content/browser/renderer_host/media/audio_renderer_host.h
+++ b/content/browser/renderer_host/media/audio_renderer_host.h
@@ -51,6 +51,7 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/shared_memory.h"
#include "base/process/process.h"
#include "base/sequenced_task_runner_helpers.h"
#include "content/browser/renderer_host/media/audio_output_device_enumerator.h"
@@ -63,6 +64,7 @@
#include "media/audio/audio_logging.h"
#include "media/audio/audio_output_controller.h"
#include "media/audio/simple_sources.h"
+#include "media/mojo/interfaces/audio_output.mojom.h"
#include "url/origin.h"
namespace media {
@@ -73,6 +75,8 @@ class AudioParameters;
namespace content {
class AudioMirroringManager;
+class AudioOutputImpl;
+class AudioOutputStreamImpl;
class MediaInternals;
class MediaStreamManager;
class MediaStreamUIProxy;
@@ -107,6 +111,9 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
bool RenderFrameHasActiveAudio(int render_frame_id) const;
private:
+ friend class AudioEntry;
Henrik Grunell 2016/05/02 12:12:23 This should not be needed. Anything that needs to
rchtara 2016/05/23 16:38:17 Done.
+ friend class AudioOutputImpl;
+ friend class AudioOutputStreamImpl;
friend class AudioRendererHostTest;
friend class BrowserThread;
friend class base::DeleteHelper<AudioRendererHost>;
@@ -152,9 +159,11 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
// 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);
+ void CreateStream(
+ int stream_id,
+ int render_frame_id,
+ const media::AudioParameters& params,
+ const media::interfaces::AudioOutput::CreateStreamCallback& callback);
// Play the audio stream referenced by |stream_id|.
void OnPlayStream(int stream_id);
@@ -183,15 +192,19 @@ 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);
+ void DoCreateStream(
+ int stream_id,
+ int render_frame_id,
+ const media::AudioParameters& params,
+ const std::string& device_unique_id,
+ const media::interfaces::AudioOutput::CreateStreamCallback& callback);
// 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);
+ void DoCompleteCreation(
+ int stream_id,
+ const media::interfaces::AudioOutput::CreateStreamCallback& callback);
// Send playing/paused status to the renderer.
void DoNotifyStreamStateChanged(int stream_id, bool is_playing);
@@ -208,6 +221,11 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
// Send an error message to the renderer, then close the stream.
void ReportErrorAndClose(int stream_id);
+ // Send an error message to the renderer, then close the stream.
Henrik Grunell 2016/05/02 12:12:23 Change "renderer" to "client", it's more generic.
rchtara 2016/05/23 16:38:17 Done.
+ void ReportErrorAndCloseStream(
+ int stream_id,
+ const media::interfaces::AudioOutput::CreateStreamCallback& callback);
+
// A helper method to look up a AudioEntry identified by |stream_id|.
// Returns NULL if not found.
AudioEntry* LookupById(int stream_id);
@@ -243,6 +261,7 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
media::AudioManager* const audio_manager_;
AudioMirroringManager* const mirroring_manager_;
std::unique_ptr<media::AudioLog> audio_log_;
+ AudioOutputImpl* audio_output_impl_;
Henrik Grunell 2016/05/02 12:12:23 Add a comment about this. In that also explain how
// Used to access to AudioInputDeviceManager.
MediaStreamManager* media_stream_manager_;
@@ -267,6 +286,8 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
// host. Reported as UMA stat at shutdown.
size_t max_simultaneous_streams_;
+ media::interfaces::AudioOutputStreamPtr stream_ptr_;
Henrik Grunell 2016/05/02 12:12:23 Add comment.
rchtara 2016/05/23 16:38:17 Done.
+
DISALLOW_COPY_AND_ASSIGN(AudioRendererHost);
};

Powered by Google App Engine
This is Rietveld 408576698