Remove unnecessary runtime API-level checks.
APIs below level 16 are not supported by WebRTC. BUG=webrtc:7549 TBR=henrika@webrtc.org Review-Url: https://codereview.webrtc.org/2848323003 Cr-Commit-Position: refs/heads/master@{#17980}
This commit is contained in:
@ -10,8 +10,6 @@
|
||||
|
||||
package org.webrtc.voiceengine;
|
||||
|
||||
import org.webrtc.Logging;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.media.audiofx.AcousticEchoCanceler;
|
||||
import android.media.audiofx.AudioEffect;
|
||||
@ -19,9 +17,9 @@ import android.media.audiofx.AudioEffect.Descriptor;
|
||||
import android.media.audiofx.AutomaticGainControl;
|
||||
import android.media.audiofx.NoiseSuppressor;
|
||||
import android.os.Build;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.webrtc.Logging;
|
||||
|
||||
// This class wraps control of three different platform effects. Supported
|
||||
// effects are: AcousticEchoCanceler (AEC) and NoiseSuppressor (NS).
|
||||
@ -63,7 +61,7 @@ class WebRtcAudioEffects {
|
||||
// Note: we're using isAcousticEchoCancelerEffectAvailable() instead of
|
||||
// AcousticEchoCanceler.isAvailable() to avoid the expensive getEffects()
|
||||
// OS API call.
|
||||
return WebRtcAudioUtils.runningOnJellyBeanOrHigher() && isAcousticEchoCancelerEffectAvailable();
|
||||
return isAcousticEchoCancelerEffectAvailable();
|
||||
}
|
||||
|
||||
// Checks if the device implements Noise Suppression (NS).
|
||||
@ -72,7 +70,7 @@ class WebRtcAudioEffects {
|
||||
// Note: we're using isNoiseSuppressorEffectAvailable() instead of
|
||||
// NoiseSuppressor.isAvailable() to avoid the expensive getEffects()
|
||||
// OS API call.
|
||||
return WebRtcAudioUtils.runningOnJellyBeanOrHigher() && isNoiseSuppressorEffectAvailable();
|
||||
return isNoiseSuppressorEffectAvailable();
|
||||
}
|
||||
|
||||
// Returns true if the device is blacklisted for HW AEC usage.
|
||||
@ -153,11 +151,6 @@ class WebRtcAudioEffects {
|
||||
}
|
||||
|
||||
static WebRtcAudioEffects create() {
|
||||
// Return null if VoIP effects (AEC, AGC and NS) are not supported.
|
||||
if (!WebRtcAudioUtils.runningOnJellyBeanOrHigher()) {
|
||||
Logging.w(TAG, "API level 16 or higher is required!");
|
||||
return null;
|
||||
}
|
||||
return new WebRtcAudioEffects();
|
||||
}
|
||||
|
||||
|
||||
@ -229,8 +229,7 @@ public class WebRtcAudioManager {
|
||||
|
||||
// Returns true if low-latency audio output is supported.
|
||||
private boolean isLowLatencyOutputSupported() {
|
||||
return isOpenSLESSupported()
|
||||
&& context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUDIO_LOW_LATENCY);
|
||||
return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUDIO_LOW_LATENCY);
|
||||
}
|
||||
|
||||
// Returns true if low-latency audio input is supported.
|
||||
@ -341,12 +340,6 @@ public class WebRtcAudioManager {
|
||||
/ bytesPerFrame;
|
||||
}
|
||||
|
||||
// Returns true if OpenSL ES audio is supported.
|
||||
private static boolean isOpenSLESSupported() {
|
||||
// Check for API level 9 or higher, to confirm use of OpenSL ES.
|
||||
return WebRtcAudioUtils.runningOnGingerBreadOrHigher();
|
||||
}
|
||||
|
||||
// Helper method which throws an exception when an assertion has failed.
|
||||
private static void assertTrue(boolean condition) {
|
||||
if (!condition) {
|
||||
|
||||
@ -10,16 +10,14 @@
|
||||
|
||||
package org.webrtc.voiceengine;
|
||||
|
||||
import org.webrtc.Logging;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Process;
|
||||
|
||||
import java.lang.Thread;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.webrtc.Logging;
|
||||
|
||||
public final class WebRtcAudioUtils {
|
||||
private static final String TAG = "WebRtcAudioUtils";
|
||||
@ -129,16 +127,6 @@ public final class WebRtcAudioUtils {
|
||||
return Arrays.asList(WebRtcAudioUtils.BLACKLISTED_NS_MODELS);
|
||||
}
|
||||
|
||||
public static boolean runningOnGingerBreadOrHigher() {
|
||||
// November 2010: Android 2.3, API Level 9.
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD;
|
||||
}
|
||||
|
||||
public static boolean runningOnJellyBeanOrHigher() {
|
||||
// June 2012: Android 4.1. API Level 16.
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
|
||||
}
|
||||
|
||||
public static boolean runningOnJellyBeanMR1OrHigher() {
|
||||
// November 2012: Android 4.2. API Level 17.
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1;
|
||||
|
||||
Reference in New Issue
Block a user