From 4f47afda9f5ed2250b37f308a2656edb4af4e245 Mon Sep 17 00:00:00 2001 From: Jeff Tinker Date: Sat, 13 Apr 2013 11:30:17 -0700 Subject: [PATCH] Fix DASH movie playback decrypt error Decryption works now with Exoplayer bug:8604068 Change-Id: Ib24fcd4bb1fce54db9111f3c51e6ab1ff6f475a3 --- libwvdrmengine/mediacrypto/src/WVCryptoPlugin.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libwvdrmengine/mediacrypto/src/WVCryptoPlugin.cpp b/libwvdrmengine/mediacrypto/src/WVCryptoPlugin.cpp index af592fc2..d76fa3d2 100644 --- a/libwvdrmengine/mediacrypto/src/WVCryptoPlugin.cpp +++ b/libwvdrmengine/mediacrypto/src/WVCryptoPlugin.cpp @@ -96,6 +96,7 @@ ssize_t WVCryptoPlugin::decrypt(bool secure, const uint8_t key[KEY_ID_SIZE], // Iterate through subsamples, sending them to the CDM serially. size_t offset = 0; + size_t encrypted_offset = 0; for (size_t i = 0; i < numSubSamples; ++i) { const SubSample &subSample = subSamples[i]; @@ -110,7 +111,7 @@ ssize_t WVCryptoPlugin::decrypt(bool secure, const uint8_t key[KEY_ID_SIZE], CdmResponseType res = mCDM->Decrypt(mSessionId, false, keyId, source + offset, subSample.mNumBytesOfClearData, - ivVector, offset % 16, dest + offset); + ivVector, 0, dest + offset); if (res != wvcdm::NO_ERROR) { ALOGE("Decrypt error result in session %s during unencrypted block: %d", @@ -127,7 +128,7 @@ ssize_t WVCryptoPlugin::decrypt(bool secure, const uint8_t key[KEY_ID_SIZE], CdmResponseType res = mCDM->Decrypt(mSessionId, true, keyId, source + offset, subSample.mNumBytesOfEncryptedData, - ivVector, offset % 16, dest + offset); + ivVector, encrypted_offset % 16, dest + offset); if (res != wvcdm::NO_ERROR) { ALOGE("Decrypt error result in session %s during encrypted block: %d", @@ -136,6 +137,7 @@ ssize_t WVCryptoPlugin::decrypt(bool secure, const uint8_t key[KEY_ID_SIZE], } offset += subSample.mNumBytesOfEncryptedData; + encrypted_offset += subSample.mNumBytesOfEncryptedData; } }