| Index: content/renderer/media/webrtc_audio_device_impl.h
|
| diff --git a/content/renderer/media/webrtc_audio_device_impl.h b/content/renderer/media/webrtc_audio_device_impl.h
|
| index f9279f5f6ff5c4986b1afd62e5223228426ae690..4543a8a788319d5b04278a9eda4a6e679241b55f 100644
|
| --- a/content/renderer/media/webrtc_audio_device_impl.h
|
| +++ b/content/renderer/media/webrtc_audio_device_impl.h
|
| @@ -186,15 +186,10 @@ class WebRtcAudioRenderer;
|
| class WebRtcAudioRendererSource {
|
| public:
|
| // Callback to get the rendered interleaved data.
|
| - // TODO(xians): Change uint8* to int16*.
|
| - virtual void RenderData(uint8* audio_data,
|
| - int number_of_channels,
|
| - int number_of_frames,
|
| + virtual void RenderData(media::AudioBus* audio_bus,
|
| + int sample_rate,
|
| int audio_delay_milliseconds) = 0;
|
|
|
| - // Set the format for the capture audio parameters.
|
| - virtual void SetRenderFormat(const media::AudioParameters& params) = 0;
|
| -
|
| // Callback to notify the client that the renderer is going away.
|
| virtual void RemoveAudioRenderer(WebRtcAudioRenderer* renderer) = 0;
|
|
|
| @@ -305,6 +300,12 @@ class CONTENT_EXPORT WebRtcAudioDeviceImpl
|
| void AddAudioCapturer(const scoped_refptr<WebRtcAudioCapturer>& capturer);
|
| void RemoveAudioCapturer(const scoped_refptr<WebRtcAudioCapturer>& capturer);
|
|
|
| + // Adds/Removes the observer of WebRtcAudioRendererSource to the ADM.
|
| + // These methods are used by the MediaStreamAudioProcesssor to get the
|
| + // render data for AEC.
|
| + void AddRenderDataObserver(WebRtcAudioRendererSource* observer);
|
| + void RemoveRenderDataObserver(WebRtcAudioRendererSource* observer);
|
| +
|
| // Gets paired device information of the capture device for the audio
|
| // renderer. This is used to pass on a session id, sample rate and buffer
|
| // size to a webrtc audio renderer (either local or remote), so that audio
|
| @@ -318,18 +319,11 @@ class CONTENT_EXPORT WebRtcAudioDeviceImpl
|
| const scoped_refptr<WebRtcAudioRenderer>& renderer() const {
|
| return renderer_;
|
| }
|
| - int output_buffer_size() const {
|
| - return output_audio_parameters_.frames_per_buffer();
|
| - }
|
| - int output_channels() const {
|
| - return output_audio_parameters_.channels();
|
| - }
|
| - int output_sample_rate() const {
|
| - return output_audio_parameters_.sample_rate();
|
| - }
|
|
|
| private:
|
| typedef std::list<scoped_refptr<WebRtcAudioCapturer> > CapturerList;
|
| + typedef std::list<WebRtcAudioRendererSource* > RenderDataObservers;
|
| + class RenderBuffer;
|
|
|
| // Make destructor private to ensure that we can only be deleted by Release().
|
| virtual ~WebRtcAudioDeviceImpl();
|
| @@ -353,13 +347,11 @@ class CONTENT_EXPORT WebRtcAudioDeviceImpl
|
| // WebRtcAudioRendererSource implementation.
|
|
|
| // Called on the AudioInputDevice worker thread.
|
| - virtual void RenderData(uint8* audio_data,
|
| - int number_of_channels,
|
| - int number_of_frames,
|
| + virtual void RenderData(media::AudioBus* audio_bus,
|
| + int sample_rate,
|
| int audio_delay_milliseconds) OVERRIDE;
|
|
|
| // Called on the main render thread.
|
| - virtual void SetRenderFormat(const media::AudioParameters& params) OVERRIDE;
|
| virtual void RemoveAudioRenderer(WebRtcAudioRenderer* renderer) OVERRIDE;
|
|
|
| // Helper to get the default capturer, which is the last capturer in
|
| @@ -378,14 +370,14 @@ class CONTENT_EXPORT WebRtcAudioDeviceImpl
|
| // Provides access to the audio renderer in the browser process.
|
| scoped_refptr<WebRtcAudioRenderer> renderer_;
|
|
|
| + // List of observers which requires access to the render data.
|
| + RenderDataObservers render_data_observers_;
|
| +
|
| // Weak reference to the audio callback.
|
| // The webrtc client defines |audio_transport_callback_| by calling
|
| // RegisterAudioCallback().
|
| webrtc::AudioTransport* audio_transport_callback_;
|
|
|
| - // Cached values of used output audio parameters. Platform dependent.
|
| - media::AudioParameters output_audio_parameters_;
|
| -
|
| // Cached value of the current audio delay on the input/capture side.
|
| int input_delay_ms_;
|
|
|
| @@ -412,6 +404,11 @@ class CONTENT_EXPORT WebRtcAudioDeviceImpl
|
| // Range is [0, 255].
|
| uint32_t microphone_volume_;
|
|
|
| + // Buffer used for temporary storage during render callback.
|
| + // It is only accessed by the audio render thread.
|
| + scoped_ptr<int16[]> render_buffer_;
|
| + int render_buffer_size_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl);
|
| };
|
|
|
|
|