Core CDM: Remove usage info as a run-time type.
[ Merge of http://go/wvgerrit/159221 ] This CL modifies how usage entry info is tracked internally by the CDM at run time. It removes the different "storage types" that entries represent (license or usage info), and instead it contains only the information associated with license types. The presences of a key-set-id allows the UsageTableHeader to determine if the entry slot is currently being used, or if it can be treated as unoccupied. By removing this different type, it completely prevents the CDM and its tests from using "usage-info" type entries. This required significant updates to the UsageTableHeader tests. Additionally, several of the variable names within the usage table have been simplified and shortened to reflect their new meanings. Bug: 242289743 Test: run_x86_64_tests and usage_table_header_unittest Change-Id: I939e479779425550a17a3c9e6c6d1bc6885e493e
This commit is contained in:
@@ -1049,9 +1049,9 @@ bool CdmSession::VerifyOfflineUsageEntry() {
|
||||
return false;
|
||||
}
|
||||
const CdmUsageEntryInfo& usage_entry_info =
|
||||
usage_table_header_->usage_entry_info().at(usage_entry_number_);
|
||||
if (usage_entry_info.storage_type != kStorageLicense ||
|
||||
usage_entry_info.key_set_id != key_set_id_) {
|
||||
usage_table_header_->entry_info_list().at(usage_entry_number_);
|
||||
if (usage_entry_info.IsEmpty() ||
|
||||
usage_entry_info.key_set_id() != key_set_id_) {
|
||||
LOGD("License usage entry does not match");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1014,7 +1014,7 @@ bool DeviceFiles::DeleteHlsAttributes(const std::string& key_set_id) {
|
||||
|
||||
bool DeviceFiles::StoreUsageTableInfo(
|
||||
const CdmUsageTableHeader& usage_table_header,
|
||||
const std::vector<CdmUsageEntryInfo>& usage_entry_info) {
|
||||
const std::vector<CdmUsageEntryInfo>& usage_entry_info_list) {
|
||||
RETURN_FALSE_IF_UNINITIALIZED();
|
||||
using video_widevine_client::sdk::UsageTableInfo;
|
||||
using UsageEntryInfo = UsageTableInfo::UsageEntryInfo;
|
||||
@@ -1028,14 +1028,14 @@ bool DeviceFiles::StoreUsageTableInfo(
|
||||
UsageTableInfo* stored_table_info = file.mutable_usage_table_info();
|
||||
stored_table_info->set_usage_table_header(usage_table_header);
|
||||
|
||||
for (const auto& entry_info : usage_entry_info) {
|
||||
for (const auto& entry_info : usage_entry_info_list) {
|
||||
UsageEntryInfo* stored_info = stored_table_info->add_usage_entry_info();
|
||||
if (entry_info.storage_type == kStorageLicense) {
|
||||
if (entry_info.HasKeySetId()) {
|
||||
stored_info->set_storage(UsageEntryInfo::LICENSE);
|
||||
stored_info->set_key_set_id(entry_info.key_set_id);
|
||||
stored_info->set_last_use_time(entry_info.last_use_time);
|
||||
stored_info->set_key_set_id(entry_info.key_set_id());
|
||||
stored_info->set_last_use_time(entry_info.last_use_time());
|
||||
stored_info->set_offline_license_expiry_time(
|
||||
entry_info.offline_license_expiry_time);
|
||||
entry_info.license_expiry_time());
|
||||
} else {
|
||||
stored_info->set_storage(UsageEntryInfo::UNKNOWN);
|
||||
}
|
||||
@@ -1051,11 +1051,11 @@ bool DeviceFiles::StoreUsageTableInfo(
|
||||
|
||||
bool DeviceFiles::RetrieveUsageTableInfo(
|
||||
CdmUsageTableHeader* usage_table_header,
|
||||
std::vector<CdmUsageEntryInfo>* usage_entry_info, bool* lru_upgrade,
|
||||
std::vector<CdmUsageEntryInfo>* usage_entry_info_list, bool* lru_upgrade,
|
||||
bool* has_usage_info_entries) {
|
||||
RETURN_FALSE_IF_UNINITIALIZED();
|
||||
RETURN_FALSE_IF_NULL(usage_table_header);
|
||||
RETURN_FALSE_IF_NULL(usage_entry_info);
|
||||
RETURN_FALSE_IF_NULL(usage_entry_info_list);
|
||||
RETURN_FALSE_IF_NULL(lru_upgrade);
|
||||
RETURN_FALSE_IF_NULL(has_usage_info_entries);
|
||||
using video_widevine_client::sdk::UsageTableInfo;
|
||||
@@ -1091,22 +1091,22 @@ bool DeviceFiles::RetrieveUsageTableInfo(
|
||||
*lru_upgrade = !stored_table_info.use_lru();
|
||||
*has_usage_info_entries = false;
|
||||
*usage_table_header = stored_table_info.usage_table_header();
|
||||
usage_entry_info->reserve(stored_table_info.usage_entry_info_size());
|
||||
usage_entry_info_list->clear();
|
||||
usage_entry_info_list->reserve(stored_table_info.usage_entry_info_size());
|
||||
|
||||
for (const auto& stored_entry_info : stored_table_info.usage_entry_info()) {
|
||||
CdmUsageEntryInfo entry_info;
|
||||
entry_info.Clear();
|
||||
if (stored_entry_info.storage() == UsageEntryInfo::LICENSE) {
|
||||
entry_info.storage_type = kStorageLicense;
|
||||
entry_info.key_set_id = stored_entry_info.key_set_id();
|
||||
entry_info.last_use_time = stored_entry_info.last_use_time();
|
||||
entry_info.offline_license_expiry_time =
|
||||
stored_entry_info.offline_license_expiry_time();
|
||||
entry_info.SetKeySetId(stored_entry_info.key_set_id());
|
||||
entry_info.SetLastUseTime(stored_entry_info.last_use_time());
|
||||
entry_info.SetLicenseExpiryTime(
|
||||
stored_entry_info.offline_license_expiry_time());
|
||||
} else if (stored_entry_info.storage() == UsageEntryInfo::USAGE_INFO) {
|
||||
// USAGE_INFO are deprecated, do not retrieve this entries.
|
||||
*has_usage_info_entries = true;
|
||||
}
|
||||
usage_entry_info->emplace_back(std::move(entry_info));
|
||||
usage_entry_info_list->emplace_back(std::move(entry_info));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -95,19 +95,6 @@ const char* CdmOfflineLicenseStateToString(
|
||||
return UnknownValueRep(license_state);
|
||||
}
|
||||
|
||||
const char* CdmUsageEntryStorageTypeToString(CdmUsageEntryStorageType type) {
|
||||
switch (type) {
|
||||
case kStorageLicense:
|
||||
return "License";
|
||||
case kStorageUsageInfo:
|
||||
return "UsageInfo";
|
||||
case kStorageTypeUnknown:
|
||||
// Special value used to indicate an empty entry.
|
||||
return "None";
|
||||
}
|
||||
return UnknownValueRep(type);
|
||||
}
|
||||
|
||||
const char* RequestedSecurityLevelToString(
|
||||
RequestedSecurityLevel security_level) {
|
||||
switch (security_level) {
|
||||
|
||||
Reference in New Issue
Block a user