Add additional error conditions to MediaDrm

Merge of http://go/wvgerrit/70163

New codes are being added to handle resource
contention, lost session state, frame size too
large and insufficient security level for
decryption. Also cleans up inconsistent use of
tamper detected error where invalid state error
should have been used.

bug:111504510
bug:111505796
test: cts and gts media tests, widevine integration tests

Change-Id: I96ee441717d32ccbcabaa85c8f6a0013055ce16e
This commit is contained in:
Jeff Tinker
2018-12-12 08:52:28 -08:00
parent 40bd0d5209
commit a00b50095c
16 changed files with 390 additions and 217 deletions

View File

@@ -10,12 +10,11 @@
#include "media/stagefright/MediaErrors.h"
#include "utils/Errors.h"
#include "wv_cdm_types.h"
#include "HidlTypes.h"
#include "WVErrors.h"
namespace wvdrm {
using ::android::hardware::drm::V1_0::Status;
static Status mapCdmResponseType(wvcdm::CdmResponseType res) {
switch (res) {
case wvcdm::KEY_ADDED:
@@ -321,6 +320,26 @@ static Status mapCdmResponseType(wvcdm::CdmResponseType res) {
return Status::ERROR_DRM_UNKNOWN;
}
static Status_V1_2 mapCdmResponseType_1_2(
wvcdm::CdmResponseType res) {
switch(res) {
case wvcdm::KEY_PROHIBITED_FOR_SECURITY_LEVEL:
return Status_V1_2::ERROR_DRM_INSUFFICIENT_SECURITY;
// TODO(b/120572706): define in CDM
// case wvcdm::xxx:
// return Status_V1_2::ERROR_DRM_FRAME_TOO_LARGE;
// case wvcdm::xxx:
// return Status_V1_2::ERROR_DRM_SESSION_LOST_STATE;
// case wvcdm::xxx:
// return Status_V1_2::ERROR_DRM_RESOURCE_CONTENTION;
default:
return static_cast<Status_V1_2>(mapCdmResponseType(res));
}
}
static inline bool isCdmResponseTypeSuccess(wvcdm::CdmResponseType res) {
return mapCdmResponseType(res) == Status::OK;
}