Chromium Code Reviews| 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..def49c59f5e12de36c4d31761f0efb2ea974c81f 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, |
|
Henrik Grunell
2016/02/15 12:21:17
Nit: RTC -> Rtc
o1ka
2016/02/17 17:40:44
Done.
|
| + 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: |