Index: content/renderer/media/webaudio_capturer_source.cc |
diff --git a/content/renderer/media/webaudio_capturer_source.cc b/content/renderer/media/webaudio_capturer_source.cc |
index f9bf084cccd9304556b772b4cd251e4a03b6f45f..96f5fb5810c4e4e35f7f1852ba1c03288d321750 100644 |
--- a/content/renderer/media/webaudio_capturer_source.cc |
+++ b/content/renderer/media/webaudio_capturer_source.cc |
@@ -5,7 +5,7 @@ |
#include "content/renderer/media/webaudio_capturer_source.h" |
#include "base/logging.h" |
-#include "content/renderer/media/webrtc_local_audio_source_provider.h" |
+#include "content/renderer/media/webrtc_audio_capturer.h" |
#include "content/renderer/media/webrtc_local_audio_track.h" |
using media::AudioBus; |
@@ -21,7 +21,7 @@ namespace content { |
WebAudioCapturerSource::WebAudioCapturerSource() |
: track_(NULL), |
- source_provider_(NULL) { |
+ capturer_(NULL) { |
} |
WebAudioCapturerSource::~WebAudioCapturerSource() { |
@@ -30,7 +30,7 @@ WebAudioCapturerSource::~WebAudioCapturerSource() { |
void WebAudioCapturerSource::setFormat( |
size_t number_of_channels, float sample_rate) { |
DCHECK(thread_checker_.CalledOnValidThread()); |
- DVLOG(1) << "WebAudioCapturerSource::setFormat(sample_rate=" |
+ DLOG(WARNING) << "WebAudioCapturerSource::setFormat(sample_rate=" |
<< sample_rate << ")"; |
if (number_of_channels > 2) { |
// TODO(xians): Handle more than just the mono and stereo cases. |
@@ -62,26 +62,26 @@ void WebAudioCapturerSource::setFormat( |
} |
void WebAudioCapturerSource::Start( |
- WebRtcLocalAudioTrack* track, |
- WebRtcLocalAudioSourceProvider* source_provider) { |
+ WebRtcLocalAudioTrack* track, WebRtcAudioCapturer* capturer) { |
DCHECK(thread_checker_.CalledOnValidThread()); |
DCHECK(track); |
// |source_provider| may be NULL if no getUserMedia has been called before |
// calling CreateMediaStreamDestination. |
// The downstream client should be configured the same as what WebKit |
// is feeding it. |
- track->SetCaptureFormat(params_); |
+ if (params_.IsValid()) |
+ track->SetCaptureFormat(params_); |
base::AutoLock auto_lock(lock_); |
track_ = track; |
- source_provider_ = source_provider; |
+ capturer_ = capturer; |
} |
void WebAudioCapturerSource::Stop() { |
DCHECK(thread_checker_.CalledOnValidThread()); |
base::AutoLock auto_lock(lock_); |
track_ = NULL; |
- source_provider_ = NULL; |
+ capturer_ = NULL; |
} |
void WebAudioCapturerSource::consumeAudio( |
@@ -113,11 +113,12 @@ void WebAudioCapturerSource::consumeAudio( |
int volume = 0; |
bool key_pressed = false; |
while (fifo_->frames() >= capture_frames) { |
- if (source_provider_) { |
- source_provider_->GetAudioProcessingParams( |
+ if (capturer_) { |
+ capturer_->GetAudioProcessingParams( |
&delay_ms, &volume, &key_pressed); |
} |
fifo_->Consume(capture_bus_.get(), 0, capture_frames); |
+ // TODO(xians): Convert the format and feed it to the track. |
track_->Capture(capture_bus_.get(), delay_ms, volume, key_pressed); |
} |
} |