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

Side by Side Diff: content/renderer/media/media_stream_audio_processor.cc

Issue 200343002: trivial change to remove the hard coding to mono as the output channel layout in MSAP. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/media_stream_audio_processor.h" 5 #include "content/renderer/media/media_stream_audio_processor.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "content/public/common/content_switches.h" 10 #include "content/public/common/content_switches.h"
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 DCHECK(source_params.IsValid()); 369 DCHECK(source_params.IsValid());
370 370
371 // Create and initialize audio converter for the source data. 371 // Create and initialize audio converter for the source data.
372 // When the webrtc AudioProcessing is enabled, the sink format of the 372 // When the webrtc AudioProcessing is enabled, the sink format of the
373 // converter will be the same as the post-processed data format, which is 373 // converter will be the same as the post-processed data format, which is
374 // 32k mono for desktops and 16k mono for Android. When the AudioProcessing 374 // 32k mono for desktops and 16k mono for Android. When the AudioProcessing
375 // is disabled, the sink format will be the same as the source format. 375 // is disabled, the sink format will be the same as the source format.
376 const int sink_sample_rate = audio_processing_ ? 376 const int sink_sample_rate = audio_processing_ ?
377 kAudioProcessingSampleRate : source_params.sample_rate(); 377 kAudioProcessingSampleRate : source_params.sample_rate();
378 const media::ChannelLayout sink_channel_layout = audio_processing_ ? 378 const media::ChannelLayout sink_channel_layout = audio_processing_ ?
379 media::CHANNEL_LAYOUT_MONO : source_params.channel_layout(); 379 media::GuessChannelLayout(kAudioProcessingNumberOfChannel) :
380 source_params.channel_layout();
380 381
381 // WebRtc AudioProcessing requires 10ms as its packet size. We use this 382 // WebRtc AudioProcessing requires 10ms as its packet size. We use this
382 // native size when processing is enabled. While processing is disabled, and 383 // native size when processing is enabled. While processing is disabled, and
383 // the source is running with a buffer size smaller than 10ms buffer, we use 384 // the source is running with a buffer size smaller than 10ms buffer, we use
384 // same buffer size as the incoming format to avoid extra FIFO for WebAudio. 385 // same buffer size as the incoming format to avoid extra FIFO for WebAudio.
385 int sink_buffer_size = sink_sample_rate / 100; 386 int sink_buffer_size = sink_sample_rate / 100;
386 if (!audio_processing_ && 387 if (!audio_processing_ &&
387 source_params.frames_per_buffer() < sink_buffer_size) { 388 source_params.frames_per_buffer() < sink_buffer_size) {
388 sink_buffer_size = source_params.frames_per_buffer(); 389 sink_buffer_size = source_params.frames_per_buffer();
389 } 390 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 } 489 }
489 490
490 bool MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled() const { 491 bool MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled() const {
491 const std::string group_name = 492 const std::string group_name =
492 base::FieldTrialList::FindFullName("MediaStreamAudioTrackProcessing"); 493 base::FieldTrialList::FindFullName("MediaStreamAudioTrackProcessing");
493 return group_name == "Enabled" || CommandLine::ForCurrentProcess()->HasSwitch( 494 return group_name == "Enabled" || CommandLine::ForCurrentProcess()->HasSwitch(
494 switches::kEnableAudioTrackProcessing); 495 switches::kEnableAudioTrackProcessing);
495 } 496 }
496 497
497 } // namespace content 498 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698