const void *data, size_t size,
unsigned *profile, unsigned *level);
+ status_t stopOmxComponent_l();
+
OMXCodec(const OMXCodec &);
OMXCodec &operator=(const OMXCodec &);
};
}
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
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);
mLeftOverBuffer = NULL;
}
- mSource->stop();
-
- CODEC_LOGV("stopped in state %d", mState);
-
return OK;
}