Fixed less than optimal number of decoding threads on some Android devices
authorAlex Ling <autosword@gmail.com>
Fri, 12 Feb 2016 21:28:47 +0000 (16:28 -0500)
committerMartijn Kaijser <mcm.kaijser@gmail.com>
Sat, 13 Feb 2016 17:17:01 +0000 (18:17 +0100)
xbmc/android/activity/AndroidFeatures.cpp
xbmc/android/activity/AndroidFeatures.h
xbmc/utils/CPUInfo.cpp

index 7526cd0..0c958b8 100644 (file)
@@ -63,3 +63,14 @@ int CAndroidFeatures::GetVersion()
   return version;
 }
 
+int CAndroidFeatures::GetCPUCount()
+{
+  static int count = -1;
+
+  if (count == -1)
+  {
+    count = android_getCpuCount();
+  }
+  return count;
+}
+
index 9d0c20b..98aee45 100644 (file)
@@ -27,4 +27,5 @@ class CAndroidFeatures
 
   static bool         HasNeon();
   static int          GetVersion();
-};
\ No newline at end of file
+  static int          GetCPUCount();
+};
index 660d355..f1d07dd 100644 (file)
@@ -412,6 +412,14 @@ CCPUInfo::CCPUInfo(void)
       }
     }
     fclose(fCPUInfo);
+    //  /proc/cpuinfo is not reliable on some Android platforms
+    //  At least we should get the correct cpu count for multithreaded decoding
+#if defined(TARGET_ANDROID)
+    if (CAndroidFeatures::GetCPUCount() > m_cpuCount)
+    {
+      m_cpuCount = CAndroidFeatures::GetCPUCount();
+    }
+#endif
   }
   else
   {