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

Unified Diff: content/renderer/media/audio_device_factory.h

Issue 1666363005: Switching audio clients to using RestartableAudioRendererSink interface as a sink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: export fix Created 4 years, 10 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: content/renderer/media/audio_device_factory.h
diff --git a/content/renderer/media/audio_device_factory.h b/content/renderer/media/audio_device_factory.h
index 1d6a53ad584e8292e53da21b332329633a8efbe6..735c79160c018b0c8299a656d12c9cfb32497939 100644
--- a/content/renderer/media/audio_device_factory.h
+++ b/content/renderer/media/audio_device_factory.h
@@ -11,6 +11,7 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "content/common/content_export.h"
+#include "media/base/audio_renderer_sink.h"
namespace media {
class AudioInputDevice;
@@ -28,6 +29,16 @@ namespace content {
// provide specialized implementations.
class CONTENT_EXPORT AudioDeviceFactory {
public:
+ // Types of audio sources.
+ enum SourceType {
+ kSourceNone = 0,
+ kSourceHighLatency,
+ kSourceWebRTC,
+ kSourceLocalUserMedia,
+ kSourceWebAudio,
Henrik Grunell 2016/02/11 12:01:26 When the categories or explicit latencies for WebA
o1ka 2016/02/11 17:18:23 renamed
+ kSourceLast = kSourceWebAudio // Only used for validation of format.
+ };
+
// Creates an AudioOutputDevice.
// |render_frame_id| refers to the RenderFrame containing the entity
// producing the audio. If |session_id| is nonzero, it is used by the browser
@@ -42,6 +53,35 @@ class CONTENT_EXPORT AudioDeviceFactory {
const std::string& device_id,
const url::Origin& security_origin);
+ // Creates an AudioRendererSink bound to an AudioOutputDevice.
+ // Basing on |source_type| and build configuration, audio played out through
+ // the sink goes to AOD directly or can be mixed with other audio before that.
+ // TODO(olka): merge it with NewRestartableOutputDevice() as soon as
+ // AudioOutputDevice is fixed to be restartable.
+ static scoped_refptr<media::AudioRendererSink> NewOutputDevice(
DaleCurtis 2016/02/10 23:25:33 Can you give this a different name? We should avoi
Henrik Grunell 2016/02/11 12:01:26 Maybe simply call it NewAudioRendererSink? (That's
o1ka 2016/02/11 17:18:23 Done.
+ SourceType source_type,
+ int render_frame_id,
+ int session_id,
+ const std::string& device_id,
+ const url::Origin& security_origin);
+
+ // Creates a RestartableAudioRendererSink bound to an AudioOutputDevice
+ // Basing on |source_type| and build configuration, audio played out through
+ // the sink goes to AOD directly or can be mixed with other audio before that.
+ static scoped_refptr<media::RestartableAudioRendererSink>
+ NewRestartableOutputDevice(SourceType source_type,
Henrik Grunell 2016/02/11 12:01:26 Name it NewRestartableAudioRendererSink, assuming
o1ka 2016/02/11 17:18:23 Done.
+ int render_frame_id,
+ int session_id,
+ const std::string& device_id,
+ const url::Origin& security_origin);
+
+ // A helper to get HW device status in the absence of AudioOutputDevice.
Henrik Grunell 2016/02/11 12:01:26 Nit: HW -> hardware
o1ka 2016/02/11 17:18:23 Done.
+ static media::OutputDeviceStatus GetOutputDeviceStatus(
+ int render_frame_id,
+ int session_id,
+ const std::string& device_id,
+ const url::Origin& security_origin);
+
// Creates an AudioInputDevice using the currently registered factory.
// |render_frame_id| refers to the RenderFrame containing the entity
// consuming the audio.
@@ -61,6 +101,21 @@ class CONTENT_EXPORT AudioDeviceFactory {
int sesssion_id,
const std::string& device_id,
const url::Origin& security_origin) = 0;
+
+ virtual media::AudioRendererSink* CreateOutputDevice(
Henrik Grunell 2016/02/11 12:01:26 Change name according to the public versions if th
o1ka 2016/02/11 17:18:23 Done.
+ SourceType source_type,
+ int render_frame_id,
+ int sesssion_id,
+ const std::string& device_id,
+ const url::Origin& security_origin) = 0;
+
+ virtual media::RestartableAudioRendererSink* CreateRestartableOutputDevice(
+ SourceType source_type,
+ int render_frame_id,
+ int sesssion_id,
+ const std::string& device_id,
+ const url::Origin& security_origin) = 0;
+
virtual media::AudioInputDevice* CreateInputDevice(int render_frame_id) = 0;
private:
« no previous file with comments | « no previous file | content/renderer/media/audio_device_factory.cc » ('j') | content/renderer/media/audio_device_factory.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698