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

Unified Diff: media/base/audio_renderer_sink.h

Issue 1809093003: Moving SwitchOutputDevice out of OutputDevice interface, eliminating OutputDevice (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing guidou's comments Created 4 years, 9 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: media/base/audio_renderer_sink.h
diff --git a/media/base/audio_renderer_sink.h b/media/base/audio_renderer_sink.h
index ac845f3ff4b64bc77a8b2e4045b6da6144d99249..402f611db8c707314805467372c3dde1a9370908 100644
--- a/media/base/audio_renderer_sink.h
+++ b/media/base/audio_renderer_sink.h
@@ -8,21 +8,13 @@
#include <stdint.h>
#include <string>
-#include <vector>
#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 "media/base/output_device.h"
-#include "url/gurl.h"
-
-namespace base {
-class SingleThreadTaskRunner;
-}
+#include "media/base/output_device_info.h"
+#include "url/origin.h"
namespace media {
@@ -71,12 +63,12 @@ class AudioRendererSink
// Returns |true| on success.
virtual bool SetVolume(double volume) = 0;
- // Returns a pointer to the internal output device.
- // This pointer is not to be owned by the caller and is valid only during
- // the lifetime of the AudioRendererSink.
- // It can be null, which means that access to the output device is not
- // supported.
- virtual OutputDevice* GetOutputDevice() = 0;
+ // Returns current output device information. If the information is not
+ // available yet, this method may block until it becomes available.
+ // If the sink does not support output device, |device_status| of
miu 2016/03/24 21:32:02 nit: s/does not support output device/is not an ou
o1ka 2016/03/29 13:39:54 (The sink needs to be associated with OD, but not
+ // OutputDeviceInfo should be set to OUTPUT_DEVICE_STATUS_ERROR_INTERNAL.
+ // Must never be called on the IO thread.
+ virtual OutputDeviceInfo GetOutputDeviceInfo() = 0;
protected:
friend class base::RefCountedThreadSafe<AudioRendererSink>;
@@ -93,6 +85,27 @@ class RestartableAudioRendererSink : public AudioRendererSink {
~RestartableAudioRendererSink() override {}
};
+class SwitchableAudioRendererSink : public RestartableAudioRendererSink {
+ public:
+ // 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::OutputDeviceStatus enum.
+ // There is no guarantee about the thread where |callback| will
miu 2016/03/24 21:32:02 ditto here (see comments in content/public/rendere
o1ka 2016/03/29 13:39:54 Done.
+ // 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 url::Origin& security_origin,
+ const OutputDeviceStatusCB& callback) = 0;
+
+ protected:
+ ~SwitchableAudioRendererSink() override {}
+};
+
} // namespace media
#endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_

Powered by Google App Engine
This is Rietveld 408576698