Move OEMCrypto_Initialize earlier

Some OEMCrypto calls are happening before OEMCrypto_Initialize.
This change moves initialization earlier so it occurs before
any other calls to OEMCrypto.

bug: 10582250
Change-Id: Ic8992e8f0738dbfeb10074a4e1543bb9931a49d5
This commit is contained in:
Jeff Tinker
2013-10-28 15:19:15 -07:00
parent 6fc2ee33c3
commit acb47e0f9a
4 changed files with 16 additions and 16 deletions

View File

@@ -104,6 +104,7 @@ WVMExtractorImpl::WVMExtractorImpl(sp<DataSource> dataSource)
mHaveMetaData(false),
mUseAdaptiveStreaming(false),
mIsLiveStream(false),
mCryptoInitialized(false),
mSession(NULL),
mDuration(0),
mError(OK),
@@ -151,6 +152,15 @@ void WVMExtractorImpl::Initialize()
memset( &callbacks, 0, sizeof(callbacks));
callbacks.socketInfo = SocketInfoCallback;
#ifdef REQUIRE_SECURE_BUFFERS
if (!mClientContext->getCryptoPluginMode()) {
OEMCryptoResult res = OEMCrypto_Initialize();
if (res == OEMCrypto_SUCCESS) {
mCryptoInitialized = true;
} else {
ALOGE("Crypto initialize failed (%d)", res);
}
}
if (!mIsLiveStream) {
//ALOGD("WVMExtractorImpl::Initialize setting DecryptCallback\n");
callbacks.decrypt = WVMMediaSource::DecryptCallback;
@@ -364,9 +374,9 @@ status_t WVMExtractorImpl::readMetaData()
bool cryptoPluginMode = mClientContext->getCryptoPluginMode();
mAudioSource = new WVMMediaSource(mSession, WV_EsSelector_Audio, audioMetaData,
mIsLiveStream, cryptoPluginMode);
mIsLiveStream, cryptoPluginMode, false);
mVideoSource = new WVMMediaSource(mSession, WV_EsSelector_Video, videoMetaData,
mIsLiveStream, cryptoPluginMode);
mIsLiveStream, cryptoPluginMode, mCryptoInitialized);
// Since the WVExtractor goes away soon after this, we delegate ownership of some resources
// to the constructed media source