diff options
author | xians@chromium.org <xians@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-17 18:52:41 +0000 |
---|---|---|
committer | xians@chromium.org <xians@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-17 18:52:41 +0000 |
commit | 8f66e2064599b2afd1014d94147fe6895fea9feb (patch) | |
tree | f81932b3d2b4de42f7656c453623620cde0408ae /content/renderer/media/webrtc_local_audio_track.h | |
parent | 277ec1eadd35756dee241af0b2095022fa252c60 (diff) | |
download | chromium_src-8f66e2064599b2afd1014d94147fe6895fea9feb.zip chromium_src-8f66e2064599b2afd1014d94147fe6895fea9feb.tar.gz chromium_src-8f66e2064599b2afd1014d94147fe6895fea9feb.tar.bz2 |
Switch LiveAudio to a source provider solution.
The current LiveAudio has some problems since it creates its own input stream instead of using the stream from gUM.
This patch will make the WebAudio uses the data from gUM through a source provider.
BUG=257963
TEST=content_unittests && http://webrtc.googlecode.com/svn/trunk/samples/js/demos/html/webaudio-and-webrtc.html
Review URL: https://chromiumcodereview.appspot.com/23691038
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223648 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 | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/content/renderer/media/webrtc_local_audio_track.h b/content/renderer/media/webrtc_local_audio_track.h index a3b818e..01b1120 100644 --- a/content/renderer/media/webrtc_local_audio_track.h +++ b/content/renderer/media/webrtc_local_audio_track.h @@ -18,10 +18,15 @@ namespace cricket { class AudioRenderer; -} +} // namespace cricket + +namespace media { +class AudioBus; +} // namespace media namespace content { +class WebAudioCapturerSource; class WebRtcAudioCapturer; class WebRtcAudioCapturerSinkOwner; @@ -38,7 +43,8 @@ class CONTENT_EXPORT WebRtcLocalAudioTrack static scoped_refptr<WebRtcLocalAudioTrack> Create( const std::string& id, const scoped_refptr<WebRtcAudioCapturer>& capturer, - webrtc::AudioSourceInterface* stream_source, + WebAudioCapturerSource* webaudio_source, + webrtc::AudioSourceInterface* track_source, const webrtc::MediaConstraintsInterface* constraints); // Add a sink to the track. This function will trigger a SetCaptureFormat() @@ -58,13 +64,11 @@ class CONTENT_EXPORT WebRtcLocalAudioTrack // should be called only once when audio track going away. void Stop(); - // Method called by the capturer to deliever the capture data. - void CaptureData(const int16* audio_data, - int number_of_channels, - int number_of_frames, - int audio_delay_milliseconds, - int volume, - bool key_pressed); + // Method called by the capturer to deliver the capture data. + void Capture(media::AudioBus* audio_source, + int audio_delay_milliseconds, + int volume, + bool key_pressed); // Method called by the capturer to set the audio parameters used by source // of the capture data.. @@ -72,10 +76,13 @@ class CONTENT_EXPORT WebRtcLocalAudioTrack void SetCaptureFormat(const media::AudioParameters& params); protected: - WebRtcLocalAudioTrack(const std::string& label, - const scoped_refptr<WebRtcAudioCapturer>& capturer, - webrtc::AudioSourceInterface* track_source, - const webrtc::MediaConstraintsInterface* constraints); + WebRtcLocalAudioTrack( + const std::string& label, + const scoped_refptr<WebRtcAudioCapturer>& capturer, + WebAudioCapturerSource* webaudio_source, + webrtc::AudioSourceInterface* track_source, + const webrtc::MediaConstraintsInterface* constraints); + virtual ~WebRtcLocalAudioTrack(); private: @@ -96,6 +103,10 @@ class CONTENT_EXPORT WebRtcLocalAudioTrack // 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_; @@ -106,9 +117,6 @@ class CONTENT_EXPORT WebRtcLocalAudioTrack // Used to DCHECK that we are called on the correct thread. base::ThreadChecker thread_checker_; - // Cached values of the audio parameters used by the |source_| and |sinks_|. - media::AudioParameters params_; - // Protects |params_| and |sinks_|. mutable base::Lock lock_; @@ -117,6 +125,11 @@ 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_; + DISALLOW_COPY_AND_ASSIGN(WebRtcLocalAudioTrack); }; |