Fix incorrect error returns from DRM plugin

Includes Widevine library release 4.5.0.4946

Bug 5223230

Change-Id: Ie68d3a821c22b3b0b9b720560fee6768838f1a08
This commit is contained in:
Jeffrey Tinker
2011-10-17 21:48:16 -07:00
parent bcfe38dcb0
commit 8cecb914c3
8 changed files with 11 additions and 3 deletions

View File

@@ -63,7 +63,7 @@ class WVDRMPluginAPI {
virtual bool RemoveRights(std::string &path) = 0;
virtual bool RemoveAllRights() = 0;
virtual bool Prepare(char *data, int len) = 0;
virtual bool Operate(char *in, char *out, int len, char *iv) = 0;
virtual int Operate(char *in, char *out, int len, char *iv) = 0;
enum EventType {
EventType_AcquireDrmInfoFailed,

View File

@@ -854,10 +854,18 @@ status_t WVMDrmPlugin::onDecrypt(int uniqueId, DecryptHandle* decryptHandle, int
(*decBuffer)->length = encBuffer->length;
if (!mDrmPluginImpl->Operate(encBuffer->data, (*decBuffer)->data, encBuffer->length, iv)) {
int status;
status = mDrmPluginImpl->Operate(encBuffer->data, (*decBuffer)->data, encBuffer->length, iv);
if (status != WVDRMPluginAPI::RIGHTS_VALID) {
(*decBuffer)->length = 0;
usleep(1000000); // prevent spinning
if (status == WVDRMPluginAPI::RIGHTS_NOT_ACQUIRED) {
return DRM_ERROR_NO_LICENSE;
} else if (status == WVDRMPluginAPI::RIGHTS_EXPIRED) {
return DRM_ERROR_LICENSE_EXPIRED;
} else if (status == WVDRMPluginAPI::RIGHTS_INVALID) {
return DRM_ERROR_DECRYPT;
}
}
return DRM_NO_ERROR;