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:
Edwin Wong
2012-07-23 17:40:57 -07:00
parent 735ec731f2
commit e9f5431e78
33 changed files with 360 additions and 1082 deletions

View File

@@ -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()