Chromium Code Reviews| 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 c83ffff7eb408417dd9a641fc3c93f92a032119f..490472dd781bf56cd7d02e9587c7c4dfc8e5d889 100644 |
| --- a/content/renderer/media/media_stream_audio_processor.cc |
| +++ b/content/renderer/media/media_stream_audio_processor.cc |
| @@ -280,29 +280,18 @@ void MediaStreamAudioProcessor::InitializeAudioProcessingModule( |
| MediaStreamType type) { |
| DCHECK(!audio_processing_); |
| - RTCMediaConstraints native_constraints(constraints); |
| - |
| // Audio mirroring can be enabled even though audio processing is otherwise |
| // disabled. |
| audio_mirroring_ = GetPropertyFromConstraints( |
| - &native_constraints, webrtc::MediaConstraintsInterface::kAudioMirroring); |
| + constraints, kGoogAudioMirroring, effects, type); |
| if (!IsAudioTrackProcessingEnabled()) { |
| RecordProcessingState(AUDIO_PROCESSING_IN_WEBRTC); |
| return; |
| } |
| - // 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( |
| - MediaConstraintsInterface::kEchoCancellation, |
| - MediaConstraintsInterface::kValueFalse, true); |
| - } |
| + const bool echo_calcellation = GetPropertyFromConstraints( |
|
perkj_chrome
2014/04/08 10:28:12
nit: move to where its used.
tommi (sloooow) - chröme
2014/04/08 10:49:30
echo_cancellation (not calcellation)
Actually, I
no longer working on chromium
2014/04/11 08:56:30
Added code to return immediately when the echo_can
no longer working on chromium
2014/04/11 08:56:30
Done.
|
| + constraints, kEchoCancellation, effects, type); |
| #if defined(OS_IOS) |
| // On iOS, VPIO provides built-in AEC and AGC. |
| @@ -310,9 +299,9 @@ void MediaStreamAudioProcessor::InitializeAudioProcessingModule( |
| const bool enable_agc = false; |
| #else |
| const bool enable_aec = GetPropertyFromConstraints( |
|
tommi (sloooow) - chröme
2014/04/08 10:49:30
can you change the name of this variable to e.g. g
no longer working on chromium
2014/04/11 08:56:30
Done.
|
| - &native_constraints, MediaConstraintsInterface::kEchoCancellation); |
| + constraints, kGoogEchoCancellation, effects, type); |
| const bool enable_agc = GetPropertyFromConstraints( |
|
tommi (sloooow) - chröme
2014/04/08 10:49:30
same here and below.
no longer working on chromium
2014/04/11 08:56:30
Done.
|
| - &native_constraints, webrtc::MediaConstraintsInterface::kAutoGainControl); |
| + constraints, kGoogAutoGainControl, effects, type); |
| #endif |
| #if defined(OS_IOS) || defined(OS_ANDROID) |
| @@ -320,24 +309,25 @@ void MediaStreamAudioProcessor::InitializeAudioProcessingModule( |
| const bool enable_typing_detection = false; |
| #else |
| const bool enable_experimental_aec = GetPropertyFromConstraints( |
| - &native_constraints, |
| - MediaConstraintsInterface::kExperimentalEchoCancellation); |
| + constraints, kGoogExperimentalEchoCancellation, effects, type); |
| const bool enable_typing_detection = GetPropertyFromConstraints( |
| - &native_constraints, MediaConstraintsInterface::kTypingNoiseDetection); |
| + constraints, kGoogTypingNoiseDetection, effects, type); |
| #endif |
| const bool enable_ns = GetPropertyFromConstraints( |
| - &native_constraints, MediaConstraintsInterface::kNoiseSuppression); |
| + constraints, kGoogNoiseSuppression, effects, type); |
| const bool enable_experimental_ns = GetPropertyFromConstraints( |
| - &native_constraints, |
| - MediaConstraintsInterface::kExperimentalNoiseSuppression); |
| + constraints, kGoogExperimentalNoiseSuppression, effects, type); |
| const bool enable_high_pass_filter = GetPropertyFromConstraints( |
| - &native_constraints, MediaConstraintsInterface::kHighpassFilter); |
| - |
| - // Return immediately if no audio processing component is enabled. |
| - if (!enable_aec && !enable_experimental_aec && !enable_ns && |
| - !enable_high_pass_filter && !enable_typing_detection && !enable_agc && |
| - !enable_experimental_ns) { |
| + constraints, kGoogHighpassFilter, effects, type); |
| + |
| + // |echo_calcellation| is used as a master control on enabling/disabling |
|
tommi (sloooow) - chröme
2014/04/08 10:49:30
fix typo here as well
no longer working on chromium
2014/04/11 08:56:30
Done.
|
| + // the audio processing. Another way to disable the audio processing is to |
| + // turn off all the goog* constraints explicitly. |
| + if (!echo_calcellation || |
|
no longer working on chromium
2014/04/08 10:02:53
The main change is here, echo_calcellation is true
perkj_chrome
2014/04/08 10:28:12
fix name echo_calcellation
tommi (sloooow) - chröme
2014/04/08 10:49:30
I think that we're unnecessarily querying all the
no longer working on chromium
2014/04/11 08:56:30
Done.
no longer working on chromium
2014/04/11 08:56:30
Done with avoid querying the constraints when echo
|
| + (!enable_aec && !enable_experimental_aec && !enable_ns && |
| + !enable_high_pass_filter && !enable_typing_detection && |
| + !enable_agc && !enable_experimental_ns)) { |
| RecordProcessingState(AUDIO_PROCESSING_DISABLED); |
| return; |
| } |