diff options
author | xians@chromium.org <xians@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-04 13:34:42 +0000 |
---|---|---|
committer | xians@chromium.org <xians@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-04 13:34:42 +0000 |
commit | 0787ddee87bd9f3c2c1f5abe974c333fbd83ebb5 (patch) | |
tree | f313c6ca7a30a58a8bde56d5e50cc446eb1ead59 /content/renderer/media/webrtc_local_audio_track.h | |
parent | ff5fd94140097638abb9d4b877ece9760e37daac (diff) | |
download | chromium_src-0787ddee87bd9f3c2c1f5abe974c333fbd83ebb5.zip chromium_src-0787ddee87bd9f3c2c1f5abe974c333fbd83ebb5.tar.gz chromium_src-0787ddee87bd9f3c2c1f5abe974c333fbd83ebb5.tar.bz2 |
WIP: Isolate the libjingle dependency of WebRtcLocalAudioTrack into an adapter class.
This CL is taking over from https://codereview.chromium.org/123943003/ which creates an adapter for the local audio track and hide all the libjingle webrtc interfaces/objects into the adapter.
BUG=325675
TEST=content_unittests and content_browsertets, nothing breaks.
R=jamesr@chromium.org, joi@chromium.org
Review URL: https://codereview.chromium.org/151503004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248712 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/media/webrtc_local_audio_track.h')
-rw-r--r-- | content/renderer/media/webrtc_local_audio_track.h | 62 |
1 files changed, 14 insertions, 48 deletions
diff --git a/content/renderer/media/webrtc_local_audio_track.h b/content/renderer/media/webrtc_local_audio_track.h index 53444ec..0ead7ee 100644 --- a/content/renderer/media/webrtc_local_audio_track.h +++ b/content/renderer/media/webrtc_local_audio_track.h @@ -8,47 +8,37 @@ #include <list> #include <string> +#include "base/memory/ref_counted.h" #include "base/synchronization/lock.h" #include "base/threading/thread_checker.h" -#include "content/renderer/media/media_stream_audio_track_sink.h" +#include "content/renderer/media/media_stream_track_extra_data.h" #include "content/renderer/media/tagged_list.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/mediastreaminterface.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreamtrack.h" -#include "third_party/libjingle/source/talk/media/base/audiorenderer.h" - -namespace cricket { -class AudioRenderer; -} // namespace cricket - -namespace media { -class AudioBus; -} // namespace media namespace content { class MediaStreamAudioSink; class MediaStreamAudioSinkOwner; +class MediaStreamAudioTrackSink; class PeerConnectionAudioSink; class WebAudioCapturerSource; class WebRtcAudioCapturer; +class WebRtcLocalAudioTrackAdapter; // A WebRtcLocalAudioTrack instance contains the implementations of -// MediaStreamTrack and MediaStreamAudioSink. +// MediaStreamTrackExtraData. // When an instance is created, it will register itself as a track to the // WebRtcAudioCapturer to get the captured data, and forward the data to // its |sinks_|. The data flow can be stopped by disabling the audio track. class CONTENT_EXPORT WebRtcLocalAudioTrack - : NON_EXPORTED_BASE(public cricket::AudioRenderer), - NON_EXPORTED_BASE( - public webrtc::MediaStreamTrack<webrtc::AudioTrackInterface>) { + : NON_EXPORTED_BASE(public MediaStreamTrackExtraData) { public: - static scoped_refptr<WebRtcLocalAudioTrack> Create( - const std::string& id, - const scoped_refptr<WebRtcAudioCapturer>& capturer, - WebAudioCapturerSource* webaudio_source, - webrtc::AudioSourceInterface* track_source); + WebRtcLocalAudioTrack(WebRtcLocalAudioTrackAdapter* adapter, + const scoped_refptr<WebRtcAudioCapturer>& capturer, + WebAudioCapturerSource* webaudio_source); + + virtual ~WebRtcLocalAudioTrack(); // Add a sink to the track. This function will trigger a OnSetFormat() // call on the |sink|. @@ -90,41 +80,20 @@ class CONTENT_EXPORT WebRtcLocalAudioTrack return source_provider_.get(); } - protected: - WebRtcLocalAudioTrack( - const std::string& label, - const scoped_refptr<WebRtcAudioCapturer>& capturer, - WebAudioCapturerSource* webaudio_source, - webrtc::AudioSourceInterface* track_source); - - virtual ~WebRtcLocalAudioTrack(); - private: typedef TaggedList<MediaStreamAudioTrackSink> SinkList; - // cricket::AudioCapturer implementation. - virtual void AddChannel(int channel_id) OVERRIDE; - virtual void RemoveChannel(int channel_id) OVERRIDE; - - // webrtc::AudioTrackInterface implementation. - virtual webrtc::AudioSourceInterface* GetSource() const OVERRIDE; - virtual cricket::AudioRenderer* GetRenderer() OVERRIDE; - - // webrtc::MediaStreamTrack implementation. - virtual std::string kind() const OVERRIDE; + // All usage of libjingle is through this adapter. The adapter holds + // a reference on this object, but not vice versa. + WebRtcLocalAudioTrackAdapter* adapter_; // The provider of captured data to render. - // The WebRtcAudioCapturer is today created by WebRtcAudioDeviceImpl. scoped_refptr<WebRtcAudioCapturer> capturer_; // The source of the audio track which is used by WebAudio, which provides // data to the audio track when hooking up with WebAudio. scoped_refptr<WebAudioCapturerSource> webaudio_source_; - // The source of the audio track which handles the audio constraints. - // TODO(xians): merge |track_source_| to |capturer_|. - talk_base::scoped_refptr<webrtc::AudioSourceInterface> track_source_; - // A tagged list of sinks that the audio data is fed to. Tags // indicate tracks that need to be notified that the audio format // has changed. @@ -139,9 +108,6 @@ class CONTENT_EXPORT WebRtcLocalAudioTrack // Protects |params_| and |sinks_|. mutable base::Lock lock_; - // A vector of WebRtc VoE channels that the capturer sends data to. - std::vector<int> voe_channels_; - // Audio parameters of the audio capture stream. // Accessed on only the audio capture thread. media::AudioParameters audio_parameters_; |