| Index: content/renderer/media/webrtc_local_audio_track.h
|
| diff --git a/content/renderer/media/webrtc_local_audio_track.h b/content/renderer/media/webrtc_local_audio_track.h
|
| index 01b11208021d3e32198eb3061f1895957fb7f29d..64f20fe70b1d9bac3a60823bc84ba9639b31f355 100644
|
| --- a/content/renderer/media/webrtc_local_audio_track.h
|
| +++ b/content/renderer/media/webrtc_local_audio_track.h
|
| @@ -11,6 +11,7 @@
|
| #include "base/synchronization/lock.h"
|
| #include "base/threading/thread_checker.h"
|
| #include "content/renderer/media/webrtc_audio_device_impl.h"
|
| +#include "content/renderer/media/webrtc_local_audio_source_provider.h"
|
| #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface.h"
|
| #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h"
|
| #include "third_party/libjingle/source/talk/app/webrtc/mediastreamtrack.h"
|
| @@ -29,6 +30,7 @@ namespace content {
|
| class WebAudioCapturerSource;
|
| class WebRtcAudioCapturer;
|
| class WebRtcAudioCapturerSinkOwner;
|
| +class WebRtcAudioProcessor;
|
|
|
| // A WebRtcLocalAudioTrack instance contains the implementations of
|
| // MediaStreamTrack and WebRtcAudioCapturerSink.
|
| @@ -38,14 +40,16 @@ class WebRtcAudioCapturerSinkOwner;
|
| class CONTENT_EXPORT WebRtcLocalAudioTrack
|
| : NON_EXPORTED_BASE(public cricket::AudioRenderer),
|
| NON_EXPORTED_BASE(
|
| - public webrtc::MediaStreamTrack<webrtc::AudioTrackInterface>) {
|
| + public webrtc::MediaStreamTrack<webrtc::AudioTrackInterface>),
|
| + NON_EXPORTED_BASE(public WebRtcAudioRenderDataObserver) {
|
| public:
|
| static scoped_refptr<WebRtcLocalAudioTrack> Create(
|
| const std::string& id,
|
| const scoped_refptr<WebRtcAudioCapturer>& capturer,
|
| WebAudioCapturerSource* webaudio_source,
|
| webrtc::AudioSourceInterface* track_source,
|
| - const webrtc::MediaConstraintsInterface* constraints);
|
| + const webrtc::MediaConstraintsInterface* constraints,
|
| + WebRtcAudioDeviceImpl* audio_device);
|
|
|
| // Add a sink to the track. This function will trigger a SetCaptureFormat()
|
| // call on the |sink|.
|
| @@ -60,8 +64,8 @@ class CONTENT_EXPORT WebRtcLocalAudioTrack
|
| // should be called only once when audio track is created.
|
| void Start();
|
|
|
| - // Stops the local audio track. Called on the main render thread and
|
| - // should be called only once when audio track going away.
|
| + // Stops the local audio track. Called on the main render thread by the
|
| + // capturer and should be called only once when audio track going away.
|
| void Stop();
|
|
|
| // Method called by the capturer to deliver the capture data.
|
| @@ -75,13 +79,18 @@ class CONTENT_EXPORT WebRtcLocalAudioTrack
|
| // Can be called on different user threads.
|
| void SetCaptureFormat(const media::AudioParameters& params);
|
|
|
| + WebKit::WebAudioSourceProvider* audio_source_provider() const {
|
| + return source_provider_.get();
|
| + }
|
| +
|
| protected:
|
| WebRtcLocalAudioTrack(
|
| const std::string& label,
|
| const scoped_refptr<WebRtcAudioCapturer>& capturer,
|
| WebAudioCapturerSource* webaudio_source,
|
| webrtc::AudioSourceInterface* track_source,
|
| - const webrtc::MediaConstraintsInterface* constraints);
|
| + const webrtc::MediaConstraintsInterface* constraints,
|
| + WebRtcAudioDeviceImpl* audio_device);
|
|
|
| virtual ~WebRtcLocalAudioTrack();
|
|
|
| @@ -99,6 +108,14 @@ class CONTENT_EXPORT WebRtcLocalAudioTrack
|
| // webrtc::MediaStreamTrack implementation.
|
| virtual std::string kind() const OVERRIDE;
|
|
|
| + // WebRtcAudioRenderDataObserver implementation.
|
| + virtual void OnRenderData(const int16* render_audio,
|
| + int sample_rate,
|
| + int number_of_channels,
|
| + int number_of_frames,
|
| + int render_delay_ms) OVERRIDE;
|
| + virtual void OnRenderClosing() OVERRIDE;
|
| +
|
| // The provider of captured data to render.
|
| // The WebRtcAudioCapturer is today created by WebRtcAudioDeviceImpl.
|
| scoped_refptr<WebRtcAudioCapturer> capturer_;
|
| @@ -125,10 +142,19 @@ class CONTENT_EXPORT WebRtcLocalAudioTrack
|
|
|
| bool need_audio_processing_;
|
|
|
| - // Buffers used for temporary storage during capture callbacks.
|
| - // Allocated during initialization.
|
| - class ConfiguredBuffer;
|
| - scoped_refptr<ConfiguredBuffer> buffer_;
|
| + // Cached audio parameters for the source.
|
| + media::AudioParameters source_params_;
|
| +
|
| + // Cached audio parameters for the sinks.
|
| + media::AudioParameters sink_params_;
|
| +
|
| + scoped_ptr<WebRtcAudioProcessor> audio_processor_;
|
| +
|
| + // The source provider to feed the track data to other clients like
|
| + // WebAudio.
|
| + const scoped_ptr<WebRtcLocalAudioSourceProvider> source_provider_;
|
| +
|
| + WebRtcAudioDeviceImpl* audio_device_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(WebRtcLocalAudioTrack);
|
| };
|
|
|