shithub: openh264

Download patch

ref: 0a3d4c4ebc50e63ef8fbb9a5b634c1f7db00400c
parent: 94a1d4426e26e01ee5170d2f3d404c124d329407
author: Martin Storsjö <martin@martin.st>
date: Thu Oct 23 11:36:40 EDT 2014

Only use pthread_setname_np on Android >= 9 (2.3)

Older versions of Android don't have this function.

--- a/codec/common/src/WelsThreadLib.cpp
+++ b/codec/common/src/WelsThreadLib.cpp
@@ -58,6 +58,9 @@
 #ifdef ANDROID_NDK
 #include <cpu-features.h>
 #endif
+#ifdef __ANDROID__
+#include <android/api-level.h>
+#endif
 
 #include "WelsThreadLib.h"
 #include <stdio.h>
@@ -252,7 +255,7 @@
 #ifdef APPLE_IOS
   pthread_setname_np(thread_name);
 #endif
-#ifdef __ANDROID__
+#if defined(__ANDROID__) && __ANDROID_API__ >= 9
   pthread_setname_np(pthread_self(), thread_name);
 #endif
   // do nothing