diff options
Diffstat (limited to 'media')
-rw-r--r-- | media/libmediaplayerservice/MetadataRetrieverClient.cpp | 3 | ||||
-rw-r--r-- | media/libmediaplayerservice/MetadataRetrieverClient.h | 1 | ||||
-rw-r--r-- | media/libstagefright/ACodec.cpp | 15 | ||||
-rw-r--r-- | media/libstagefright/MediaCodec.cpp | 14 | ||||
-rw-r--r-- | media/libstagefright/MediaCodecList.cpp | 5 | ||||
-rw-r--r-- | media/libstagefright/foundation/AHierarchicalStateMachine.cpp | 3 | ||||
-rw-r--r-- | media/libstagefright/foundation/ALooperRoster.cpp | 3 |
7 files changed, 22 insertions, 22 deletions
diff --git a/media/libmediaplayerservice/MetadataRetrieverClient.cpp b/media/libmediaplayerservice/MetadataRetrieverClient.cpp index 9a37302..a5a1fa5 100644 --- a/media/libmediaplayerservice/MetadataRetrieverClient.cpp +++ b/media/libmediaplayerservice/MetadataRetrieverClient.cpp @@ -191,10 +191,13 @@ status_t MetadataRetrieverClient::setDataSource( return ret; } +Mutex MetadataRetrieverClient::sLock; + sp<IMemory> MetadataRetrieverClient::getFrameAtTime(int64_t timeUs, int option) { ALOGV("getFrameAtTime: time(%lld us) option(%d)", timeUs, option); Mutex::Autolock lock(mLock); + Mutex::Autolock glock(sLock); mThumbnail.clear(); if (mRetriever == NULL) { ALOGE("retriever is not initialized"); diff --git a/media/libmediaplayerservice/MetadataRetrieverClient.h b/media/libmediaplayerservice/MetadataRetrieverClient.h index e71a29e..fe7547c 100644 --- a/media/libmediaplayerservice/MetadataRetrieverClient.h +++ b/media/libmediaplayerservice/MetadataRetrieverClient.h @@ -63,6 +63,7 @@ private: virtual ~MetadataRetrieverClient(); mutable Mutex mLock; + static Mutex sLock; sp<MediaMetadataRetrieverBase> mRetriever; pid_t mPid; diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index cf37eba..527e9cd 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -1396,7 +1396,8 @@ ACodec::BufferInfo *ACodec::dequeueBufferFromNativeWindow() { status_t ACodec::freeBuffersOnPort(OMX_U32 portIndex) { status_t err = OK; - for (size_t i = mBuffers[portIndex].size(); i-- > 0;) { + for (size_t i = mBuffers[portIndex].size(); i > 0;) { + i--; status_t err2 = freeBuffer(portIndex, i); if (err == OK) { err = err2; @@ -1410,7 +1411,8 @@ status_t ACodec::freeBuffersOnPort(OMX_U32 portIndex) { status_t ACodec::freeOutputBuffersNotOwnedByComponent() { status_t err = OK; - for (size_t i = mBuffers[kPortIndexOutput].size(); i-- > 0;) { + for (size_t i = mBuffers[kPortIndexOutput].size(); i > 0;) { + i--; BufferInfo *info = &mBuffers[kPortIndexOutput].editItemAt(i); @@ -5202,16 +5204,11 @@ void ACodec::BaseState::onOutputBufferDrained(const sp<AMessage> &msg) { int64_t timestampNs = 0; if (!msg->findInt64("timestampNs", ×tampNs)) { - // TODO: it seems like we should use the timestamp - // in the (media)buffer as it potentially came from - // an input surface, but we did not propagate it prior to - // API 20. Perhaps check for target SDK version. -#if 0 + // use media timestamp if client did not request a specific render timestamp if (info->mData->meta()->findInt64("timeUs", ×tampNs)) { - ALOGV("using buffer PTS of %" PRId64, timestampNs); + ALOGV("using buffer PTS of %lld", (long long)timestampNs); timestampNs *= 1000; } -#endif } status_t err; diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp index 7ee84a8..e5b7202 100644 --- a/media/libstagefright/MediaCodec.cpp +++ b/media/libstagefright/MediaCodec.cpp @@ -2452,18 +2452,12 @@ status_t MediaCodec::onReleaseOutputBuffer(const sp<AMessage> &msg) { info->mData->meta()->findInt64("timeUs", &mediaTimeUs); int64_t renderTimeNs = 0; - if (msg->findInt64("timestampNs", &renderTimeNs)) { - info->mNotify->setInt64("timestampNs", renderTimeNs); - } else { - // TODO: it seems like we should use the timestamp - // in the (media)buffer as it potentially came from - // an input surface, but we did not propagate it prior to - // API 20. Perhaps check for target SDK version. -#if 0 - ALOGV("using buffer PTS of %" PRId64, timestampNs); + if (!msg->findInt64("timestampNs", &renderTimeNs)) { + // use media timestamp if client did not request a specific render timestamp + ALOGV("using buffer PTS of %lld", (long long)mediaTimeUs); renderTimeNs = mediaTimeUs * 1000; -#endif } + info->mNotify->setInt64("timestampNs", renderTimeNs); if (mSoftRenderer != NULL) { std::list<FrameRenderTracker::Info> doneFrames = mSoftRenderer->render( diff --git a/media/libstagefright/MediaCodecList.cpp b/media/libstagefright/MediaCodecList.cpp index d48ede9..a47bfc7 100644 --- a/media/libstagefright/MediaCodecList.cpp +++ b/media/libstagefright/MediaCodecList.cpp @@ -79,6 +79,8 @@ sp<IMediaCodecList> MediaCodecList::sCodecList; // static void *MediaCodecList::profilerThreadWrapper(void * /*arg*/) { ALOGV("Enter profilerThreadWrapper."); + remove(kProfilingResults); // remove previous result so that it won't be loaded to + // the new MediaCodecList MediaCodecList *codecList = new MediaCodecList(); if (codecList->initCheck() != OK) { ALOGW("Failed to create a new MediaCodecList, skipping codec profiling."); @@ -218,7 +220,8 @@ void MediaCodecList::parseTopLevelXMLFile(const char *codecs_xml, bool ignore_er } } - for (size_t i = mCodecInfos.size(); i-- > 0;) { + for (size_t i = mCodecInfos.size(); i > 0;) { + i--; const MediaCodecInfo &info = *mCodecInfos.itemAt(i).get(); if (info.mCaps.size() == 0) { // No types supported by this component??? diff --git a/media/libstagefright/foundation/AHierarchicalStateMachine.cpp b/media/libstagefright/foundation/AHierarchicalStateMachine.cpp index 5f7c70d..b837f66 100644 --- a/media/libstagefright/foundation/AHierarchicalStateMachine.cpp +++ b/media/libstagefright/foundation/AHierarchicalStateMachine.cpp @@ -109,7 +109,8 @@ void AHierarchicalStateMachine::changeState(const sp<AState> &state) { A.editItemAt(i)->stateExited(); } - for (size_t i = B.size(); i-- > 0;) { + for (size_t i = B.size(); i > 0;) { + i--; B.editItemAt(i)->stateEntered(); } } diff --git a/media/libstagefright/foundation/ALooperRoster.cpp b/media/libstagefright/foundation/ALooperRoster.cpp index 473ce1b..9ed53e7 100644 --- a/media/libstagefright/foundation/ALooperRoster.cpp +++ b/media/libstagefright/foundation/ALooperRoster.cpp @@ -79,7 +79,8 @@ void ALooperRoster::unregisterStaleHandlers() { { Mutex::Autolock autoLock(mLock); - for (size_t i = mHandlers.size(); i-- > 0;) { + for (size_t i = mHandlers.size(); i > 0;) { + i--; const HandlerInfo &info = mHandlers.valueAt(i); sp<ALooper> looper = info.mLooper.promote(); |