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

Unified Diff: media/audio/audio_output_controller.h

Issue 1856673002: Mojofication of the Chrome Audio Rendering Prototype 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
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | media/audio/audio_output_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_output_controller.h
diff --git a/media/audio/audio_output_controller.h b/media/audio/audio_output_controller.h
index 58e1e458a97e1ec06b5157706a62940919b7d2cc..84d55bfb0b5aa7f6447de3f71f8798ff8a5ac076 100644
--- a/media/audio/audio_output_controller.h
+++ b/media/audio/audio_output_controller.h
@@ -14,6 +14,7 @@
#include "base/threading/thread_checker.h"
#include "base/timer/timer.h"
#include "build/build_config.h"
+#include "content/common/media/audio_output.mojom.h"
#include "media/audio/audio_io.h"
#include "media/audio/audio_manager.h"
#include "media/audio/audio_power_monitor.h"
@@ -68,6 +69,9 @@ class MEDIA_EXPORT AudioOutputController
class MEDIA_EXPORT EventHandler {
public:
virtual void OnCreated() = 0;
+ virtual void OnCreated(
+ content::mojom::AudioOutputStreamPtr stream,
+ const content::mojom::AudioOutput::CreateStreamCallback& callback) = 0;
virtual void OnPlaying() = 0;
virtual void OnPaused() = 0;
virtual void OnError() = 0;
@@ -113,6 +117,22 @@ class MEDIA_EXPORT AudioOutputController
const AudioParameters& params, const std::string& output_device_id,
SyncReader* sync_reader);
+ // Factory method for creating an AudioOutputController.
+ // This also creates and opens an AudioOutputStream on the audio manager
+ // thread, and if this is successful, the |event_handler| will receive an
+ // OnCreated() call from the same audio manager thread. |audio_manager| must
+ // outlive AudioOutputController.
+ // The |output_device_id| can be either empty (default device) or specify a
+ // specific hardware device for audio output.
+ static scoped_refptr<AudioOutputController> Create(
+ AudioManager* audio_manager,
+ EventHandler* event_handler,
+ const AudioParameters& params,
+ const std::string& output_device_id,
+ SyncReader* sync_reader,
+ content::mojom::AudioOutputStreamPtr stream,
+ const content::mojom::AudioOutput::CreateStreamCallback& callback);
+
// Indicates whether audio power level analysis will be performed. If false,
// ReadCurrentPowerAndClip() can not be called.
static bool will_monitor_audio_levels() {
@@ -207,6 +227,10 @@ class MEDIA_EXPORT AudioOutputController
// The following methods are executed on the audio manager thread.
void DoCreate(bool is_for_device_change);
+ // The following methods are executed on the audio manager thread.
+ void DoCreateMojo(
+ bool is_for_device_change,
+ const content::mojom::AudioOutput::CreateStreamCallback& callback);
void DoPlay();
void DoPause();
void DoClose();
@@ -236,6 +260,8 @@ class MEDIA_EXPORT AudioOutputController
AudioOutputStream* stream_;
+ content::mojom::AudioOutputStreamPtr stream_ptr_;
+
// When non-NULL, audio is being diverted to this stream.
AudioOutputStream* diverting_to_stream_;
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | media/audio/audio_output_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698