summaryrefslogtreecommitdiffstats
path: root/media/libstagefright
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2012-08-27 10:14:23 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-08-27 10:14:23 -0700
commit1c356d38527efbbee0894188c0a8f82074b0f441 (patch)
tree15a9f511a77a8817f02c558883052dd754298a2d /media/libstagefright
parent690921927f289da73556ea71c28981194af8ffcd (diff)
parentaa8879d381918335c9d829fc279b76d53a15a550 (diff)
downloadframeworks_av-1c356d38527efbbee0894188c0a8f82074b0f441.zip
frameworks_av-1c356d38527efbbee0894188c0a8f82074b0f441.tar.gz
frameworks_av-1c356d38527efbbee0894188c0a8f82074b0f441.tar.bz2
Merge "Fixed a native crash due to unexpected state at destroy time when encoder component's source fails to start" into jb-mr1-dev
Diffstat (limited to 'media/libstagefright')
-rwxr-xr-xmedia/libstagefright/OMXCodec.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 5615d0f..d0e306c 100755
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -3621,7 +3621,11 @@ status_t OMXCodec::start(MetaData *meta) {
}
params->setInt32(kKeyNumBuffers, mPortBuffers[kPortIndexInput].size());
- return mSource->start(params.get());
+ err = mSource->start(params.get());
+ if (err != OK) {
+ stopOmxComponent_l();
+ }
+ return err;
}
// Decoder case
@@ -3633,8 +3637,16 @@ status_t OMXCodec::start(MetaData *meta) {
status_t OMXCodec::stop() {
CODEC_LOGV("stop mState=%d", mState);
-
Mutex::Autolock autoLock(mLock);
+ status_t err = stopOmxComponent_l();
+ mSource->stop();
+
+ CODEC_LOGV("stopped in state %d", mState);
+ return err;
+}
+
+status_t OMXCodec::stopOmxComponent_l() {
+ CODEC_LOGV("stopOmxComponent_l mState=%d", mState);
while (isIntermediateState(mState)) {
mAsyncCompletion.wait(mLock);
@@ -3732,10 +3744,6 @@ status_t OMXCodec::stop() {
mLeftOverBuffer = NULL;
}
- mSource->stop();
-
- CODEC_LOGV("stopped in state %d", mState);
-
return OK;
}