Loading media/libmediaplayerservice/MetadataRetrieverClient.cpp +27 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <sys/resource.h> #include <dirent.h> #include <unistd.h> Loading @@ -39,6 +40,18 @@ #include "MetadataRetrieverClient.h" #include "StagefrightMetadataRetriever.h" /* desktop Linux needs a little help with gettid() */ #if defined(HAVE_GETTID) && !defined(HAVE_ANDROID_OS) #define __KERNEL__ # include <linux/unistd.h> #ifdef _syscall0 _syscall0(pid_t,gettid) #else pid_t gettid() { return syscall(__NR_gettid);} #endif #undef __KERNEL__ #endif namespace android { extern player_type getPlayerType(const char* url); Loading Loading @@ -219,6 +232,7 @@ sp<IMemory> MetadataRetrieverClient::captureFrame() { LOGV("captureFrame"); Mutex::Autolock lock(mLock); Priority priority(ANDROID_PRIORITY_BACKGROUND); mThumbnail.clear(); mThumbnailDealer.clear(); if (mRetriever == NULL) { Loading Loading @@ -260,6 +274,7 @@ sp<IMemory> MetadataRetrieverClient::extractAlbumArt() { LOGV("extractAlbumArt"); Mutex::Autolock lock(mLock); Priority priority(ANDROID_PRIORITY_BACKGROUND); mAlbumArt.clear(); mAlbumArtDealer.clear(); if (mRetriever == NULL) { Loading Loading @@ -301,7 +316,19 @@ const char* MetadataRetrieverClient::extractMetadata(int keyCode) LOGE("retriever is not initialized"); return NULL; } Priority priority(ANDROID_PRIORITY_BACKGROUND); return mRetriever->extractMetadata(keyCode); } MetadataRetrieverClient::Priority::Priority(int newPriority) { mOldPriority = getpriority(PRIO_PROCESS, 0); setpriority(PRIO_PROCESS, 0, newPriority); } MetadataRetrieverClient::Priority::~Priority() { setpriority(PRIO_PROCESS, 0, mOldPriority); } }; // namespace android media/libmediaplayerservice/MetadataRetrieverClient.h +10 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,16 @@ public: private: friend class MediaPlayerService; class Priority { public: Priority(int newPriority); ~Priority(); private: Priority(); int mOldPriority; }; explicit MetadataRetrieverClient(pid_t pid); virtual ~MetadataRetrieverClient(); Loading Loading
media/libmediaplayerservice/MetadataRetrieverClient.cpp +27 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <sys/resource.h> #include <dirent.h> #include <unistd.h> Loading @@ -39,6 +40,18 @@ #include "MetadataRetrieverClient.h" #include "StagefrightMetadataRetriever.h" /* desktop Linux needs a little help with gettid() */ #if defined(HAVE_GETTID) && !defined(HAVE_ANDROID_OS) #define __KERNEL__ # include <linux/unistd.h> #ifdef _syscall0 _syscall0(pid_t,gettid) #else pid_t gettid() { return syscall(__NR_gettid);} #endif #undef __KERNEL__ #endif namespace android { extern player_type getPlayerType(const char* url); Loading Loading @@ -219,6 +232,7 @@ sp<IMemory> MetadataRetrieverClient::captureFrame() { LOGV("captureFrame"); Mutex::Autolock lock(mLock); Priority priority(ANDROID_PRIORITY_BACKGROUND); mThumbnail.clear(); mThumbnailDealer.clear(); if (mRetriever == NULL) { Loading Loading @@ -260,6 +274,7 @@ sp<IMemory> MetadataRetrieverClient::extractAlbumArt() { LOGV("extractAlbumArt"); Mutex::Autolock lock(mLock); Priority priority(ANDROID_PRIORITY_BACKGROUND); mAlbumArt.clear(); mAlbumArtDealer.clear(); if (mRetriever == NULL) { Loading Loading @@ -301,7 +316,19 @@ const char* MetadataRetrieverClient::extractMetadata(int keyCode) LOGE("retriever is not initialized"); return NULL; } Priority priority(ANDROID_PRIORITY_BACKGROUND); return mRetriever->extractMetadata(keyCode); } MetadataRetrieverClient::Priority::Priority(int newPriority) { mOldPriority = getpriority(PRIO_PROCESS, 0); setpriority(PRIO_PROCESS, 0, newPriority); } MetadataRetrieverClient::Priority::~Priority() { setpriority(PRIO_PROCESS, 0, mOldPriority); } }; // namespace android
media/libmediaplayerservice/MetadataRetrieverClient.h +10 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,16 @@ public: private: friend class MediaPlayerService; class Priority { public: Priority(int newPriority); ~Priority(); private: Priority(); int mOldPriority; }; explicit MetadataRetrieverClient(pid_t pid); virtual ~MetadataRetrieverClient(); Loading