This merges the following changes from the Widevine CDM repository: bef58bc Add new error codes Adds new error codes to OEMCryptoCENC.h and rearranges it to more closely match the documentation. 5fcfbca Handle OEMCrypto_ERROR_INSUFFICIENT_RESOURCES on Decrypt Changes the CDM to support the new errors from the previous change. d59c09d Report Insufficient Crypto Resources Changes the DrmEngine to support the new errors from the previous change. 1085a21 Respond to Too Many Keys or Sessions Errors Allows errors around having too many keys or sessions to result in a unique error in the CDM. Bug: 9695816 Change-Id: I826bc655109fa57e4f75de7158d7f392053666b1
52 lines
1.6 KiB
C++
52 lines
1.6 KiB
C++
//
|
|
// Copyright 2013 Google Inc. All Rights Reserved.
|
|
//
|
|
|
|
#ifndef WV_MAP_ERRORS_H_
|
|
#define WV_MAP_ERRORS_H_
|
|
|
|
#include "media/stagefright/MediaErrors.h"
|
|
#include "utils/Errors.h"
|
|
#include "wv_cdm_types.h"
|
|
#include "WVErrors.h"
|
|
|
|
namespace wvdrm {
|
|
|
|
static android::status_t mapCdmResponseType(wvcdm::CdmResponseType res) {
|
|
switch (res) {
|
|
case wvcdm::NO_ERROR:
|
|
case wvcdm::KEY_ADDED:
|
|
case wvcdm::KEY_MESSAGE:
|
|
case wvcdm::KEY_CANCELED:
|
|
// KEY_ADDED, KEY_MESSAGE, and KEY_CANCELLED are all alternative
|
|
// success messages for certain CDM methods instead of NO_ERROR.
|
|
return android::OK;
|
|
case wvcdm::NEED_KEY:
|
|
return android::ERROR_DRM_NO_LICENSE;
|
|
case wvcdm::NEED_PROVISIONING:
|
|
return android::ERROR_DRM_NOT_PROVISIONED;
|
|
case wvcdm::DEVICE_REVOKED:
|
|
return android::ERROR_DRM_DEVICE_REVOKED;
|
|
case wvcdm::INSUFFICIENT_CRYPTO_RESOURCES:
|
|
return android::ERROR_DRM_RESOURCE_BUSY;
|
|
case wvcdm::KEY_ERROR:
|
|
// KEY_ERROR is used by the CDM to mean just about any kind of error, not
|
|
// just license errors, so it is mapped to the generic response.
|
|
return kErrorCDMGeneric;
|
|
case wvcdm::UNKNOWN_ERROR:
|
|
return android::ERROR_DRM_UNKNOWN;
|
|
}
|
|
|
|
// Return here instead of as a default case so that the compiler will warn
|
|
// us if we forget to include an enum member in the switch statement.
|
|
return android::UNKNOWN_ERROR;
|
|
}
|
|
|
|
static inline bool isCdmResponseTypeSuccess(wvcdm::CdmResponseType res) {
|
|
return mapCdmResponseType(res) == android::OK;
|
|
}
|
|
|
|
} // namespace wvdrm
|
|
|
|
#endif // WV_MAP_ERRORS_H_
|