Ensure terminate is called in all error cases

bug: 18203007
Change-Id: I0d74b348982992075ec126a324dabbff8fab9125
This commit is contained in:
Jeff Tinker
2014-12-11 19:25:21 -08:00
parent 4dd748597a
commit 07478a67cb

View File

@@ -204,17 +204,17 @@ void WVMExtractorImpl::Initialize()
if (mSetupStatus != OK) {
setError(mSetupStatus);
#ifdef REQUIRE_SECURE_BUFFERS
if (mCryptoInitialized) {
OEMCrypto_Terminate();
}
#endif
}
WV_SetWarningToErrorMS(10000);
}
WVMExtractorImpl::~WVMExtractorImpl() {
#ifdef REQUIRE_SECURE_BUFFERS
if (mCryptoInitialized) {
OEMCrypto_Terminate();
}
#endif
}
// Release decrypt handle when media sources are destroyed
@@ -383,6 +383,9 @@ status_t WVMExtractorImpl::readMetaData()
mVideoSource = new WVMMediaSource(mSession, WV_EsSelector_Video, videoMetaData,
mIsLiveStream, cryptoPluginMode, mCryptoInitialized);
// responsibility for terminating has been delegated to WVMMediaSource
mCryptoInitialized = false;
// Since the WVExtractor goes away soon after this, we delegate ownership of some resources
// to the constructed media source
if (mFileSource.get()) {