Revert Widevine 6.0.0 -> 4.5.0 libraries
Includes Widevine libraries Version 4.5.0.7809 Also fixed samplePlayer's MediaCodec mode not running and WVDrmInfoRequestStatusKey returning incorrect value. Change-Id: Ibcc6d313790670a908ada93be80d6bf55a67b4ed related-to-bug: 6929628 related-to-bug: 6833718 related-to-bug: 6889322
This commit is contained in:
@@ -3,7 +3,7 @@ ifneq ($(filter arm x86,$(TARGET_ARCH)),)
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
include vendor/widevine/proprietary/wvm/common.mk
|
||||
include $(TOP)/vendor/widevine/proprietary/wvm/common.mk
|
||||
|
||||
ifeq ($(BOARD_WIDEVINE_OEMCRYPTO_LEVEL),1)
|
||||
LOCAL_CFLAGS := -DREQUIRE_SECURE_BUFFERS
|
||||
|
||||
@@ -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;
|
||||
@@ -375,7 +397,7 @@ status_t WVMExtractorImpl::readESDSMetaData(sp<MetaData> audioMetaData)
|
||||
int limit = 500;
|
||||
do {
|
||||
size_t bytesRead;
|
||||
bool auEnd, sync;
|
||||
bool auStart, sync;
|
||||
unsigned long long dts, pts;
|
||||
unsigned char buf[1];
|
||||
size_t bufSize = 0;
|
||||
@@ -385,7 +407,7 @@ status_t WVMExtractorImpl::readESDSMetaData(sp<MetaData> audioMetaData)
|
||||
// pull some audio data. But we can't use it yet, so just request 0 bytes.
|
||||
//
|
||||
(void)WV_GetEsData(mSession, WV_EsSelector_Audio, buf, bufSize,
|
||||
bytesRead, dts, pts, sync, auEnd);
|
||||
bytesRead, auStart, dts, pts, sync);
|
||||
|
||||
result = WV_Info_GetCodecConfig(mSession, WV_CodecConfigType_ESDS, config, size);
|
||||
if (result != WV_Status_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;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ WVMMediaSource::WVMMediaSource(WVSession *session, WVEsSelector esSelector,
|
||||
mNewSegment(false),
|
||||
mCryptoInitialized(false),
|
||||
mIsStalled(false),
|
||||
mStripADTS(false),
|
||||
mGroup(NULL),
|
||||
mKeyTime(0),
|
||||
mDts(0),
|
||||
@@ -53,6 +54,11 @@ WVMMediaSource::WVMMediaSource(WVSession *session, WVEsSelector esSelector,
|
||||
}
|
||||
}
|
||||
}
|
||||
mStripADTS = true;
|
||||
#else
|
||||
if (cryptoPluginMode) {
|
||||
mStripADTS = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -171,19 +177,21 @@ sp<MetaData> WVMMediaSource::getFormat()
|
||||
{
|
||||
Mutex::Autolock autoLock(mLock);
|
||||
|
||||
#ifdef REQUIRE_SECURE_BUFFERS
|
||||
if (!mIsLiveStream) {
|
||||
#ifdef REQUIRE_SECURE_BUFFERS
|
||||
if (mESSelector == WV_EsSelector_Video) {
|
||||
mTrackMetaData->setInt32(kKeyRequiresSecureBuffers, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Only support AAC on android for now, so assume the audio
|
||||
// track is AAC and notify the audio codec it has ADTS framing
|
||||
if (mESSelector == WV_EsSelector_Audio) {
|
||||
mTrackMetaData->setInt32(kKeyIsADTS, 1);
|
||||
if (mStripADTS) {
|
||||
// Only support AAC on android for now, so assume the audio
|
||||
// track is AAC and notify the audio codec it has ADTS framing
|
||||
if (mESSelector == WV_EsSelector_Audio) {
|
||||
mTrackMetaData->setInt32(kKeyIsADTS, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return mTrackMetaData;
|
||||
}
|
||||
@@ -260,13 +268,11 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
|
||||
return err;
|
||||
}
|
||||
|
||||
#ifdef REQUIRE_SECURE_BUFFERS
|
||||
mDecryptContext.Initialize(mediaBuf);
|
||||
mEncryptedSizes.clear();
|
||||
#endif
|
||||
|
||||
size_t bytesRead;
|
||||
bool auEnd;
|
||||
bool auStart;
|
||||
size_t offset = 0;
|
||||
|
||||
bool syncFrame;
|
||||
@@ -281,7 +287,7 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
|
||||
size_t size = mediaBuf->size() - offset;
|
||||
|
||||
WVStatus result = WV_GetEsData(mSession, mESSelector, (uint8_t *)mediaBuf->data() + offset,
|
||||
size, bytesRead, mDts, mPts, syncFrame, auEnd);
|
||||
size, bytesRead, auStart, mDts, mPts, syncFrame);
|
||||
|
||||
if (result != WV_Status_OK &&
|
||||
result != WV_Status_Warning_Need_Key &&
|
||||
@@ -351,10 +357,8 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
|
||||
// drop frames up to next sync if requested
|
||||
mIsStalled = true;
|
||||
usleep(10000);
|
||||
#ifdef REQUIRE_SECURE_BUFFERS
|
||||
mDecryptContext.Initialize(mediaBuf);
|
||||
mEncryptedSizes.clear();
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -394,13 +398,15 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
|
||||
|
||||
mediaBuf->set_range(0, bytesRead + offset);
|
||||
|
||||
#ifdef REQUIRE_SECURE_BUFFERS
|
||||
if (!mIsLiveStream && mEncryptedSizes.size()) {
|
||||
mediaBuf->meta_data()->setData(kKeyEncryptedSizes, 0, &mEncryptedSizes[0],
|
||||
mEncryptedSizes.size() * sizeof(size_t));
|
||||
mediaBuf->meta_data()->setInt32(kKeyCryptoMode, CryptoPlugin::kMode_AES_WV);
|
||||
}
|
||||
|
||||
#ifndef REQUIRE_SECURE_BUFFERS
|
||||
mediaBuf->meta_data()->setData(kKeyCryptoKey, 0, mCryptoPluginKey, sizeof(mCryptoPluginKey));
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0
|
||||
// debug code - log packets to files
|
||||
@@ -432,11 +438,9 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
|
||||
return OK;
|
||||
}
|
||||
|
||||
#ifdef REQUIRE_SECURE_BUFFERS
|
||||
|
||||
WVStatus WVMMediaSource::DecryptCallback(WVEsSelector esType, void* input, void* output, size_t length,
|
||||
int key, unsigned long long dts, unsigned long long pts, bool au_end,
|
||||
void *obj)
|
||||
void WVMMediaSource::DecryptCallback(WVEsSelector esType, void* input, void* output,
|
||||
size_t length, int key, void *obj)
|
||||
{
|
||||
//ALOGD("DecryptCallback(type=%d, in=%p, out=%p, len=%d, key=%d\n",
|
||||
// (int)esType, input, output, length, key);
|
||||
@@ -444,7 +448,7 @@ WVStatus WVMMediaSource::DecryptCallback(WVEsSelector esType, void* input, void*
|
||||
ClientContext *clientContext = (ClientContext *)obj;
|
||||
if (!clientContext) {
|
||||
ALOGE("WVMMediaSource::DecryptCallback - no client context!");
|
||||
return WV_Status_Unknown;
|
||||
return;
|
||||
}
|
||||
|
||||
sp<WVMMediaSource> source;
|
||||
@@ -454,11 +458,7 @@ WVStatus WVMMediaSource::DecryptCallback(WVEsSelector esType, void* input, void*
|
||||
source = clientContext->getAudioSource();
|
||||
|
||||
DecryptContext &context = source->getDecryptContext();
|
||||
|
||||
OEMCrypto_UINT32 copied = length;
|
||||
OEMCryptoResult result;
|
||||
WVStatus status = WV_Status_OK;
|
||||
unsigned char *iv = NULL;
|
||||
uint32_t copied = length;
|
||||
|
||||
if (clientContext->getCryptoPluginMode()) {
|
||||
// just determine crypto unit boundaries
|
||||
@@ -467,7 +467,12 @@ WVStatus WVMMediaSource::DecryptCallback(WVEsSelector esType, void* input, void*
|
||||
}
|
||||
memcpy((uint8_t *)context.mMediaBuf->data() + context.mOffset, input, length);
|
||||
} else {
|
||||
|
||||
#ifdef REQUIRE_SECURE_BUFFERS
|
||||
// do decrypt
|
||||
OEMCryptoResult result;
|
||||
unsigned char *iv = NULL;
|
||||
|
||||
if (key)
|
||||
iv = context.mIV;
|
||||
|
||||
@@ -481,18 +486,13 @@ WVStatus WVMMediaSource::DecryptCallback(WVEsSelector esType, void* input, void*
|
||||
&copied);
|
||||
}
|
||||
|
||||
if (result == OEMCrypto_SUCCESS) {
|
||||
status = WV_Status_OK;
|
||||
} else {
|
||||
status = WV_Status_Unknown;
|
||||
if (result != OEMCrypto_SUCCESS) {
|
||||
ALOGD("OEMCrypto decrypt failure: %d", result);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
context.mOffset += copied;
|
||||
|
||||
return status;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
WVMMediaSource::~WVMMediaSource()
|
||||
|
||||
@@ -7,5 +7,5 @@ LOCAL_C_INCLUDES:= \
|
||||
vendor/widevine/proprietary/wvm/include
|
||||
|
||||
ifeq ($(TARGET_ARCH),x86)
|
||||
LOCAL_C_INCLUDES += system/core/include/arch/linux-x86
|
||||
LOCAL_C_INCLUDES += $(TOP)/system/core/include/arch/linux-x86
|
||||
endif
|
||||
|
||||
@@ -80,7 +80,7 @@ private:
|
||||
|
||||
status_t readMetaData();
|
||||
|
||||
const static size_t kStreamCacheSize = 16 * 1024 * 1024;
|
||||
const static size_t kStreamCacheSize = 10 * 1024 * 1024;
|
||||
|
||||
WVMExtractorImpl(const WVMExtractorImpl &);
|
||||
WVMExtractorImpl &operator=(const WVMExtractorImpl &);
|
||||
|
||||
@@ -47,7 +47,8 @@ public:
|
||||
|
||||
int64_t getTime() { return mKeyTime; }; // usec.
|
||||
|
||||
#ifdef REQUIRE_SECURE_BUFFERS
|
||||
static const int kCryptoBlockSize = 16;
|
||||
|
||||
class DecryptContext {
|
||||
public:
|
||||
void Initialize(MediaBuffer *mediaBuf) {
|
||||
@@ -57,17 +58,19 @@ public:
|
||||
}
|
||||
MediaBuffer *mMediaBuf;
|
||||
size_t mOffset;
|
||||
static const int kCryptoBlockSize = 16;
|
||||
unsigned char mIV[kCryptoBlockSize];
|
||||
};
|
||||
|
||||
static WVStatus DecryptCallback(WVEsSelector esType, void* input, void* output, size_t length,
|
||||
int key, unsigned long long dts, unsigned long long pts,
|
||||
bool au_end, void *context);
|
||||
static void DecryptCallback(WVEsSelector esType, void* input, void* output, size_t length,
|
||||
int key, void *context);
|
||||
DecryptContext& getDecryptContext() { return mDecryptContext; }
|
||||
|
||||
void SetCryptoPluginKey(const char key[kCryptoBlockSize]) {
|
||||
memcpy(mCryptoPluginKey, key, sizeof(mCryptoPluginKey));
|
||||
}
|
||||
|
||||
private:
|
||||
DecryptContext mDecryptContext;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual ~WVMMediaSource();
|
||||
@@ -86,6 +89,7 @@ private:
|
||||
bool mNewSegment;
|
||||
bool mCryptoInitialized;
|
||||
bool mIsStalled;
|
||||
bool mStripADTS;
|
||||
|
||||
MediaBufferGroup *mGroup;
|
||||
|
||||
@@ -98,6 +102,7 @@ private:
|
||||
sp<ClientContext> mClientContext;
|
||||
|
||||
Vector<size_t> mEncryptedSizes;
|
||||
char mCryptoPluginKey[kCryptoBlockSize];
|
||||
|
||||
void allocBufferGroup();
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ LOCAL_C_INCLUDES+= \
|
||||
frameworks/av/media/libstagefright
|
||||
|
||||
ifeq ($(TARGET_ARCH),x86)
|
||||
LOCAL_C_INCLUDES += system/core/include/arch/linux-x86
|
||||
LOCAL_C_INCLUDES += $(TOP)/system/core/include/arch/linux-x86
|
||||
endif
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Widevine wvm static library. Sets up includes and defines the core libraries
|
||||
# required.
|
||||
#
|
||||
include vendor/widevine/proprietary/wvm/common.mk
|
||||
include $(TOP)/vendor/widevine/proprietary/wvm/common.mk
|
||||
|
||||
ifndef BOARD_WIDEVINE_OEMCRYPTO_LEVEL
|
||||
$(error BOARD_WIDEVINE_OEMCRYPTO_LEVEL not defined!)
|
||||
|
||||
Reference in New Issue
Block a user