Add support for crypto HAL on L3 devices DO NOT MERGE
Includes widevine library release version 4.5.0.7571 Change-Id: I9e574d5606576aab376d0524a4bf1a81e5a61678 related-to-bug: 6427322 related-to-bug: 6427274
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
|
||||
#define AES_BLOCK_SIZE 16
|
||||
|
||||
|
||||
using namespace android;
|
||||
|
||||
static sp<DecryptHandle> sDecryptHandle;
|
||||
@@ -33,6 +32,7 @@ static void _cb1(char *data, unsigned long size)
|
||||
if (sDrmManagerClient != NULL) {
|
||||
sDrmManagerClient->initializeDecryptUnit(sDecryptHandle, 0, &buf);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static int _cb2(char *in, char *out, int length, char *iv)
|
||||
@@ -141,6 +141,10 @@ void WVMExtractorImpl::Initialize()
|
||||
//ALOGD("WVMExtractorImpl::Initialize setting DecryptCallback\n");
|
||||
callbacks.decrypt = WVMMediaSource::DecryptCallback;
|
||||
}
|
||||
#else
|
||||
if (!mIsLiveStream && mClientContext->getCryptoPluginMode()) {
|
||||
callbacks.decrypt = WVMMediaSource::DecryptCallback;
|
||||
}
|
||||
#endif
|
||||
result = WV_Initialize(&callbacks);
|
||||
|
||||
@@ -351,8 +355,6 @@ status_t WVMExtractorImpl::readMetaData()
|
||||
mClientContext->setVideoSource(mVideoSource);
|
||||
mVideoSource->delegateClientContext(mClientContext);
|
||||
|
||||
mFileMetaData->setCString(kKeyMIMEType, "video/wvm");
|
||||
|
||||
mHaveMetaData = true;
|
||||
|
||||
mInfoListener->configureHeartbeat();
|
||||
@@ -361,6 +363,26 @@ status_t WVMExtractorImpl::readMetaData()
|
||||
// In crypto plugin mode, need to trigger the drm plugin to begin
|
||||
// license use on playback since the media player isn't involved.
|
||||
sDrmManagerClient->setPlaybackStatus(sDecryptHandle, Playback::START, 0);
|
||||
|
||||
#ifndef REQUIRE_SECURE_BUFFERS
|
||||
if (!mIsLiveStream) {
|
||||
// Get the content key for crypto plugin mode on L3 devices
|
||||
char keyBuffer[AES_BLOCK_SIZE];
|
||||
char nullBuffer[0];
|
||||
DrmBuffer nullDrmBuffer(nullBuffer, 0);
|
||||
DrmBuffer keyDrmBuffer(keyBuffer, sizeof(keyBuffer));
|
||||
DrmBuffer *keyDrmBufferPtr = &keyDrmBuffer;
|
||||
|
||||
status_t status = sDrmManagerClient->decrypt(sDecryptHandle, 0, &nullDrmBuffer,
|
||||
&keyDrmBufferPtr, &nullDrmBuffer);
|
||||
if (status != OK) {
|
||||
return status;
|
||||
}
|
||||
|
||||
mVideoSource->SetCryptoPluginKey(keyBuffer);
|
||||
mAudioSource->SetCryptoPluginKey(keyBuffer);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return OK;
|
||||
@@ -467,11 +489,7 @@ sp<MetaData> WVMExtractorImpl::getTrackMetaData(size_t index, uint32_t flags)
|
||||
}
|
||||
|
||||
sp<MetaData> WVMExtractorImpl::getMetaData() {
|
||||
status_t err;
|
||||
if ((err = readMetaData()) != OK) {
|
||||
return new MetaData;
|
||||
}
|
||||
|
||||
mFileMetaData->setCString(kKeyMIMEType, "video/wvm");
|
||||
return mFileMetaData;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user