Chromium Code Reviews| Index: content/renderer/media/media_stream_audio_processor.h |
| diff --git a/content/renderer/media/media_stream_audio_processor.h b/content/renderer/media/media_stream_audio_processor.h |
| index 12c0fc5ac63415a525d6afdeb3a7de79ada8121d..73e96af73e75e5cd48e024418d8db2fbe2840e07 100644 |
| --- a/content/renderer/media/media_stream_audio_processor.h |
| +++ b/content/renderer/media/media_stream_audio_processor.h |
| @@ -10,6 +10,7 @@ |
| #include "base/threading/thread_checker.h" |
| #include "base/time/time.h" |
| #include "content/common/content_export.h" |
| +#include "content/renderer/media/webrtc_audio_device_impl.h" |
| #include "media/base/audio_converter.h" |
| #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h" |
| #include "third_party/webrtc/modules/interface/module_common_types.h" |
| @@ -37,27 +38,21 @@ class RTCMediaConstraints; |
| // on the getUserMedia constraints, processes the data and outputs it in a unit |
| // of 10 ms data chunk. |
| class CONTENT_EXPORT MediaStreamAudioProcessor : |
| - public base::RefCountedThreadSafe<MediaStreamAudioProcessor> { |
| + public base::RefCountedThreadSafe<MediaStreamAudioProcessor>, |
| + NON_EXPORTED_BASE(public WebRtcPlayoutDataSource::Sink) { |
| public: |
| + // |audio_device| is used to register this class as observer to the WebRtc |
|
tommi (sloooow) - chröme
2014/02/17 15:03:44
audio_device doesn't seem to be a parameter... do
no longer working on chromium
2014/02/17 17:15:32
Done.
|
| + // render data for processing AEC. If clients do not enable AEC, |
| + // |audio_device| won't be used. |
| MediaStreamAudioProcessor(const media::AudioParameters& source_params, |
| const blink::WebMediaConstraints& constraints, |
| - int effects); |
| + int effects, |
| + WebRtcPlayoutDataSource* playout_data_source); |
| // Pushes capture data in |audio_source| to the internal FIFO. |
| // Called on the capture audio thread. |
| void PushCaptureData(media::AudioBus* audio_source); |
| - // Push the render audio to webrtc::AudioProcessing for analysis. This is |
| - // needed iff echo processing is enabled. |
| - // |render_audio| is the pointer to the render audio data, its format |
| - // is specified by |sample_rate|, |number_of_channels| and |number_of_frames|. |
| - // Called on the render audio thread. |
| - void PushRenderData(const int16* render_audio, |
| - int sample_rate, |
| - int number_of_channels, |
| - int number_of_frames, |
| - base::TimeDelta render_delay); |
| - |
| // Processes a block of 10 ms data from the internal FIFO and outputs it via |
| // |out|. |out| is the address of the pointer that will be pointed to |
| // the post-processed data if the method is returning a true. The lifetime |
| @@ -96,6 +91,11 @@ class CONTENT_EXPORT MediaStreamAudioProcessor : |
| class MediaStreamAudioConverter; |
| + // WebRtcPlayoutDataSource::Sink implementation. |
| + virtual void OnPlayoutData(media::AudioBus* audio_bus, |
| + int sample_rate, |
| + int audio_delay_milliseconds) OVERRIDE; |
| + |
| // Helper to initialize the WebRtc AudioProcessing. |
| void InitializeAudioProcessingModule( |
| const blink::WebMediaConstraints& constraints, int effects); |
| @@ -143,7 +143,11 @@ class CONTENT_EXPORT MediaStreamAudioProcessor : |
| // Data bus to help converting interleaved data to an AudioBus. |
| scoped_ptr<media::AudioBus> render_data_bus_; |
| - // Used to DCHECK that some methods are called on the main render thread. |
| + // Raw pointer to the WebRtcPlayoutDataSource, which is valid for the |
| + // lifetime of RenderThread. |
| + WebRtcPlayoutDataSource* const playout_data_source_; |
| + |
| + // Used to DCHECK that the destructor is called on the main render thread. |
| base::ThreadChecker main_thread_checker_; |
| // Used to DCHECK that some methods are called on the capture audio thread. |