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

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

Issue 1464673002: Support multichannel audio stream more than 2 in MediaStreamDestinationNode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed intdentation Created 5 years, 1 month 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 | third_party/WebKit/LayoutTests/webaudio/mediastreamaudiodestinationnode.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 aae04ada6c8d7b00de747f971c65205ed04558e0..bcebcbb3e24e523288827db01d6b740a019a29fd 100644
--- a/content/renderer/media/webaudio_capturer_source.cc
+++ b/content/renderer/media/webaudio_capturer_source.cc
@@ -36,25 +36,29 @@ void WebAudioCapturerSource::setFormat(
DCHECK(thread_checker_.CalledOnValidThread());
DVLOG(1) << "WebAudioCapturerSource::setFormat(sample_rate="
<< sample_rate << ")";
- if (number_of_channels > 2) {
- // TODO(xians): Handle more than just the mono and stereo cases.
- LOG(WARNING) << "WebAudioCapturerSource::setFormat() : unhandled format.";
- return;
- }
+ // If the channel count is greater than 8, use discrete layout. However,
+ // anything beyond 8 is ignored by the subsequent (WebRTC) audio pipeline.
ChannelLayout channel_layout =
- number_of_channels == 1 ? CHANNEL_LAYOUT_MONO : CHANNEL_LAYOUT_STEREO;
+ number_of_channels > 8 ? media::CHANNEL_LAYOUT_DISCRETE
+ : media::GuessChannelLayout(number_of_channels);
base::AutoLock auto_lock(lock_);
+
// Set the format used by this WebAudioCapturerSource. We are using 10ms data
// as buffer size since that is the native buffer size of WebRtc packet
// running on.
params_.Reset(media::AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout,
sample_rate, 16, sample_rate / 100);
+
+ // Take care of the discrete channel layout case.
+ params_.set_channels_for_discrete(number_of_channels);
+
audio_format_changed_ = true;
wrapper_bus_ = AudioBus::CreateWrapper(params_.channels());
capture_bus_ = AudioBus::Create(params_);
+
fifo_.reset(new AudioFifo(
params_.channels(),
kMaxNumberOfBuffersInFifo * params_.frames_per_buffer()));
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webaudio/mediastreamaudiodestinationnode.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698