Loading include/media/stagefright/ACodec.h +1 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,7 @@ private: bool mIsEncoder; bool mUseMetadataOnEncoderOutput; bool mShutdownInProgress; bool mExplicitShutdown; // If "mKeepComponentAllocated" we only transition back to Loaded state // and do not release the component instance. Loading media/libstagefright/ACodec.cpp +12 −4 Original line number Diff line number Diff line Loading @@ -365,6 +365,7 @@ ACodec::ACodec() mIsEncoder(false), mUseMetadataOnEncoderOutput(false), mShutdownInProgress(false), mExplicitShutdown(false), mEncoderDelay(0), mEncoderPadding(0), mChannelMaskPresent(false), Loading Loading @@ -3722,7 +3723,8 @@ bool ACodec::UninitializedState::onMessageReceived(const sp<AMessage> &msg) { int32_t keepComponentAllocated; CHECK(msg->findInt32( "keepComponentAllocated", &keepComponentAllocated)); CHECK(!keepComponentAllocated); ALOGW_IF(keepComponentAllocated, "cannot keep component allocated on shutdown in Uninitialized state"); sp<AMessage> notify = mCodec->mNotify->dup(); notify->setInt32("what", ACodec::kWhatShutdownCompleted); Loading Loading @@ -3895,6 +3897,7 @@ void ACodec::LoadedState::stateEntered() { onShutdown(keepComponentAllocated); } mCodec->mExplicitShutdown = false; } void ACodec::LoadedState::onShutdown(bool keepComponentAllocated) { Loading @@ -3904,9 +3907,12 @@ void ACodec::LoadedState::onShutdown(bool keepComponentAllocated) { mCodec->changeState(mCodec->mUninitializedState); } if (mCodec->mExplicitShutdown) { sp<AMessage> notify = mCodec->mNotify->dup(); notify->setInt32("what", ACodec::kWhatShutdownCompleted); notify->post(); mCodec->mExplicitShutdown = false; } } bool ACodec::LoadedState::onMessageReceived(const sp<AMessage> &msg) { Loading Loading @@ -3940,6 +3946,7 @@ bool ACodec::LoadedState::onMessageReceived(const sp<AMessage> &msg) { CHECK(msg->findInt32( "keepComponentAllocated", &keepComponentAllocated)); mCodec->mExplicitShutdown = true; onShutdown(keepComponentAllocated); handled = true; Loading Loading @@ -4359,6 +4366,7 @@ bool ACodec::ExecutingState::onMessageReceived(const sp<AMessage> &msg) { "keepComponentAllocated", &keepComponentAllocated)); mCodec->mShutdownInProgress = true; mCodec->mExplicitShutdown = true; mCodec->mKeepComponentAllocated = keepComponentAllocated; mActive = false; Loading Loading
include/media/stagefright/ACodec.h +1 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,7 @@ private: bool mIsEncoder; bool mUseMetadataOnEncoderOutput; bool mShutdownInProgress; bool mExplicitShutdown; // If "mKeepComponentAllocated" we only transition back to Loaded state // and do not release the component instance. Loading
media/libstagefright/ACodec.cpp +12 −4 Original line number Diff line number Diff line Loading @@ -365,6 +365,7 @@ ACodec::ACodec() mIsEncoder(false), mUseMetadataOnEncoderOutput(false), mShutdownInProgress(false), mExplicitShutdown(false), mEncoderDelay(0), mEncoderPadding(0), mChannelMaskPresent(false), Loading Loading @@ -3722,7 +3723,8 @@ bool ACodec::UninitializedState::onMessageReceived(const sp<AMessage> &msg) { int32_t keepComponentAllocated; CHECK(msg->findInt32( "keepComponentAllocated", &keepComponentAllocated)); CHECK(!keepComponentAllocated); ALOGW_IF(keepComponentAllocated, "cannot keep component allocated on shutdown in Uninitialized state"); sp<AMessage> notify = mCodec->mNotify->dup(); notify->setInt32("what", ACodec::kWhatShutdownCompleted); Loading Loading @@ -3895,6 +3897,7 @@ void ACodec::LoadedState::stateEntered() { onShutdown(keepComponentAllocated); } mCodec->mExplicitShutdown = false; } void ACodec::LoadedState::onShutdown(bool keepComponentAllocated) { Loading @@ -3904,9 +3907,12 @@ void ACodec::LoadedState::onShutdown(bool keepComponentAllocated) { mCodec->changeState(mCodec->mUninitializedState); } if (mCodec->mExplicitShutdown) { sp<AMessage> notify = mCodec->mNotify->dup(); notify->setInt32("what", ACodec::kWhatShutdownCompleted); notify->post(); mCodec->mExplicitShutdown = false; } } bool ACodec::LoadedState::onMessageReceived(const sp<AMessage> &msg) { Loading Loading @@ -3940,6 +3946,7 @@ bool ACodec::LoadedState::onMessageReceived(const sp<AMessage> &msg) { CHECK(msg->findInt32( "keepComponentAllocated", &keepComponentAllocated)); mCodec->mExplicitShutdown = true; onShutdown(keepComponentAllocated); handled = true; Loading Loading @@ -4359,6 +4366,7 @@ bool ACodec::ExecutingState::onMessageReceived(const sp<AMessage> &msg) { "keepComponentAllocated", &keepComponentAllocated)); mCodec->mShutdownInProgress = true; mCodec->mExplicitShutdown = true; mCodec->mKeepComponentAllocated = keepComponentAllocated; mActive = false; Loading