Merge "Move OEMCrypto_Initialize earlier" into klp-dev

This commit is contained in:
Jeff Tinker
2013-10-31 22:40:43 +00:00
committed by Android (Google) Code Review
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

View File

@@ -28,14 +28,14 @@ int64_t WVMMediaSource::sLastSeekTimeUs = -1;
WVMMediaSource::WVMMediaSource(WVSession *session, WVEsSelector esSelector,
const sp<MetaData> &metaData, bool isLive,
bool cryptoPluginMode)
bool cryptoPluginMode, bool cryptoInitialized)
: mSession(session),
mESSelector(esSelector),
mTrackMetaData(metaData),
mStarted(false),
mIsLiveStream(isLive),
mNewSegment(false),
mCryptoInitialized(false),
mCryptoInitialized(cryptoInitialized),
mStripADTS(false),
mCryptoPluginMode(cryptoPluginMode),
mGroup(NULL),
@@ -45,16 +45,6 @@ WVMMediaSource::WVMMediaSource(WVSession *session, WVEsSelector esSelector,
{
_ah010(_cb);
#ifdef REQUIRE_SECURE_BUFFERS
if (esSelector == WV_EsSelector_Video) {
if (!cryptoPluginMode) {
OEMCryptoResult result = OEMCrypto_Initialize();
if (result == OEMCrypto_SUCCESS) {
mCryptoInitialized = true;
} else {
ALOGE("Crypto initialize failed (%d)", result);
}
}
}
mStripADTS = true;
#else
if (cryptoPluginMode) {

View File

@@ -76,7 +76,7 @@ private:
bool mHaveMetaData;
bool mUseAdaptiveStreaming;
bool mIsLiveStream;
bool mAdaptivePrefetching;
bool mCryptoInitialized;
WVSession *mSession;

View File

@@ -27,7 +27,7 @@ class WVMMediaSource : public MediaSource {
public:
WVMMediaSource(WVSession *session, WVEsSelector esSelector,
const sp<MetaData> &metaData, bool isLive,
bool cryptoPluginMode);
bool cryptoPluginMode, bool cryptoInitialized);
void delegateFileSource(sp<WVMFileSource> fileSource);
void delegateDataSource(sp<DataSource> dataSource);