Loading cmds/stagefright/sf2.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -230,7 +230,8 @@ protected: mCodec->signalResume(); (new AMessage(kWhatSeek, this))->post(5000000ll); } else if (what == CodecBase::kWhatShutdownCompleted) { } else if (what == CodecBase::kWhatStopCompleted || what == CodecBase::kWhatReleaseCompleted) { mDecodeLooper->unregisterHandler(mCodec->id()); if (mDecodeLooper != looper()) { Loading include/media/stagefright/CodecBase.h +2 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,8 @@ struct CodecBase : public AHandler, /* static */ ColorUtils { kWhatFillThisBuffer = 'fill', kWhatDrainThisBuffer = 'drai', kWhatEOS = 'eos ', kWhatShutdownCompleted = 'scom', kWhatStopCompleted = 'scom', kWhatReleaseCompleted = 'rcom', kWhatFlushCompleted = 'fcom', kWhatError = 'erro', kWhatComponentAllocated = 'cAll', Loading media/libstagefright/ACodec.cpp +11 −7 Original line number Diff line number Diff line Loading @@ -1201,6 +1201,10 @@ status_t ACodec::allocateOutputMetadataBuffers() { info.mDequeuedAt = mDequeueCounter; info.mData = new MediaCodecBuffer(mOutputFormat, new ABuffer(bufferSize)); // Initialize fence fd to -1 to avoid warning in freeBuffer(). ((VideoNativeMetadata *)info.mData->base())->nFenceFd = -1; info.mCodecData = info.mData; err = mOMXNode->useBuffer(kPortIndexOutput, OMXBuffer::sPreset, &info.mBufferID); Loading Loading @@ -5259,7 +5263,7 @@ bool ACodec::BaseState::onMessageReceived(const sp<AMessage> &msg) { ALOGE_IF("[%s] failed to release codec instance: err=%d", mCodec->mComponentName.c_str(), err); sp<AMessage> notify = mCodec->mNotify->dup(); notify->setInt32("what", CodecBase::kWhatShutdownCompleted); notify->setInt32("what", CodecBase::kWhatReleaseCompleted); notify->post(); break; } Loading Loading @@ -6148,7 +6152,8 @@ bool ACodec::UninitializedState::onMessageReceived(const sp<AMessage> &msg) { "cannot keep component allocated on shutdown in Uninitialized state"); sp<AMessage> notify = mCodec->mNotify->dup(); notify->setInt32("what", CodecBase::kWhatShutdownCompleted); notify->setInt32("what", keepComponentAllocated ? CodecBase::kWhatStopCompleted : CodecBase::kWhatReleaseCompleted); notify->post(); handled = true; Loading Loading @@ -6345,7 +6350,8 @@ void ACodec::LoadedState::onShutdown(bool keepComponentAllocated) { if (mCodec->mExplicitShutdown) { sp<AMessage> notify = mCodec->mNotify->dup(); notify->setInt32("what", CodecBase::kWhatShutdownCompleted); notify->setInt32("what", keepComponentAllocated ? CodecBase::kWhatStopCompleted : CodecBase::kWhatReleaseCompleted); notify->post(); mCodec->mExplicitShutdown = false; } Loading Loading @@ -7347,8 +7353,7 @@ bool ACodec::ExecutingToIdleState::onMessageReceived(const sp<AMessage> &msg) { case kWhatShutdown: { // We're already doing that... mCodec->deferMessage(msg); handled = true; break; } Loading Loading @@ -7457,8 +7462,7 @@ bool ACodec::IdleToLoadedState::onMessageReceived(const sp<AMessage> &msg) { switch (msg->what()) { case kWhatShutdown: { // We're already doing that... mCodec->deferMessage(msg); handled = true; break; } Loading media/libstagefright/MediaCodec.cpp +16 −9 Original line number Diff line number Diff line Loading @@ -1560,19 +1560,26 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { break; } case CodecBase::kWhatShutdownCompleted: case CodecBase::kWhatStopCompleted: { if (mState == UNINITIALIZED) { // Ignore shutdown complete if we're already released. if (mState != STOPPING) { ALOGW("Received kWhatStopCompleted in state %d", mState); break; } if (mState == STOPPING) { setState(INITIALIZED); } else { CHECK_EQ(mState, RELEASING); (new AMessage)->postReply(mReplyID); break; } case CodecBase::kWhatReleaseCompleted: { if (mState != RELEASING) { ALOGW("Received kWhatReleaseCompleted in state %d", mState); break; } setState(UNINITIALIZED); mComponentName.clear(); } mFlags &= ~kFlagIsComponentAllocated; mResourceManagerService->removeResource(getId(mResourceManagerClient)); Loading media/libstagefright/filters/MediaFilter.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -676,7 +676,8 @@ void MediaFilter::onShutdown(const sp<AMessage> &msg) { } sp<AMessage> notify = mNotify->dup(); notify->setInt32("what", CodecBase::kWhatShutdownCompleted); notify->setInt32("what", keepComponentAllocated ? CodecBase::kWhatStopCompleted : CodecBase::kWhatReleaseCompleted); notify->post(); } Loading Loading
cmds/stagefright/sf2.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -230,7 +230,8 @@ protected: mCodec->signalResume(); (new AMessage(kWhatSeek, this))->post(5000000ll); } else if (what == CodecBase::kWhatShutdownCompleted) { } else if (what == CodecBase::kWhatStopCompleted || what == CodecBase::kWhatReleaseCompleted) { mDecodeLooper->unregisterHandler(mCodec->id()); if (mDecodeLooper != looper()) { Loading
include/media/stagefright/CodecBase.h +2 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,8 @@ struct CodecBase : public AHandler, /* static */ ColorUtils { kWhatFillThisBuffer = 'fill', kWhatDrainThisBuffer = 'drai', kWhatEOS = 'eos ', kWhatShutdownCompleted = 'scom', kWhatStopCompleted = 'scom', kWhatReleaseCompleted = 'rcom', kWhatFlushCompleted = 'fcom', kWhatError = 'erro', kWhatComponentAllocated = 'cAll', Loading
media/libstagefright/ACodec.cpp +11 −7 Original line number Diff line number Diff line Loading @@ -1201,6 +1201,10 @@ status_t ACodec::allocateOutputMetadataBuffers() { info.mDequeuedAt = mDequeueCounter; info.mData = new MediaCodecBuffer(mOutputFormat, new ABuffer(bufferSize)); // Initialize fence fd to -1 to avoid warning in freeBuffer(). ((VideoNativeMetadata *)info.mData->base())->nFenceFd = -1; info.mCodecData = info.mData; err = mOMXNode->useBuffer(kPortIndexOutput, OMXBuffer::sPreset, &info.mBufferID); Loading Loading @@ -5259,7 +5263,7 @@ bool ACodec::BaseState::onMessageReceived(const sp<AMessage> &msg) { ALOGE_IF("[%s] failed to release codec instance: err=%d", mCodec->mComponentName.c_str(), err); sp<AMessage> notify = mCodec->mNotify->dup(); notify->setInt32("what", CodecBase::kWhatShutdownCompleted); notify->setInt32("what", CodecBase::kWhatReleaseCompleted); notify->post(); break; } Loading Loading @@ -6148,7 +6152,8 @@ bool ACodec::UninitializedState::onMessageReceived(const sp<AMessage> &msg) { "cannot keep component allocated on shutdown in Uninitialized state"); sp<AMessage> notify = mCodec->mNotify->dup(); notify->setInt32("what", CodecBase::kWhatShutdownCompleted); notify->setInt32("what", keepComponentAllocated ? CodecBase::kWhatStopCompleted : CodecBase::kWhatReleaseCompleted); notify->post(); handled = true; Loading Loading @@ -6345,7 +6350,8 @@ void ACodec::LoadedState::onShutdown(bool keepComponentAllocated) { if (mCodec->mExplicitShutdown) { sp<AMessage> notify = mCodec->mNotify->dup(); notify->setInt32("what", CodecBase::kWhatShutdownCompleted); notify->setInt32("what", keepComponentAllocated ? CodecBase::kWhatStopCompleted : CodecBase::kWhatReleaseCompleted); notify->post(); mCodec->mExplicitShutdown = false; } Loading Loading @@ -7347,8 +7353,7 @@ bool ACodec::ExecutingToIdleState::onMessageReceived(const sp<AMessage> &msg) { case kWhatShutdown: { // We're already doing that... mCodec->deferMessage(msg); handled = true; break; } Loading Loading @@ -7457,8 +7462,7 @@ bool ACodec::IdleToLoadedState::onMessageReceived(const sp<AMessage> &msg) { switch (msg->what()) { case kWhatShutdown: { // We're already doing that... mCodec->deferMessage(msg); handled = true; break; } Loading
media/libstagefright/MediaCodec.cpp +16 −9 Original line number Diff line number Diff line Loading @@ -1560,19 +1560,26 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { break; } case CodecBase::kWhatShutdownCompleted: case CodecBase::kWhatStopCompleted: { if (mState == UNINITIALIZED) { // Ignore shutdown complete if we're already released. if (mState != STOPPING) { ALOGW("Received kWhatStopCompleted in state %d", mState); break; } if (mState == STOPPING) { setState(INITIALIZED); } else { CHECK_EQ(mState, RELEASING); (new AMessage)->postReply(mReplyID); break; } case CodecBase::kWhatReleaseCompleted: { if (mState != RELEASING) { ALOGW("Received kWhatReleaseCompleted in state %d", mState); break; } setState(UNINITIALIZED); mComponentName.clear(); } mFlags &= ~kFlagIsComponentAllocated; mResourceManagerService->removeResource(getId(mResourceManagerClient)); Loading
media/libstagefright/filters/MediaFilter.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -676,7 +676,8 @@ void MediaFilter::onShutdown(const sp<AMessage> &msg) { } sp<AMessage> notify = mNotify->dup(); notify->setInt32("what", CodecBase::kWhatShutdownCompleted); notify->setInt32("what", keepComponentAllocated ? CodecBase::kWhatStopCompleted : CodecBase::kWhatReleaseCompleted); notify->post(); } Loading