Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(938)

Unified Diff: content/renderer/media/webrtc_audio_capturer.cc

Issue 255753003: Test code for issue 3 channels audio. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/audio/audio_input_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | media/audio/audio_input_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698