File tree 2 files changed +22
-9
lines changed
androidTest/java/com/github/hiteshsondhi88/libffmpeg
main/java/com/github/hiteshsondhi88/libffmpeg
2 files changed +22
-9
lines changed Original file line number Diff line number Diff line change 7
7
import static org .assertj .core .api .Assertions .assertThat ;
8
8
9
9
public class CpuArchHelperTest extends TestCase {
10
-
10
+
11
11
public void testGetCpuArch () throws Exception {
12
12
CpuArch cpuArch = CpuArchHelper .getCpuArch ();
13
13
assertNotNull (cpuArch );
14
- if (Build .CPU_ABI .equals (CpuArchHelper .getx86CpuAbi ())) {
14
+ if (Build .CPU_ABI .equals (CpuArchHelper .getx86CpuAbi ()) || Build . CPU_ABI . equals ( CpuArchHelper . getx86_64CpuAbi ()) ) {
15
15
assertEquals (cpuArch , CpuArch .x86 );
16
16
} else if (Build .CPU_ABI .equals (CpuArchHelper .getArmeabiv7CpuAbi ())) {
17
17
assertThat (cpuArch == CpuArch .ARMv7 || cpuArch == CpuArch .ARMv7_NEON ).isTrue ();
18
- } else {
18
+ } else if (Build .CPU_ABI .equals (CpuArchHelper .getArm64CpuAbi ())) {
19
+ assertEquals (cpuArch , CpuArch .ARMv7 );
20
+ }else {
19
21
assertEquals (cpuArch , CpuArch .NONE );
20
22
}
21
23
}
22
-
23
24
}
Original file line number Diff line number Diff line change 3
3
import android .os .Build ;
4
4
5
5
class CpuArchHelper {
6
-
6
+
7
7
static CpuArch getCpuArch () {
8
- // check if device is x86
9
- if (Build .CPU_ABI .equals (getx86CpuAbi ())) {
8
+ Log .d ("Build.CPU_ABI : " + Build .CPU_ABI );
9
+ // check if device is x86 or x86_64
10
+ if (Build .CPU_ABI .equals (getx86CpuAbi ()) || Build .CPU_ABI .equals (getx86_64CpuAbi ())) {
10
11
return CpuArch .x86 ;
11
12
} else {
12
13
// check if device is armeabi
@@ -21,15 +22,26 @@ static CpuArch getCpuArch() {
21
22
}
22
23
return CpuArch .ARMv7 ;
23
24
}
25
+ // check if device is arm64 which is supported by ARMV7
26
+ } else if (Build .CPU_ABI .equals (getArm64CpuAbi ())) {
27
+ return CpuArch .ARMv7 ;
24
28
}
25
29
}
26
30
return CpuArch .NONE ;
27
31
}
28
-
32
+
29
33
static String getx86CpuAbi () {
30
34
return "x86" ;
31
35
}
32
-
36
+
37
+ static String getx86_64CpuAbi () {
38
+ return "x86_64" ;
39
+ }
40
+
41
+ static String getArm64CpuAbi () {
42
+ return "arm64-v8a" ;
43
+ }
44
+
33
45
static String getArmeabiv7CpuAbi () {
34
46
return "armeabi-v7a" ;
35
47
}
You can’t perform that action at this time.
0 commit comments