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

Unified Diff: media/base/audio_renderer_sink.h

Issue 1184473002: Add support for the audio-output-device switching IPC mechanism to the renderer lower layers (media… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build dependencies for audio_unittests Created 5 years, 6 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 | « media/base/audio_renderer_mixer_input.cc ('k') | media/base/fake_audio_renderer_sink.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/audio_renderer_sink.h
diff --git a/media/base/audio_renderer_sink.h b/media/base/audio_renderer_sink.h
index fa1ee84c250a10e16eb0db310b38a31cd555c65c..753135d0c261516e348098cbc147ea8cd559ff56 100644
--- a/media/base/audio_renderer_sink.h
+++ b/media/base/audio_renderer_sink.h
@@ -5,16 +5,27 @@
#ifndef MEDIA_BASE_AUDIO_RENDERER_SINK_H_
#define MEDIA_BASE_AUDIO_RENDERER_SINK_H_
+#include <string>
#include <vector>
+
#include "base/basictypes.h"
+#include "base/callback.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
+#include "media/audio/audio_output_ipc.h"
#include "media/audio/audio_parameters.h"
#include "media/base/audio_bus.h"
#include "media/base/media_export.h"
+#include "url/gurl.h"
+
+namespace base {
+class SingleThreadTaskRunner;
+}
namespace media {
+typedef base::Callback<void(SwitchOutputDeviceResult)> SwitchOutputDeviceCB;
+
// AudioRendererSink is an interface representing the end-point for
// rendered audio. An implementation is expected to
// periodically call Render() on a callback object.
@@ -56,6 +67,21 @@ class AudioRendererSink
// Returns |true| on success.
virtual bool SetVolume(double volume) = 0;
+ // Attempts to switch the audio output device.
+ // Once the attempt is finished, |callback| is invoked with the
+ // result of the operation passed as a parameter. The result is a value from
+ // the media::SwitchOutputDeviceResult enum.
+ // There is no guarantee about the thread where |callback| will
+ // be invoked, so users are advised to use media::BindToCurrentLoop() to
+ // ensure that |callback| runs on the correct thread.
+ // Note also that copy constructors and destructors for arguments bound to
+ // |callback| may run on arbitrary threads as |callback| is moved across
+ // threads. It is advisable to bind arguments such that they are released by
+ // |callback| when it runs in order to avoid surprises.
+ virtual void SwitchOutputDevice(const std::string& device_id,
+ const GURL& security_origin,
+ const SwitchOutputDeviceCB& callback) = 0;
+
protected:
friend class base::RefCountedThreadSafe<AudioRendererSink>;
virtual ~AudioRendererSink() {}
« no previous file with comments | « media/base/audio_renderer_mixer_input.cc ('k') | media/base/fake_audio_renderer_sink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698