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

Unified Diff: media/audio/audio_output_ipc.h

Issue 1122393004: Add support for switching the audio output device for HTMLMediaElements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes to MediaPlayers so that they invoke callbacks in the correct threads. First complete implem… Created 5 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: media/audio/audio_output_ipc.h
diff --git a/media/audio/audio_output_ipc.h b/media/audio/audio_output_ipc.h
index f85d8e0195325dfc3add33238bc77d56a9d85cc2..d59aba4debc5700301759dc776d2bbbab2214333 100644
--- a/media/audio/audio_output_ipc.h
+++ b/media/audio/audio_output_ipc.h
@@ -5,10 +5,14 @@
#ifndef MEDIA_AUDIO_AUDIO_OUTPUT_IPC_H_
#define MEDIA_AUDIO_AUDIO_OUTPUT_IPC_H_
+#include <string>
+
+#include "base/callback.h"
#include "base/memory/shared_memory.h"
#include "base/sync_socket.h"
#include "media/audio/audio_parameters.h"
#include "media/base/media_export.h"
+#include "url/gurl.h"
namespace media {
@@ -27,6 +31,16 @@ class MEDIA_EXPORT AudioOutputIPCDelegate {
kStateLast = kError
};
+ // Result of an audio output device switch operation
+ enum DeviceSwitchResult {
+ kSuccess = 0,
+ kNotFound,
+ kSecurityError,
+ kOtherError,
+ kDeviceSwitchResultLast = kOtherError
+ };
+
+
// Called when state of an audio stream has changed.
virtual void OnStateChanged(State state) = 0;
@@ -42,6 +56,9 @@ class MEDIA_EXPORT AudioOutputIPCDelegate {
base::SyncSocket::Handle socket_handle,
int length) = 0;
+ // Called when an attempt to switch the output device has been completed
+ virtual void OnDeviceSwitched(int request_id, DeviceSwitchResult result) = 0;
+
// Called when the AudioOutputIPC object is going away and/or when the IPC
// channel has been closed and no more ipc requests can be made.
// Implementations should delete their owned AudioOutputIPC instance
@@ -84,6 +101,13 @@ class MEDIA_EXPORT AudioOutputIPC {
// Sets the volume of the audio stream.
virtual void SetVolume(double volume) = 0;
+
+ // Switches the output device of the audio stream. This should generate a
+ // call to AudioOutputController::SwitchOutputDevice().
+ virtual void SwitchDevice(const std::string& device_id,
+ const GURL& security_origin,
+ int request_id,
+ const base::Callback<void(int)>& callback) = 0;
};
} // namespace media

Powered by Google App Engine
This is Rietveld 408576698