summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorguidou <guidou@chromium.org>2015-06-11 09:13:56 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-11 16:14:52 +0000
commit61e29dfb0548ed8782669fb441226a52ada50c8f (patch)
tree1d4d296b579fa69721f60aa0ebd6042410d46983 /media
parent58c4b6fc734361e9de25959c7f92690e8f5ba372 (diff)
downloadchromium_src-61e29dfb0548ed8782669fb441226a52ada50c8f.zip
chromium_src-61e29dfb0548ed8782669fb441226a52ada50c8f.tar.gz
chromium_src-61e29dfb0548ed8782669fb441226a52ada50c8f.tar.bz2
Add IPC interface for switching the audio output device for a given audio stream in the browser.
The goal is to add support for the Audio Output Devices API (http://w3c.github.io/mediacapture-output/) BUG=438023 Review URL: https://codereview.chromium.org/1171953002 Cr-Commit-Position: refs/heads/master@{#333963}
Diffstat (limited to 'media')
-rw-r--r--media/audio/audio_logging.h5
-rw-r--r--media/audio/audio_output_ipc.h14
-rw-r--r--media/audio/fake_audio_log_factory.cc4
3 files changed, 23 insertions, 0 deletions
diff --git a/media/audio/audio_logging.h b/media/audio/audio_logging.h
index 913b8ec..4d7551f 100644
--- a/media/audio/audio_logging.h
+++ b/media/audio/audio_logging.h
@@ -43,6 +43,11 @@ class AudioLog {
// Called when an audio component changes volume. |volume| is the new volume.
virtual void OnSetVolume(int component_id, double volume) = 0;
+
+ // Called when an audio component switches output device. |device_id| is the
+ // new audio output device.
+ virtual void OnSwitchOutputDevice(int component_id,
+ const std::string& device_id) = 0;
};
// AudioLogFactory dispenses AudioLog instances to owning classes for tracking
diff --git a/media/audio/audio_output_ipc.h b/media/audio/audio_output_ipc.h
index f85d8e0..05e4b28 100644
--- a/media/audio/audio_output_ipc.h
+++ b/media/audio/audio_output_ipc.h
@@ -5,13 +5,27 @@
#ifndef MEDIA_AUDIO_AUDIO_OUTPUT_IPC_H_
#define MEDIA_AUDIO_AUDIO_OUTPUT_IPC_H_
+#include <string>
+
#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 {
+// Result of an audio output device switch operation
+enum SwitchOutputDeviceResult {
+ SWITCH_OUTPUT_DEVICE_RESULT_SUCCESS = 0,
+ SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_FOUND,
+ SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_AUTHORIZED,
+ SWITCH_OUTPUT_DEVICE_RESULT_ERROR_OBSOLETE,
+ SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_SUPPORTED,
+ SWITCH_OUTPUT_DEVICE_RESULT_LAST =
+ SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_SUPPORTED,
+};
+
// Contains IPC notifications for the state of the server side
// (AudioOutputController) audio state changes and when an AudioOutputController
// has been created. Implemented by AudioOutputDevice.
diff --git a/media/audio/fake_audio_log_factory.cc b/media/audio/fake_audio_log_factory.cc
index e8677f2..fd5cf45 100644
--- a/media/audio/fake_audio_log_factory.cc
+++ b/media/audio/fake_audio_log_factory.cc
@@ -4,6 +4,8 @@
#include "media/audio/fake_audio_log_factory.h"
+#include <string>
+
namespace media {
class FakeAudioLogImpl : public AudioLog {
@@ -18,6 +20,8 @@ class FakeAudioLogImpl : public AudioLog {
void OnClosed(int component_id) override {}
void OnError(int component_id) override {}
void OnSetVolume(int component_id, double volume) override {}
+ void OnSwitchOutputDevice(int component_id,
+ const std::string& device_id) override {}
};
FakeAudioLogFactory::FakeAudioLogFactory() {}