Merge CE Device Changes
This is a merge of the following changes made for CE devices in the widevine share repo: http://go/wvgerrit/16211 Only load offline session if needed in GKR http://go/wvgerrit/16245 Unreserve IDs in reservation test http://go/wvgerrit/16242 Re-enable WebM tests http://go/wvgerrit/16240 Un-reserve reserved license IDs http://go/wvgerrit/16190 Add temporary session type http://go/wvgerrit/16189 Enforce license type and can_persist for storage Change-Id: I592416f66c0d1286844266c01cc9b4906c7b6b05
This commit is contained in:
@@ -37,6 +37,7 @@ CdmSession::CdmSession(CdmClientPropertySet* cdm_client_property_set,
|
||||
license_received_(false),
|
||||
is_offline_(false),
|
||||
is_release_(false),
|
||||
is_temporary_(false),
|
||||
security_level_(kSecurityLevelUninitialized),
|
||||
requested_security_level_(kLevelDefault),
|
||||
is_initial_decryption_(true),
|
||||
@@ -66,7 +67,13 @@ CdmSession::CdmSession(CdmClientPropertySet* cdm_client_property_set,
|
||||
}
|
||||
}
|
||||
|
||||
CdmSession::~CdmSession() { Properties::RemoveSessionPropertySet(session_id_); }
|
||||
CdmSession::~CdmSession() {
|
||||
if (!key_set_id_.empty()) {
|
||||
// Unreserve the license ID.
|
||||
file_handle_->UnreserveLicenseId(key_set_id_);
|
||||
}
|
||||
Properties::RemoveSessionPropertySet(session_id_);
|
||||
}
|
||||
|
||||
CdmResponseType CdmSession::Init() {
|
||||
if (session_id_.empty()) {
|
||||
@@ -184,6 +191,9 @@ CdmResponseType CdmSession::GenerateKeyRequest(
|
||||
}
|
||||
|
||||
switch (license_type) {
|
||||
case kLicenseTypeTemporary:
|
||||
is_temporary_ = true;
|
||||
break;
|
||||
case kLicenseTypeStreaming:
|
||||
is_offline_ = false;
|
||||
break;
|
||||
@@ -207,6 +217,8 @@ CdmResponseType CdmSession::GenerateKeyRequest(
|
||||
license_type = kLicenseTypeRelease;
|
||||
} else if (is_offline_) {
|
||||
license_type = kLicenseTypeOffline;
|
||||
} else if (is_temporary_) {
|
||||
license_type = kLicenseTypeTemporary;
|
||||
} else {
|
||||
license_type = kLicenseTypeStreaming;
|
||||
}
|
||||
@@ -484,12 +496,22 @@ bool CdmSession::GenerateKeySetId(CdmKeySetId* key_set_id) {
|
||||
}
|
||||
|
||||
CdmResponseType CdmSession::StoreLicense() {
|
||||
if (is_temporary_) {
|
||||
LOGE("CdmSession::StoreLicense: Session type prohibits storage.");
|
||||
return STORAGE_PROHIBITED;
|
||||
}
|
||||
|
||||
if (is_offline_) {
|
||||
if (key_set_id_.empty()) {
|
||||
LOGE("CdmSession::StoreLicense: No key set ID");
|
||||
return EMPTY_KEYSET_ID;
|
||||
}
|
||||
|
||||
if (!license_parser_->is_offline()) {
|
||||
LOGE("CdmSession::StoreLicense: License policy prohibits storage.");
|
||||
return OFFLINE_LICENSE_PROHIBITED;
|
||||
}
|
||||
|
||||
if (!StoreLicense(DeviceFiles::kLicenseStateActive)) {
|
||||
LOGE("CdmSession::StoreLicense: Unable to store license");
|
||||
CdmResponseType sts = Init();
|
||||
@@ -502,7 +524,7 @@ CdmResponseType CdmSession::StoreLicense() {
|
||||
return STORE_LICENSE_ERROR_1;
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
} // if (is_offline_)
|
||||
|
||||
std::string provider_session_token =
|
||||
license_parser_->provider_session_token();
|
||||
|
||||
Reference in New Issue
Block a user