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

Unified Diff: webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java

Issue 2119633004: Adds support for OpenSL ES based audio capture on Android (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased Created 4 years, 3 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: 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 f24e4708ee1974204739fdc3f1e4c33b0ccd53e6..6d2bd70a1ca4e00cc0013748b9c2319db53fed3d 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
@@ -134,6 +134,7 @@ public class WebRtcAudioManager {
private boolean hardwareAGC;
private boolean hardwareNS;
private boolean lowLatencyOutput;
+ private boolean lowLatencyInput;
private boolean proAudio;
private int sampleRate;
private int channels;
@@ -153,10 +154,9 @@ public class WebRtcAudioManager {
}
volumeLogger = new VolumeLogger(audioManager);
storeAudioParameters();
- nativeCacheAudioParameters(
- sampleRate, channels, hardwareAEC, hardwareAGC, hardwareNS,
- lowLatencyOutput, proAudio, outputBufferSize, inputBufferSize,
- nativeAudioManager);
+ nativeCacheAudioParameters(sampleRate, channels, hardwareAEC, hardwareAGC, hardwareNS,
+ lowLatencyOutput, lowLatencyInput, proAudio, outputBufferSize, inputBufferSize,
+ nativeAudioManager);
}
private boolean init() {
@@ -201,12 +201,13 @@ public class WebRtcAudioManager {
hardwareAGC = isAutomaticGainControlSupported();
hardwareNS = isNoiseSuppressorSupported();
lowLatencyOutput = isLowLatencyOutputSupported();
+ lowLatencyInput = isLowLatencyInputSupported();
proAudio = isProAudioSupported();
outputBufferSize = lowLatencyOutput ?
getLowLatencyOutputFramesPerBuffer() :
getMinOutputFrameSize(sampleRate, channels);
- // TODO(henrika): add support for low-latency input.
- inputBufferSize = getMinInputFrameSize(sampleRate, channels);
+ inputBufferSize = lowLatencyInput ? getLowLatencyInputFramesPerBuffer()
+ : getMinInputFrameSize(sampleRate, channels);
}
// Gets the current earpiece state.
@@ -223,13 +224,16 @@ public class WebRtcAudioManager {
}
// Returns true if low-latency audio input is supported.
+ // TODO(henrika): remove the hardcoded false return value when OpenSL ES
+ // input performance has been evaluated and tested more.
public boolean isLowLatencyInputSupported() {
// TODO(henrika): investigate if some sort of device list is needed here
// 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 false;
tommi 2016/09/15 09:34:12 can you file a bug for this? Seems like we're cha
henrika_webrtc 2016/09/16 13:30:47 We are actually not changing anything for output.
tommi 2016/09/17 09:27:08 sorry, you're right, I must have missed the 'Input
henrika_webrtc 2016/09/19 11:16:12 Acknowledged.
+ // return WebRtcAudioUtils.runningOnLollipopOrHigher()
+ // && isLowLatencyOutputSupported();
}
// Returns true if the device has professional audio level of functionality
@@ -353,8 +357,8 @@ public class WebRtcAudioManager {
}
}
- private native void nativeCacheAudioParameters(
- int sampleRate, int channels, boolean hardwareAEC, boolean hardwareAGC,
- boolean hardwareNS, boolean lowLatencyOutput, boolean proAudio,
- int outputBufferSize, int inputBufferSize, long nativeAudioManager);
+ private native void nativeCacheAudioParameters(int sampleRate, int channels, boolean hardwareAEC,
+ boolean hardwareAGC, boolean hardwareNS, boolean lowLatencyOutput,
+ boolean lowLatencyInput, boolean proAudio, int outputBufferSize, int inputBufferSize,
+ long nativeAudioManager);
}

Powered by Google App Engine
This is Rietveld 408576698