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

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

Issue 2219933003: Use LocalMediaStreamAudioSource for screen-casting use cases. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 9b8eaf35ffc0b438b550a88999166fd3653e47ea..1815705e9208094a5c850e866e2b038f8dec6f7b 100644
--- a/content/renderer/media/media_stream_audio_processor.cc
+++ b/content/renderer/media/media_stream_audio_processor.cc
@@ -449,6 +449,42 @@ 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().
xjz 2016/08/13 00:43:56 nit: The logic here is in sync with that in MediaS
miu 2016/08/16 04:30:02 Actually, it's perfectly in-sync. If GetGoogAudioM
+
+ const MediaAudioConstraints audio_constraints(constraints, effects_flags);
+
+ if (audio_constraints.GetGoogAudioMirroring())
+ return true;
+
+#if !defined(OS_IOS)
+ if (audio_constraints.GetEchoCancellationProperty() ||
+ audio_constraints.GetGoogAutoGainControl()) {
+ return true;
+ }
+#endif
+
+#if !defined(OS_IOS) && !defined(OS_ANDROID)
+ if (audio_constraints.GetGoogExperimentalEchoCancellation() ||
+ audio_constraints.GetGoogTypingNoiseDetection()) {
+ return true;
+ }
+#endif
+
+ if (audio_constraints.GetGoogNoiseSuppression() ||
+ audio_constraints.GetGoogExperimentalNoiseSuppression() ||
+ audio_constraints.GetGoogBeamforming() ||
+ audio_constraints.GetGoogHighpassFilter()) {
+ return true;
+ }
+
+ return false;
+}
+
void MediaStreamAudioProcessor::OnPlayoutData(media::AudioBus* audio_bus,
int sample_rate,
int audio_delay_milliseconds) {
@@ -538,8 +574,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(
o1ka 2016/08/15 15:15:00 See the comment above: it's confusing when ShouldR
miu 2016/08/16 04:30:02 I made some clarifications on these comments too.
+ 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.

Powered by Google App Engine
This is Rietveld 408576698