Skip to content

Commit 6415d7a

Browse files
committed
Fixed CPU Architecture cheking for AndroidFFMPEGLocator
1 parent fa8de47 commit 6415d7a

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/android/be/tarsos/dsp/io/android/AndroidFFMPEGLocator.java

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,28 @@ private enum CPUArchitecture{
132132
X86,ARMEABI_V7A,ARMEABI_V7A_NEON;
133133
}
134134

135+
private boolean isCPUArchitectureSupported(String alias) {
136+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
137+
for (String supportedAlias : Build.SUPPORTED_ABIS) {
138+
if (supportedAlias.equals(alias))
139+
return true;
140+
}
141+
142+
return false;
143+
} else {
144+
return Build.CPU_ABI.equals(alias);
145+
}
146+
}
147+
135148
private CPUArchitecture getCPUArchitecture() {
136149
// check if device is x86
137-
if (Build.SUPPORTED_ABIS[0].equals("x86")){
150+
if (isCPUArchitectureSupported("x86")) {
138151
return CPUArchitecture.X86;
139-
} else if (Build.SUPPORTED_ABIS[0].equals("armeabi-v7a")) {
152+
} else if (isCPUArchitectureSupported("armeabi-v7a")) {
140153
// check if NEON is supported:
141-
if(isNeonSupported()){
154+
if (isNeonSupported()) {
142155
return CPUArchitecture.ARMEABI_V7A_NEON;
143-
}else{
156+
} else {
144157
return CPUArchitecture.ARMEABI_V7A;
145158
}
146159
}

0 commit comments

Comments
 (0)