Merge "Move OEMCrypto_Initialize earlier" into klp-dev
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -76,7 +76,7 @@ private:
|
||||
bool mHaveMetaData;
|
||||
bool mUseAdaptiveStreaming;
|
||||
bool mIsLiveStream;
|
||||
bool mAdaptivePrefetching;
|
||||
bool mCryptoInitialized;
|
||||
|
||||
WVSession *mSession;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user