| Index: content/renderer/media/webrtc_audio_renderer.h
|
| diff --git a/content/renderer/media/webrtc_audio_renderer.h b/content/renderer/media/webrtc_audio_renderer.h
|
| index 09cccf0e3cb01ec853018a421ff77209deb317df..8ad4bd0f4b0a31bc6eac76b815aafcb7a33704bf 100644
|
| --- a/content/renderer/media/webrtc_audio_renderer.h
|
| +++ b/content/renderer/media/webrtc_audio_renderer.h
|
| @@ -7,8 +7,10 @@
|
|
|
| #include "base/memory/ref_counted.h"
|
| #include "base/synchronization/lock.h"
|
| +#include "base/threading/thread_checker.h"
|
| #include "content/renderer/media/webrtc_audio_device_impl.h"
|
| #include "media/base/audio_decoder.h"
|
| +#include "media/base/audio_pull_fifo.h"
|
| #include "media/base/audio_renderer_sink.h"
|
| #include "webkit/media/media_stream_audio_renderer.h"
|
|
|
| @@ -18,16 +20,15 @@ class RendererAudioOutputDevice;
|
| class WebRtcAudioRendererSource;
|
|
|
| // This renderer handles calls from the pipeline and WebRtc ADM. It is used
|
| -// for connecting WebRtc MediaStream with pipeline.
|
| +// for connecting WebRtc MediaStream with the audio pipeline.
|
| class CONTENT_EXPORT WebRtcAudioRenderer
|
| : NON_EXPORTED_BASE(public media::AudioRendererSink::RenderCallback),
|
| NON_EXPORTED_BASE(public webkit_media::MediaStreamAudioRenderer) {
|
| public:
|
| explicit WebRtcAudioRenderer(int source_render_view_id);
|
|
|
| - // Initialize function called by clients like WebRtcAudioDeviceImpl. Note,
|
| + // Initialize function called by clients like WebRtcAudioDeviceImpl.
|
| // Stop() has to be called before |source| is deleted.
|
| - // Returns false if Initialize() fails.
|
| bool Initialize(WebRtcAudioRendererSource* source);
|
|
|
| // Methods called by WebMediaPlayerMS and WebRtcAudioDeviceImpl.
|
| @@ -49,14 +50,23 @@ class CONTENT_EXPORT WebRtcAudioRenderer
|
| PLAYING,
|
| PAUSED,
|
| };
|
| +
|
| + // Used to DCHECK that we are called on the correct thread.
|
| + base::ThreadChecker thread_checker_;
|
| +
|
| // Flag to keep track the state of the renderer.
|
| State state_;
|
|
|
| // media::AudioRendererSink::RenderCallback implementation.
|
| + // These two methods are called on the AudioOutputDevice worker thread.
|
| virtual int Render(media::AudioBus* audio_bus,
|
| int audio_delay_milliseconds) OVERRIDE;
|
| virtual void OnRenderError() OVERRIDE;
|
|
|
| + // Called by AudioPullFifo when more data is necessary.
|
| + // This method is called on the AudioOutputDevice worker thread.
|
| + void SourceCallback(int fifo_frame_delay, media::AudioBus* audio_bus);
|
| +
|
| // The render view in which the audio is rendered into |sink_|.
|
| const int source_render_view_id_;
|
|
|
| @@ -66,19 +76,24 @@ class CONTENT_EXPORT WebRtcAudioRenderer
|
| // Audio data source from the browser process.
|
| WebRtcAudioRendererSource* source_;
|
|
|
| - // Cached values of utilized audio parameters. Platform dependent.
|
| - media::AudioParameters params_;
|
| -
|
| // Buffers used for temporary storage during render callbacks.
|
| // Allocated during initialization.
|
| scoped_array<int16> buffer_;
|
|
|
| - // Protect access to |state_|.
|
| + // Protects access to |state_|, |source_| and |sink_|.
|
| base::Lock lock_;
|
|
|
| // Ref count for the MediaPlayers which are playing audio.
|
| int play_ref_count_;
|
|
|
| + // Used to buffer data between the client and the output device in cases where
|
| + // the client buffer size is not the same as the output device buffer size.
|
| + scoped_ptr<media::AudioPullFifo> audio_fifo_;
|
| +
|
| + double frame_duration_milliseconds_;
|
| +
|
| + int audio_delay_milliseconds_;
|
| +
|
| DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioRenderer);
|
| };
|
|
|
|
|