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

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: nit fixes 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
« no previous file with comments | « no previous file | content/renderer/media/audio_device_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..749888ce0499d244cb405770fd6e1b80ee7780b0 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,
+ kSourceMediaElement,
+ kSourceWebRtc,
+ kSourceNonRtcAudioTrack,
+ kSourceWebAudio,
+ 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> NewAudioRendererSink(
+ 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>
+ NewRestartableAudioRendererSink(SourceType source_type,
+ 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.
+ 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* CreateAudioRendererSink(
+ SourceType source_type,
+ int render_frame_id,
+ int sesssion_id,
+ const std::string& device_id,
+ const url::Origin& security_origin) = 0;
+
+ virtual media::RestartableAudioRendererSink*
+ CreateRestartableAudioRendererSink(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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698