Loading media/libmedia/include/media/mediametadataretriever.h +4 −0 Original line number Original line Diff line number Diff line Loading @@ -122,6 +122,10 @@ private: static sp<IMediaPlayerService> sService; static sp<IMediaPlayerService> sService; Mutex mLock; Mutex mLock; // Static lock was added to the client in order to consume at most // one service thread from image extraction requests of the same // client process(See also b/21277449). static Mutex sLock; sp<IMediaMetadataRetriever> mRetriever; sp<IMediaMetadataRetriever> mRetriever; }; }; Loading media/libmedia/mediametadataretriever.cpp +6 −0 Original line number Original line Diff line number Diff line Loading @@ -35,6 +35,8 @@ Mutex MediaMetadataRetriever::sServiceLock; sp<IMediaPlayerService> MediaMetadataRetriever::sService; sp<IMediaPlayerService> MediaMetadataRetriever::sService; sp<MediaMetadataRetriever::DeathNotifier> MediaMetadataRetriever::sDeathNotifier; sp<MediaMetadataRetriever::DeathNotifier> MediaMetadataRetriever::sDeathNotifier; Mutex MediaMetadataRetriever::sLock; const sp<IMediaPlayerService> MediaMetadataRetriever::getService() const sp<IMediaPlayerService> MediaMetadataRetriever::getService() { { Mutex::Autolock lock(sServiceLock); Mutex::Autolock lock(sServiceLock); Loading Loading @@ -143,6 +145,7 @@ sp<IMemory> MediaMetadataRetriever::getFrameAtTime( ALOGV("getFrameAtTime: time(%" PRId64 " us) option(%d) colorFormat(%d) metaOnly(%d)", ALOGV("getFrameAtTime: time(%" PRId64 " us) option(%d) colorFormat(%d) metaOnly(%d)", timeUs, option, colorFormat, metaOnly); timeUs, option, colorFormat, metaOnly); Mutex::Autolock _l(mLock); Mutex::Autolock _l(mLock); Mutex::Autolock _gLock(sLock); if (mRetriever == 0) { if (mRetriever == 0) { ALOGE("retriever is not initialized"); ALOGE("retriever is not initialized"); return NULL; return NULL; Loading @@ -155,6 +158,7 @@ sp<IMemory> MediaMetadataRetriever::getImageAtIndex( ALOGV("getImageAtIndex: index(%d) colorFormat(%d) metaOnly(%d) thumbnail(%d)", ALOGV("getImageAtIndex: index(%d) colorFormat(%d) metaOnly(%d) thumbnail(%d)", index, colorFormat, metaOnly, thumbnail); index, colorFormat, metaOnly, thumbnail); Mutex::Autolock _l(mLock); Mutex::Autolock _l(mLock); Mutex::Autolock _gLock(sLock); if (mRetriever == 0) { if (mRetriever == 0) { ALOGE("retriever is not initialized"); ALOGE("retriever is not initialized"); return NULL; return NULL; Loading @@ -167,6 +171,7 @@ sp<IMemory> MediaMetadataRetriever::getImageRectAtIndex( ALOGV("getImageRectAtIndex: index(%d) colorFormat(%d) rect {%d, %d, %d, %d}", ALOGV("getImageRectAtIndex: index(%d) colorFormat(%d) rect {%d, %d, %d, %d}", index, colorFormat, left, top, right, bottom); index, colorFormat, left, top, right, bottom); Mutex::Autolock _l(mLock); Mutex::Autolock _l(mLock); Mutex::Autolock _gLock(sLock); if (mRetriever == 0) { if (mRetriever == 0) { ALOGE("retriever is not initialized"); ALOGE("retriever is not initialized"); return NULL; return NULL; Loading @@ -180,6 +185,7 @@ sp<IMemory> MediaMetadataRetriever::getFrameAtIndex( ALOGV("getFrameAtIndex: index(%d), colorFormat(%d) metaOnly(%d)", ALOGV("getFrameAtIndex: index(%d), colorFormat(%d) metaOnly(%d)", index, colorFormat, metaOnly); index, colorFormat, metaOnly); Mutex::Autolock _l(mLock); Mutex::Autolock _l(mLock); Mutex::Autolock _gLock(sLock); if (mRetriever == 0) { if (mRetriever == 0) { ALOGE("retriever is not initialized"); ALOGE("retriever is not initialized"); return NULL; return NULL; Loading Loading
media/libmedia/include/media/mediametadataretriever.h +4 −0 Original line number Original line Diff line number Diff line Loading @@ -122,6 +122,10 @@ private: static sp<IMediaPlayerService> sService; static sp<IMediaPlayerService> sService; Mutex mLock; Mutex mLock; // Static lock was added to the client in order to consume at most // one service thread from image extraction requests of the same // client process(See also b/21277449). static Mutex sLock; sp<IMediaMetadataRetriever> mRetriever; sp<IMediaMetadataRetriever> mRetriever; }; }; Loading
media/libmedia/mediametadataretriever.cpp +6 −0 Original line number Original line Diff line number Diff line Loading @@ -35,6 +35,8 @@ Mutex MediaMetadataRetriever::sServiceLock; sp<IMediaPlayerService> MediaMetadataRetriever::sService; sp<IMediaPlayerService> MediaMetadataRetriever::sService; sp<MediaMetadataRetriever::DeathNotifier> MediaMetadataRetriever::sDeathNotifier; sp<MediaMetadataRetriever::DeathNotifier> MediaMetadataRetriever::sDeathNotifier; Mutex MediaMetadataRetriever::sLock; const sp<IMediaPlayerService> MediaMetadataRetriever::getService() const sp<IMediaPlayerService> MediaMetadataRetriever::getService() { { Mutex::Autolock lock(sServiceLock); Mutex::Autolock lock(sServiceLock); Loading Loading @@ -143,6 +145,7 @@ sp<IMemory> MediaMetadataRetriever::getFrameAtTime( ALOGV("getFrameAtTime: time(%" PRId64 " us) option(%d) colorFormat(%d) metaOnly(%d)", ALOGV("getFrameAtTime: time(%" PRId64 " us) option(%d) colorFormat(%d) metaOnly(%d)", timeUs, option, colorFormat, metaOnly); timeUs, option, colorFormat, metaOnly); Mutex::Autolock _l(mLock); Mutex::Autolock _l(mLock); Mutex::Autolock _gLock(sLock); if (mRetriever == 0) { if (mRetriever == 0) { ALOGE("retriever is not initialized"); ALOGE("retriever is not initialized"); return NULL; return NULL; Loading @@ -155,6 +158,7 @@ sp<IMemory> MediaMetadataRetriever::getImageAtIndex( ALOGV("getImageAtIndex: index(%d) colorFormat(%d) metaOnly(%d) thumbnail(%d)", ALOGV("getImageAtIndex: index(%d) colorFormat(%d) metaOnly(%d) thumbnail(%d)", index, colorFormat, metaOnly, thumbnail); index, colorFormat, metaOnly, thumbnail); Mutex::Autolock _l(mLock); Mutex::Autolock _l(mLock); Mutex::Autolock _gLock(sLock); if (mRetriever == 0) { if (mRetriever == 0) { ALOGE("retriever is not initialized"); ALOGE("retriever is not initialized"); return NULL; return NULL; Loading @@ -167,6 +171,7 @@ sp<IMemory> MediaMetadataRetriever::getImageRectAtIndex( ALOGV("getImageRectAtIndex: index(%d) colorFormat(%d) rect {%d, %d, %d, %d}", ALOGV("getImageRectAtIndex: index(%d) colorFormat(%d) rect {%d, %d, %d, %d}", index, colorFormat, left, top, right, bottom); index, colorFormat, left, top, right, bottom); Mutex::Autolock _l(mLock); Mutex::Autolock _l(mLock); Mutex::Autolock _gLock(sLock); if (mRetriever == 0) { if (mRetriever == 0) { ALOGE("retriever is not initialized"); ALOGE("retriever is not initialized"); return NULL; return NULL; Loading @@ -180,6 +185,7 @@ sp<IMemory> MediaMetadataRetriever::getFrameAtIndex( ALOGV("getFrameAtIndex: index(%d), colorFormat(%d) metaOnly(%d)", ALOGV("getFrameAtIndex: index(%d), colorFormat(%d) metaOnly(%d)", index, colorFormat, metaOnly); index, colorFormat, metaOnly); Mutex::Autolock _l(mLock); Mutex::Autolock _l(mLock); Mutex::Autolock _gLock(sLock); if (mRetriever == 0) { if (mRetriever == 0) { ALOGE("retriever is not initialized"); ALOGE("retriever is not initialized"); return NULL; return NULL; Loading