Index: content/renderer/media/webrtc_audio_capturer.cc |
diff --git a/content/renderer/media/webrtc_audio_capturer.cc b/content/renderer/media/webrtc_audio_capturer.cc |
index e47beeada9599414a4b77d88ab07eb3457584baf..008cede0a39aaccaa17f9f160e3ae0714e91a2eb 100644 |
--- a/content/renderer/media/webrtc_audio_capturer.cc |
+++ b/content/renderer/media/webrtc_audio_capturer.cc |
@@ -331,10 +331,17 @@ void WebRtcAudioCapturer::SetCapturerSource( |
16, buffer_size, |
device_info_.device.input.effects); |
+ // Hack to test. |
+ media::AudioParameters params_msap( |
+ media::AudioParameters::AUDIO_PCM_LOW_LATENCY, |
+ media::CHANNEL_LAYOUT_STEREO, |
+ 0, sample_rate, 16, buffer_size, |
+ device_info_.device.input.effects); |
+ |
{ |
base::AutoLock auto_lock(lock_); |
// Notify the |audio_processor_| of the new format. |
- audio_processor_->OnCaptureFormatChanged(params); |
+ audio_processor_->OnCaptureFormatChanged(params_msap); |
MediaAudioConstraints audio_constraints(constraints_, |
device_info_.device.input.effects); |
@@ -495,20 +502,30 @@ void WebRtcAudioCapturer::Capture(const media::AudioBus* audio_source, |
} |
DCHECK(audio_processor_->InputFormat().IsValid()); |
- DCHECK_EQ(audio_source->channels(), |
- audio_processor_->InputFormat().channels()); |
+// DCHECK_EQ(audio_source->channels(), |
+// audio_processor_->InputFormat().channels()); |
DCHECK_EQ(audio_source->frames(), |
audio_processor_->InputFormat().frames_per_buffer()); |
+ scoped_ptr<media::AudioBus> audio_source_2ch = |
+ media::AudioBus::CreateWrapper(2); |
+ audio_source_2ch->SetChannelData(0, audio_source->channel(0)); |
+ audio_source_2ch->SetChannelData(1, audio_source->channel(1)); |
+ audio_source_2ch->set_frames(audio_source->frames()); |
+ |
// Notify the tracks on when the format changes. This will do nothing if |
// |tracks_to_notify_format| is empty. |
media::AudioParameters output_params = audio_processor_->OutputFormat(); |
+// LOG(ERROR) << "***** LAYOUT: " << output_params.channel_layout(); |
for (TrackList::ItemList::const_iterator it = tracks_to_notify_format.begin(); |
it != tracks_to_notify_format.end(); ++it) { |
(*it)->OnSetFormat(output_params); |
(*it)->SetAudioProcessor(audio_processor_); |
} |
+// LOG(ERROR) << "***** FRAMES = " << audio_source->frames(); |
+// LOG(ERROR) << "***** FRAMES 2ch = " << audio_source_2ch->frames(); |
+ |
if ((base::TimeTicks::Now() - last_audio_level_log_time_).InSeconds() > |
kPowerMonitorLogIntervalSeconds) { |
audio_power_monitor_.Scan(*audio_source, audio_source->frames()); |
@@ -524,7 +541,8 @@ void WebRtcAudioCapturer::Capture(const media::AudioBus* audio_source, |
} |
// Push the data to the processor for processing. |
- audio_processor_->PushCaptureData(audio_source); |
+// audio_processor_->PushCaptureData(audio_source); |
+ audio_processor_->PushCaptureData(audio_source_2ch.get()); |
// Process and consume the data in the processor until there is not enough |
// data in the processor. |