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

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

Issue 1647773002: MediaStream audio sourcing: Bypass audio processing for non-WebRTC cases. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NOT FOR REVIEW -- This will be broken-up across multiple CLs. Created 4 years, 10 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 7ae75a0c86672761a4251cd7c8690d09ddd40b39..640cfefd5847cac3a87cf0e27fde44673db5e834 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.
« no previous file with comments | « content/renderer/media/media_stream_audio_processor.h ('k') | content/renderer/media/media_stream_audio_sink_owner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698