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

View File

@@ -28,14 +28,14 @@ int64_t WVMMediaSource::sLastSeekTimeUs = -1;
WVMMediaSource::WVMMediaSource(WVSession *session, WVEsSelector esSelector, WVMMediaSource::WVMMediaSource(WVSession *session, WVEsSelector esSelector,
const sp<MetaData> &metaData, bool isLive, const sp<MetaData> &metaData, bool isLive,
bool cryptoPluginMode) bool cryptoPluginMode, bool cryptoInitialized)
: mSession(session), : mSession(session),
mESSelector(esSelector), mESSelector(esSelector),
mTrackMetaData(metaData), mTrackMetaData(metaData),
mStarted(false), mStarted(false),
mIsLiveStream(isLive), mIsLiveStream(isLive),
mNewSegment(false), mNewSegment(false),
mCryptoInitialized(false), mCryptoInitialized(cryptoInitialized),
mStripADTS(false), mStripADTS(false),
mCryptoPluginMode(cryptoPluginMode), mCryptoPluginMode(cryptoPluginMode),
mGroup(NULL), mGroup(NULL),
@@ -45,16 +45,6 @@ WVMMediaSource::WVMMediaSource(WVSession *session, WVEsSelector esSelector,
{ {
_ah010(_cb); _ah010(_cb);
#ifdef REQUIRE_SECURE_BUFFERS #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; mStripADTS = true;
#else #else
if (cryptoPluginMode) { if (cryptoPluginMode) {

View File

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

View File

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