Merge of CLs
* Move Properties::Init into platform-specific code This enables a refactor where property initialization for CE CDM will use values provided by the application during library initialization. [ Merge of http://go/wvgerrit/14510/ ] * Add Properties::AlwaysUseKeySetIds(). When true, all sessions will have key set IDs and all session IDs will be the same as the corresponding key set ID. This will help the new CDM interface stick more closely to the EME APIs, in which there are no such things as key set IDs and sessions only have a single, random ID used for both streaming and offline. [ Merge of http://go/wvgerrit/14521/ ] * Reserve key set IDs in memory, rather than on the file system. This makes it more efficient to use key set IDs for non-offline sessions. [ Merge of http://go/wvgerrit/14535/ ] Change-Id: I765c3519619b17cc3c4ef95b1a6b125f479ee1d0
This commit is contained in:
@@ -46,8 +46,6 @@ const char* kSecurityLevelPathCompatibilityExclusionList[] = {
|
||||
size_t kSecurityLevelPathCompatibilityExclusionListSize =
|
||||
sizeof(kSecurityLevelPathCompatibilityExclusionList) /
|
||||
sizeof(*kSecurityLevelPathCompatibilityExclusionList);
|
||||
// Some platforms cannot store a truly blank file, so we use a W for Widevine.
|
||||
const char kBlankFileData[] = "W";
|
||||
|
||||
bool Hash(const std::string& data, std::string* hash) {
|
||||
if (!hash) return false;
|
||||
@@ -64,6 +62,9 @@ bool Hash(const std::string& data, std::string* hash) {
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
// static
|
||||
std::set<std::string> DeviceFiles::reserved_license_ids_;
|
||||
|
||||
DeviceFiles::DeviceFiles()
|
||||
: file_(NULL),
|
||||
security_level_(kSecurityLevelUninitialized),
|
||||
@@ -228,6 +229,7 @@ bool DeviceFiles::StoreLicense(
|
||||
std::string serialized_file;
|
||||
file.SerializeToString(&serialized_file);
|
||||
|
||||
reserved_license_ids_.erase(key_set_id);
|
||||
return StoreFileWithHash(key_set_id + kLicenseFileNameExt, serialized_file);
|
||||
}
|
||||
|
||||
@@ -331,6 +333,8 @@ bool DeviceFiles::LicenseExists(const std::string& key_set_id) {
|
||||
return false;
|
||||
}
|
||||
return FileExists(key_set_id + kLicenseFileNameExt);
|
||||
return reserved_license_ids_.count(key_set_id) ||
|
||||
FileExists(key_set_id + kLicenseFileNameExt);
|
||||
}
|
||||
|
||||
bool DeviceFiles::ReserveLicenseId(const std::string& key_set_id) {
|
||||
@@ -338,7 +342,8 @@ bool DeviceFiles::ReserveLicenseId(const std::string& key_set_id) {
|
||||
LOGW("DeviceFiles::ReserveLicenseId: not initialized");
|
||||
return false;
|
||||
}
|
||||
return StoreFileRaw(key_set_id + kLicenseFileNameExt, kBlankFileData);
|
||||
reserved_license_ids_.insert(key_set_id);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DeviceFiles::StoreUsageInfo(const std::string& provider_session_token,
|
||||
@@ -804,8 +809,6 @@ std::string DeviceFiles::GetUsageInfoFileName(const std::string& app_id) {
|
||||
return kUsageInfoFileNamePrefix + hash + kUsageInfoFileNameExt;
|
||||
}
|
||||
|
||||
std::string DeviceFiles::GetBlankFileData() { return kBlankFileData; }
|
||||
|
||||
std::string DeviceFiles::GetFileNameSafeHash(const std::string& input) {
|
||||
std::vector<uint8_t> hash(MD5_DIGEST_LENGTH);
|
||||
const unsigned char* input_ptr =
|
||||
|
||||
Reference in New Issue
Block a user