| 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 2df3604977c8daf5c3695af544c2831ac073210d..dccdf7703fd4c81832b12ed9469279671c593fe3 100644
|
| --- a/content/renderer/media/media_stream_audio_processor.cc
|
| +++ b/content/renderer/media/media_stream_audio_processor.cc
|
| @@ -428,6 +428,48 @@ void MediaStreamAudioProcessor::OnIpcClosing() {
|
| aec_dump_message_filter_ = NULL;
|
| }
|
|
|
| +// static
|
| +bool MediaStreamAudioProcessor::ShouldRouteAudioThroughProcessor(
|
| + const blink::WebMediaConstraints& constraints,
|
| + int effects_flags) {
|
| + // Note: This method should by kept in-sync with any changes to the logic in
|
| + // MediaStreamAudioProcessor::InitializeAudioProcessingModule().
|
| +
|
| + const MediaAudioConstraints audio_constraints(constraints, effects_flags);
|
| +
|
| + if (audio_constraints.GetProperty(MediaAudioConstraints::kGoogAudioMirroring))
|
| + return true;
|
| +
|
| +#if !defined(OS_IOS)
|
| + if (audio_constraints.GetEchoCancellationProperty() ||
|
| + audio_constraints.GetProperty(
|
| + MediaAudioConstraints::kGoogAutoGainControl)) {
|
| + return true;
|
| + }
|
| +#endif
|
| +
|
| +#if !defined(OS_IOS) && !defined(OS_ANDROID)
|
| + if (audio_constraints.GetProperty(
|
| + MediaAudioConstraints::kGoogExperimentalEchoCancellation) ||
|
| + audio_constraints.GetProperty(
|
| + MediaAudioConstraints::kGoogTypingNoiseDetection)) {
|
| + return true;
|
| + }
|
| +#endif
|
| +
|
| + if (audio_constraints.GetProperty(
|
| + MediaAudioConstraints::kGoogNoiseSuppression) ||
|
| + audio_constraints.GetProperty(
|
| + MediaAudioConstraints::kGoogExperimentalNoiseSuppression) ||
|
| + audio_constraints.GetProperty(MediaAudioConstraints::kGoogBeamforming) ||
|
| + audio_constraints.GetProperty(
|
| + MediaAudioConstraints::kGoogHighpassFilter)) {
|
| + return true;
|
| + }
|
| +
|
| + return false;
|
| +}
|
| +
|
| void MediaStreamAudioProcessor::OnPlayoutData(media::AudioBus* audio_bus,
|
| int sample_rate,
|
| int audio_delay_milliseconds) {
|
| @@ -522,8 +564,16 @@ void MediaStreamAudioProcessor::InitializeAudioProcessingModule(
|
| if (!echo_cancellation && !goog_experimental_aec && !goog_ns &&
|
| !goog_high_pass_filter && !goog_typing_detection &&
|
| !goog_agc && !goog_experimental_ns && !goog_beamforming) {
|
| + // Ensure ShouldRouteAudioThroughProcessor() is kept in-sync with all of the
|
| + // above logic.
|
| + DCHECK_EQ(audio_mirroring_, ShouldRouteAudioThroughProcessor(
|
| + constraints, input_params.effects));
|
| RecordProcessingState(AUDIO_PROCESSING_DISABLED);
|
| return;
|
| + } else {
|
| + // Ensure ShouldRouteAudioThroughProcessor() is kept in-sync with all of the
|
| + // above logic.
|
| + DCHECK(ShouldRouteAudioThroughProcessor(constraints, input_params.effects));
|
| }
|
|
|
| // Experimental options provided at creation.
|
|
|