Index: webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java |
diff --git a/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java b/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java |
index 1213f333d930778a8cba06d330b88afb9cf35b1a..497e234bf0700e5a13cd60b385fbe9ba11a23e16 100644 |
--- a/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java |
+++ b/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java |
@@ -81,6 +81,7 @@ public class WebRtcAudioManager { |
private boolean hardwareAGC; |
private boolean hardwareNS; |
private boolean lowLatencyOutput; |
+ private boolean proAudio; |
private int sampleRate; |
private int channels; |
private int outputBufferSize; |
@@ -98,7 +99,7 @@ public class WebRtcAudioManager { |
storeAudioParameters(); |
nativeCacheAudioParameters( |
sampleRate, channels, hardwareAEC, hardwareAGC, hardwareNS, |
- lowLatencyOutput, outputBufferSize, inputBufferSize, |
+ lowLatencyOutput, proAudio, outputBufferSize, inputBufferSize, |
nativeAudioManager); |
} |
@@ -142,6 +143,7 @@ public class WebRtcAudioManager { |
hardwareAGC = isAutomaticGainControlSupported(); |
hardwareNS = isNoiseSuppressorSupported(); |
lowLatencyOutput = isLowLatencyOutputSupported(); |
+ proAudio = isProAudioSupported(); |
outputBufferSize = lowLatencyOutput ? |
getLowLatencyOutputFramesPerBuffer() : |
getMinOutputFrameSize(sampleRate, channels); |
@@ -168,8 +170,16 @@ public class WebRtcAudioManager { |
// as well. The NDK doc states that: "As of API level 21, lower latency |
// audio input is supported on select devices. To take advantage of this |
// feature, first confirm that lower latency output is available". |
- return WebRtcAudioUtils.runningOnLollipopOrHigher() && |
- isLowLatencyOutputSupported(); |
+ return WebRtcAudioUtils.runningOnLollipopOrHigher() |
+ && isLowLatencyOutputSupported(); |
+ } |
+ |
+ // Returns true if the device has professional audio level of functionality |
+ // and therefore supports the lowest possible round-trip latency. |
+ private boolean isProAudioSupported() { |
+ return WebRtcAudioUtils.runningOnMarshmallowOrHigher() |
+ && context.getPackageManager().hasSystemFeature( |
+ PackageManager.FEATURE_AUDIO_PRO); |
} |
// Returns the native output sample rate for this device's output stream. |
@@ -287,6 +297,6 @@ public class WebRtcAudioManager { |
private native void nativeCacheAudioParameters( |
int sampleRate, int channels, boolean hardwareAEC, boolean hardwareAGC, |
- boolean hardwareNS, boolean lowLatencyOutput, int outputBufferSize, |
- int inputBufferSize, long nativeAudioManager); |
+ boolean hardwareNS, boolean lowLatencyOutput, boolean proAudio, |
+ int outputBufferSize, int inputBufferSize, long nativeAudioManager); |
} |