OSDN Git Service

TimedEventQueue is apparently important for glitch-free media playback, and so
authorMarco Nelissen <marcone@google.com>
Tue, 15 Jun 2010 19:34:50 +0000 (12:34 -0700)
committerMarco Nelissen <marcone@google.com>
Wed, 16 Jun 2010 18:09:01 +0000 (11:09 -0700)
having it inherit its priority from the thread that created it is a bad idea.
Instead, set the priority explicitly, and bump it to slightly higher than normal.

Change-Id: I01843f24905790ce2e2cde5d11a99346cfbf968d

media/libstagefright/TimedEventQueue.cpp

index 3de8c1d..0dacb53 100644 (file)
 //#define LOG_NDEBUG 0
 #define LOG_TAG "TimedEventQueue"
 #include <utils/Log.h>
+#include <utils/threads.h>
 
 #include "include/TimedEventQueue.h"
 
 #include <sys/prctl.h>
 #include <sys/time.h>
+#include <sys/resource.h>
 
 #include <media/stagefright/MediaDebug.h>
 
@@ -206,6 +208,7 @@ void *TimedEventQueue::ThreadWrapper(void *me) {
     vm->AttachCurrentThread(&env, NULL);
 #endif
 
+    setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_FOREGROUND);
     static_cast<TimedEventQueue *>(me)->threadEntry();
 
 #ifdef ANDROID_SIMULATOR