shithub: openh264

Download patch

ref: 7b2f4058c9beb797877b0392bcc34a3e3f6767f6
parent: 01068cc9b967e4931d9a584930304d8ca317ebbd
author: Sheng-Hao Tsao <shenghao@google.com>
date: Wed Dec 6 15:30:02 EST 2017

Enable NEON for ChromeOS devices

Chrome uses openh264 to encode video frames for MediaRecorder APIs.
However, on ChromeOS, the encoding procedure is run in renderer process,
which can not access /proc/cpuinfo, making NEON not available.

Since all arm-based ChromeOS devices have NEON, it can be marked as
enabled anyway.

--- a/codec/common/src/cpu.cpp
+++ b/codec/common/src/cpu.cpp
@@ -258,13 +258,18 @@
 
 /* Generic arm/linux cpu feature detection */
 uint32_t WelsCPUFeatureDetect (int32_t* pNumberOfLogicProcessors) {
+  int flags = 0;
   FILE* f = fopen ("/proc/cpuinfo", "r");
 
-  if (!f)
-    return 0;
+#if defined(__chromeos__)
+  flags |= WELS_CPU_NEON;
+#endif
 
+  if (!f) {
+    return flags;
+  }
+
   char buf[200];
-  int flags = 0;
   while (fgets (buf, sizeof (buf), f)) {
     if (!strncmp (buf, "Features", strlen ("Features"))) {
       // The asimd and fp features are listed on 64 bit ARMv8 kernels