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

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

Issue 190713004: Only turn on the audio processing by default for MEDIA_DEVICE_AUDIO_CAPTURE (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: added unittest to protect the use cases. 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/media_stream_audio_processor.cc
diff --git a/content/renderer/media/media_stream_audio_processor.cc b/content/renderer/media/media_stream_audio_processor.cc
index b055dcc6699c7a906650d5a7d8e26a1973a7d6a9..e19591998e330ef01466e1208e951277c892b3d8 100644
--- a/content/renderer/media/media_stream_audio_processor.cc
+++ b/content/renderer/media/media_stream_audio_processor.cc
@@ -143,6 +143,7 @@ MediaStreamAudioProcessor::MediaStreamAudioProcessor(
const media::AudioParameters& source_params,
const blink::WebMediaConstraints& constraints,
int effects,
+ MediaStreamType type,
WebRtcPlayoutDataSource* playout_data_source)
: render_delay_ms_(0),
playout_data_source_(playout_data_source),
@@ -150,7 +151,7 @@ MediaStreamAudioProcessor::MediaStreamAudioProcessor(
typing_detected_(false) {
capture_thread_checker_.DetachFromThread();
render_thread_checker_.DetachFromThread();
- InitializeAudioProcessingModule(constraints, effects);
+ InitializeAudioProcessingModule(constraints, effects, type);
InitializeCaptureConverter(source_params);
}
@@ -233,7 +234,8 @@ void MediaStreamAudioProcessor::GetStats(AudioProcessorStats* stats) {
}
void MediaStreamAudioProcessor::InitializeAudioProcessingModule(
- const blink::WebMediaConstraints& constraints, int effects) {
+ const blink::WebMediaConstraints& constraints, int effects,
+ MediaStreamType type) {
DCHECK(!audio_processing_);
if (!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableAudioTrackProcessing)) {
@@ -241,7 +243,12 @@ void MediaStreamAudioProcessor::InitializeAudioProcessingModule(
}
RTCMediaConstraints native_constraints(constraints);
- ApplyFixedAudioConstraints(&native_constraints);
+
+ // Only apply the fixed constraints for gUM of MEDIA_DEVICE_AUDIO_CAPTURE.
+ DCHECK(IsAudioMediaType(type));
+ if (type == MEDIA_DEVICE_AUDIO_CAPTURE)
+ ApplyFixedAudioConstraints(&native_constraints);
+
if (effects & media::AudioParameters::ECHO_CANCELLER) {
// If platform echo canceller is enabled, disable the software AEC.
native_constraints.AddMandatory(

Powered by Google App Engine
This is Rietveld 408576698