Fix for b/4132041 Widevine DRM plugin getConstraints not returning error
Change-Id: I07f02aabb4b68287eb7978abb5d106c86f2790b6
This commit is contained in:
Binary file not shown.
@@ -331,36 +331,39 @@ DrmConstraints* WVMDrmPlugin::onGetConstraints(int uniqueId, const String8* path
|
|||||||
bool denyHD;
|
bool denyHD;
|
||||||
|
|
||||||
std::string assetPath(path->string());
|
std::string assetPath(path->string());
|
||||||
if (!mDrmPluginImpl->GetConstraints(assetPath, &timeSincePlayback, &timeRemaining,
|
bool isValid = mDrmPluginImpl->GetConstraints(assetPath, &timeSincePlayback, &timeRemaining,
|
||||||
&licenseDuration, lastError, allowOffline,
|
&licenseDuration, lastError, allowOffline,
|
||||||
allowStreaming, denyHD))
|
allowStreaming, denyHD);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
DrmConstraints* drmConstraints = new DrmConstraints();
|
DrmConstraints* drmConstraints = new DrmConstraints();
|
||||||
char charValue[16]; // max uint32 = 0xffffffff + terminating char
|
|
||||||
|
|
||||||
memset(charValue, 0, 16);
|
String8 key = String8("WVLastErrorKey");
|
||||||
sprintf(charValue, "%lu", (unsigned long)timeSincePlayback);
|
|
||||||
drmConstraints->put(&(DrmConstraints::LICENSE_START_TIME), charValue);
|
|
||||||
|
|
||||||
memset(charValue, 0, 16);
|
|
||||||
sprintf(charValue, "%lu", (unsigned long)timeRemaining);
|
|
||||||
drmConstraints->put(&(DrmConstraints::LICENSE_EXPIRY_TIME), charValue);
|
|
||||||
|
|
||||||
memset(charValue, 0, 16);
|
|
||||||
sprintf(charValue, "%lu", (unsigned long)licenseDuration);
|
|
||||||
drmConstraints->put(&(DrmConstraints::LICENSE_AVAILABLE_TIME), charValue);
|
|
||||||
|
|
||||||
String8 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());
|
drmConstraints->put(&key, lastError.c_str());
|
||||||
|
|
||||||
|
if (isValid) {
|
||||||
|
char charValue[16]; // max uint32 = 0xffffffff + terminating char
|
||||||
|
|
||||||
|
memset(charValue, 0, 16);
|
||||||
|
sprintf(charValue, "%lu", (unsigned long)timeSincePlayback);
|
||||||
|
drmConstraints->put(&(DrmConstraints::LICENSE_START_TIME), charValue);
|
||||||
|
|
||||||
|
memset(charValue, 0, 16);
|
||||||
|
sprintf(charValue, "%lu", (unsigned long)timeRemaining);
|
||||||
|
drmConstraints->put(&(DrmConstraints::LICENSE_EXPIRY_TIME), charValue);
|
||||||
|
|
||||||
|
memset(charValue, 0, 16);
|
||||||
|
sprintf(charValue, "%lu", (unsigned long)licenseDuration);
|
||||||
|
drmConstraints->put(&(DrmConstraints::LICENSE_AVAILABLE_TIME), charValue);
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
return drmConstraints;
|
return drmConstraints;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user