diff options
Diffstat (limited to 'webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioEffects.java')
-rw-r--r-- | webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioEffects.java | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioEffects.java b/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioEffects.java index 9b90f4ab54..c3ab043868 100644 --- a/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioEffects.java +++ b/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioEffects.java @@ -10,6 +10,7 @@ package org.webrtc.voiceengine; +import android.annotation.TargetApi; import android.media.audiofx.AcousticEchoCanceler; import android.media.audiofx.AudioEffect; import android.media.audiofx.AudioEffect.Descriptor; @@ -119,6 +120,7 @@ class WebRtcAudioEffects { // Returns true if the platform AEC should be excluded based on its UUID. // AudioEffect.queryEffects() can throw IllegalStateException. + @TargetApi(18) private static boolean isAcousticEchoCancelerExcludedByUUID() { for (Descriptor d : AudioEffect.queryEffects()) { if (d.type.equals(AudioEffect.EFFECT_TYPE_AEC) && @@ -131,6 +133,7 @@ class WebRtcAudioEffects { // Returns true if the platform AGC should be excluded based on its UUID. // AudioEffect.queryEffects() can throw IllegalStateException. + @TargetApi(18) private static boolean isAutomaticGainControlExcludedByUUID() { for (Descriptor d : AudioEffect.queryEffects()) { if (d.type.equals(AudioEffect.EFFECT_TYPE_AGC) && @@ -143,6 +146,7 @@ class WebRtcAudioEffects { // Returns true if the platform NS should be excluded based on its UUID. // AudioEffect.queryEffects() can throw IllegalStateException. + @TargetApi(18) private static boolean isNoiseSuppressorExcludedByUUID() { for (Descriptor d : AudioEffect.queryEffects()) { if (d.type.equals(AudioEffect.EFFECT_TYPE_NS) && @@ -208,15 +212,6 @@ class WebRtcAudioEffects { private WebRtcAudioEffects() { Logging.d(TAG, "ctor" + WebRtcAudioUtils.getThreadInfo()); - for (Descriptor d : AudioEffect.queryEffects()) { - if (effectTypeIsVoIP(d.type) || DEBUG) { - // Only log information for VoIP effects (AEC, AEC and NS). - Logging.d(TAG, "name: " + d.name + ", " - + "mode: " + d.connectMode + ", " - + "implementor: " + d.implementor + ", " - + "UUID: " + d.uuid); - } - } } // Call this method to enable or disable the platform AEC. It modifies @@ -282,6 +277,17 @@ class WebRtcAudioEffects { assertTrue(agc == null); assertTrue(ns == null); + // Add logging of supported effects but filter out "VoIP effects", i.e., + // AEC, AEC and NS. + for (Descriptor d : AudioEffect.queryEffects()) { + if (effectTypeIsVoIP(d.type) || DEBUG) { + Logging.d(TAG, "name: " + d.name + ", " + + "mode: " + d.connectMode + ", " + + "implementor: " + d.implementor + ", " + + "UUID: " + d.uuid); + } + } + if (isAcousticEchoCancelerSupported()) { // Create an AcousticEchoCanceler and attach it to the AudioRecord on // the specified audio session. @@ -366,7 +372,11 @@ class WebRtcAudioEffects { // AudioEffect.Descriptor array that are actually not available on the device. // As an example: Samsung Galaxy S6 includes an AGC in the descriptor but // AutomaticGainControl.isAvailable() returns false. + @TargetApi(18) private boolean effectTypeIsVoIP(UUID type) { + if (!WebRtcAudioUtils.runningOnJellyBeanMR2OrHigher()) + return false; + return (AudioEffect.EFFECT_TYPE_AEC.equals(type) && isAcousticEchoCancelerSupported()) || (AudioEffect.EFFECT_TYPE_AGC.equals(type) |