Report key request type in GenerateKeyRequest

Bug: 19771299

Merged from Widevine CDM repo:
https://widevine-internal-review.googlesource.com/#/c/13830/

Change-Id: Id9b4547febcabbb73a4be5dbb2e4c63b1c3eacd3
This commit is contained in:
Kongqun Yang
2015-03-24 17:15:53 -07:00
parent 308ac24913
commit 8ea1ab7f5e
12 changed files with 108 additions and 65 deletions

View File

@@ -32,6 +32,22 @@ using namespace android;
using namespace std;
using namespace wvcdm;
namespace {
DrmPlugin::KeyRequestType ConvertFromCdmKeyRequestType(
CdmKeyRequestType keyRequestType) {
switch (keyRequestType) {
case kKeyRequestTypeInitial:
return DrmPlugin::kKeyRequestType_Initial;
case kKeyRequestTypeRenewal:
return DrmPlugin::kKeyRequestType_Renewal;
case kKeyRequestTypeRelease:
return DrmPlugin::kKeyRequestType_Release;
default:
return DrmPlugin::kKeyRequestType_Unknown;
}
}
} // namespace
WVDrmPlugin::WVDrmPlugin(WvContentDecryptionModule* cdm,
WVGenericCryptoInterface* crypto)
: mCDM(cdm), mCrypto(crypto), mCryptoSessionsMutex(), mCryptoSessions() {}
@@ -138,11 +154,6 @@ status_t WVDrmPlugin::getKeyRequest(
return android::ERROR_DRM_CANNOT_HANDLE;
}
// TODO: set *keyRequestType properly, this is
// just a stub implementation to allow the framework
// changes to build and run
*keyRequestType = kKeyRequestType_Initial;
string cdmInitDataType = initDataType.string();
// Provide backwards-compatibility for apps that pass non-EME-compatible MIME
// types.
@@ -195,13 +206,13 @@ status_t WVDrmPlugin::getKeyRequest(
}
CdmKeyMessage keyRequest;
CdmKeyRequestType cdmKeyRequestType;
string cdmDefaultUrl;
CdmResponseType res = mCDM->GenerateKeyRequest(cdmSessionId, cdmKeySetId,
cdmInitDataType,
processedInitData,
cdmLicenseType, cdmParameters,
&mPropertySet, &keyRequest,
&cdmDefaultUrl);
CdmResponseType res = mCDM->GenerateKeyRequest(
cdmSessionId, cdmKeySetId, cdmInitDataType, processedInitData,
cdmLicenseType, cdmParameters, &mPropertySet, &keyRequest,
&cdmKeyRequestType, &cdmDefaultUrl);
*keyRequestType = ConvertFromCdmKeyRequestType(cdmKeyRequestType);
if (isCdmResponseTypeSuccess(res)) {
defaultUrl.clear();