Source release v3.0.4
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();
|
||||
@@ -519,7 +541,7 @@ CdmResponseType CdmSession::StoreLicense() {
|
||||
std::string app_id;
|
||||
GetApplicationId(&app_id);
|
||||
if (!file_handle_->StoreUsageInfo(provider_session_token, key_request_,
|
||||
key_response_, app_id)) {
|
||||
key_response_, app_id, key_set_id_)) {
|
||||
LOGE("CdmSession::StoreLicense: Unable to store usage info");
|
||||
return STORE_USAGE_INFO_ERROR;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user