Force 8 kHz sampling rate on Android emulator.

BUG=None
R=henrika@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/55419004

Cr-Commit-Position: refs/heads/master@{#9310}
This commit is contained in:
Patrik Höglund
2015-05-28 14:16:36 +02:00
parent 2251d6e174
commit c41fe5d5d0
2 changed files with 12 additions and 0 deletions

View File

@@ -179,6 +179,12 @@ class WebRtcAudioManager {
// Returns the native output sample rate for this device's output stream.
private int getNativeOutputSampleRate() {
// Override this if we're running on an old emulator image which only
// supports 8 kHz and doesn't support PROPERTY_OUTPUT_SAMPLE_RATE.
if (WebRtcAudioUtils.runningOnEmulator()) {
Logd("Running on old emulator, overriding sampling rate to 8 kHz.");
return 8000;
}
if (!WebRtcAudioUtils.runningOnJellyBeanMR1OrHigher()) {
return SAMPLE_RATE_HZ;
}

View File

@@ -64,6 +64,12 @@ public final class WebRtcAudioUtils {
+ ", id=" + Thread.currentThread().getId() + "]";
}
// Returns true if we're running on emulator.
public static boolean runningOnEmulator() {
return Build.HARDWARE.equals("goldfish") &&
Build.BRAND.startsWith("generic_");
}
// Returns true if the device is blacklisted for HW AEC usage.
public static boolean deviceIsBlacklistedForHwAecUsage() {
List<String> blackListedModels = Arrays.asList(BLACKLISTED_AEC_MODELS);