summaryrefslogtreecommitdiffstats
path: root/media/libmedia/mediametadataretriever.cpp
diff options
context:
space:
mode:
authorDave Sparks <davidsparks@android.com>2010-04-01 18:00:58 -0700
committerDave Sparks <davidsparks@android.com>2010-04-01 18:08:22 -0700
commita17a1347ffe281fc70633ba8dc98f6cf49ac06ff (patch)
treebbecb38baa1d87f4319624522d34ece1a3df96ec /media/libmedia/mediametadataretriever.cpp
parent71662fe8f5cc0dda0837596e9d44200d302697e8 (diff)
downloadframeworks_av-a17a1347ffe281fc70633ba8dc98f6cf49ac06ff.zip
frameworks_av-a17a1347ffe281fc70633ba8dc98f6cf49ac06ff.tar.gz
frameworks_av-a17a1347ffe281fc70633ba8dc98f6cf49ac06ff.tar.bz2
Use local lock for most MediaMetadataRetriever methods. Bug 2560834.
MediaMetadataRetriever uses a single static lock for all operations. This effectively serializes all metadata retrieval operations in a single process. This patch uses the object level lock for all normal operations and only uses the static lock to serialize calls to release. Change-Id: I81c9f234c2f0007a26d18e1398c709b41a4dbbd7
Diffstat (limited to 'media/libmedia/mediametadataretriever.cpp')
-rw-r--r--media/libmedia/mediametadataretriever.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/media/libmedia/mediametadataretriever.cpp b/media/libmedia/mediametadataretriever.cpp
index d34a8ed..e2712ba 100644
--- a/media/libmedia/mediametadataretriever.cpp
+++ b/media/libmedia/mediametadataretriever.cpp
@@ -95,6 +95,7 @@ void MediaMetadataRetriever::disconnect()
status_t MediaMetadataRetriever::setDataSource(const char* srcUrl)
{
LOGV("setDataSource");
+ Mutex::Autolock _l(mLock);
if (mRetriever == 0) {
LOGE("retriever is not initialized");
return INVALID_OPERATION;
@@ -110,6 +111,7 @@ status_t MediaMetadataRetriever::setDataSource(const char* srcUrl)
status_t MediaMetadataRetriever::setDataSource(int fd, int64_t offset, int64_t length)
{
LOGV("setDataSource(%d, %lld, %lld)", fd, offset, length);
+ Mutex::Autolock _l(mLock);
if (mRetriever == 0) {
LOGE("retriever is not initialized");
return INVALID_OPERATION;
@@ -124,6 +126,7 @@ status_t MediaMetadataRetriever::setDataSource(int fd, int64_t offset, int64_t l
status_t MediaMetadataRetriever::setMode(int mode)
{
LOGV("setMode(%d)", mode);
+ Mutex::Autolock _l(mLock);
if (mRetriever == 0) {
LOGE("retriever is not initialized");
return INVALID_OPERATION;
@@ -134,6 +137,7 @@ status_t MediaMetadataRetriever::setMode(int mode)
status_t MediaMetadataRetriever::getMode(int* mode)
{
LOGV("getMode");
+ Mutex::Autolock _l(mLock);
if (mRetriever == 0) {
LOGE("retriever is not initialized");
return INVALID_OPERATION;
@@ -144,6 +148,7 @@ status_t MediaMetadataRetriever::getMode(int* mode)
sp<IMemory> MediaMetadataRetriever::captureFrame()
{
LOGV("captureFrame");
+ Mutex::Autolock _l(mLock);
if (mRetriever == 0) {
LOGE("retriever is not initialized");
return NULL;
@@ -154,6 +159,7 @@ sp<IMemory> MediaMetadataRetriever::captureFrame()
const char* MediaMetadataRetriever::extractMetadata(int keyCode)
{
LOGV("extractMetadata(%d)", keyCode);
+ Mutex::Autolock _l(mLock);
if (mRetriever == 0) {
LOGE("retriever is not initialized");
return NULL;
@@ -164,6 +170,7 @@ const char* MediaMetadataRetriever::extractMetadata(int keyCode)
sp<IMemory> MediaMetadataRetriever::extractAlbumArt()
{
LOGV("extractAlbumArt");
+ Mutex::Autolock _l(mLock);
if (mRetriever == 0) {
LOGE("retriever is not initialized");
return NULL;