Fix for b/4132041 Widevine DRM plugin getConstraints not returning error

Change-Id: I07f02aabb4b68287eb7978abb5d106c86f2790b6
This commit is contained in:
Jeffrey Tinker
2011-03-18 13:29:28 -07:00
parent dac957507c
commit 6bed7bfe90
3 changed files with 29 additions and 26 deletions

View File

@@ -331,12 +331,16 @@ DrmConstraints* WVMDrmPlugin::onGetConstraints(int uniqueId, const String8* path
bool denyHD;
std::string assetPath(path->string());
if (!mDrmPluginImpl->GetConstraints(assetPath, &timeSincePlayback, &timeRemaining,
bool isValid = mDrmPluginImpl->GetConstraints(assetPath, &timeSincePlayback, &timeRemaining,
&licenseDuration, lastError, allowOffline,
allowStreaming, denyHD))
return NULL;
allowStreaming, denyHD);
DrmConstraints* drmConstraints = new DrmConstraints();
String8 key = String8("WVLastErrorKey");
drmConstraints->put(&key, lastError.c_str());
if (isValid) {
char charValue[16]; // max uint32 = 0xffffffff + terminating char
memset(charValue, 0, 16);
@@ -351,16 +355,15 @@ DrmConstraints* WVMDrmPlugin::onGetConstraints(int uniqueId, const String8* path
sprintf(charValue, "%lu", (unsigned long)licenseDuration);
drmConstraints->put(&(DrmConstraints::LICENSE_AVAILABLE_TIME), charValue);
String8 key = String8("WVLicenseTypeKey");
key = String8("WVLicenseTypeKey");
sprintf(charValue, "%u", (allowStreaming ? 1 : 0) | (allowOffline ? 2 : 0));
drmConstraints->put(&key, charValue);
key = String8("WVLicensedResolutionKey");
sprintf(charValue, "%u", (denyHD ? 1 : 2));
drmConstraints->put(&key, charValue);
}
key = String8("WVLastErrorKey");
drmConstraints->put(&key, lastError.c_str());
return drmConstraints;
}