From d33b158b5ed85a6e43bf79c646cac72adce3c04f Mon Sep 17 00:00:00 2001 From: Praveen Chavan Date: Thu, 8 Oct 2015 13:43:12 -0700 Subject: Stagefright: Transition to uninitialized state after freeing node If the component is force-released after timeout, there could be a race condition where component posted a message just before it was released. This posted message will cause ACodec to wrongly invoke OMX API on the component which was freed already. Move ACodec to uninitialized state where all component messages will be safely ignored. Change-Id: I71da7c7d021210fd6bed44761740161a5d8894e7 CRs-Fixed: 884165 --- media/libstagefright/ACodec.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'media/libstagefright/ACodec.cpp') diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index 43006f3..8f814d8 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -4611,6 +4611,7 @@ bool ACodec::BaseState::onMessageReceived(const sp &msg) { ALOGI("[%s] forcing the release of codec", mCodec->mComponentName.c_str()); status_t err = mCodec->mOMX->freeNode(mCodec->mNode); + mCodec->changeState(mCodec->mUninitializedState); ALOGE_IF("[%s] failed to release codec instance: err=%d", mCodec->mComponentName.c_str(), err); sp notify = mCodec->mNotify->dup(); -- cgit v1.1