summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/ACodec.cpp
diff options
context:
space:
mode:
authorLajos Molnar <lajos@google.com>2014-10-22 21:27:05 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-10-22 21:27:05 +0000
commit11f437a6665167d8aee6db59df6e4753aa190bf7 (patch)
tree77f97ebb0df77973fb9c6c359600d7e9f1f29802 /media/libstagefright/ACodec.cpp
parentccaf667eb6e96a28caedb0d4f776b1ff9c4aed10 (diff)
parentedcff417bbb2e76245b559e7c9a8b98c2a60e102 (diff)
downloadframeworks_av-11f437a6665167d8aee6db59df6e4753aa190bf7.zip
frameworks_av-11f437a6665167d8aee6db59df6e4753aa190bf7.tar.gz
frameworks_av-11f437a6665167d8aee6db59df6e4753aa190bf7.tar.bz2
am edcff417: am 42aae0c4: am f04e8b5e: am 25842048: Merge "stagefright: try to free codec instance if MediaCodec.release hangs" into lmp-dev
* commit 'edcff417bbb2e76245b559e7c9a8b98c2a60e102': stagefright: try to free codec instance if MediaCodec.release hangs
Diffstat (limited to 'media/libstagefright/ACodec.cpp')
-rw-r--r--media/libstagefright/ACodec.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index fcc3a5a..4702874 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -498,6 +498,10 @@ void ACodec::initiateShutdown(bool keepComponentAllocated) {
sp<AMessage> msg = new AMessage(kWhatShutdown, id());
msg->setInt32("keepComponentAllocated", keepComponentAllocated);
msg->post();
+ if (!keepComponentAllocated) {
+ // ensure shutdown completes in 3 seconds
+ (new AMessage(kWhatReleaseCodecInstance, id()))->post(3000000);
+ }
}
void ACodec::signalRequestIDRFrame() {
@@ -3797,6 +3801,19 @@ bool ACodec::BaseState::onMessageReceived(const sp<AMessage> &msg) {
break;
}
+ case ACodec::kWhatReleaseCodecInstance:
+ {
+ ALOGI("[%s] forcing the release of codec",
+ mCodec->mComponentName.c_str());
+ status_t err = mCodec->mOMX->freeNode(mCodec->mNode);
+ 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->post();
+ break;
+ }
+
default:
return false;
}
@@ -4456,6 +4473,13 @@ bool ACodec::UninitializedState::onMessageReceived(const sp<AMessage> &msg) {
break;
}
+ case ACodec::kWhatReleaseCodecInstance:
+ {
+ // nothing to do, as we have already signaled shutdown
+ handled = true;
+ break;
+ }
+
default:
return BaseState::onMessageReceived(msg);
}