Source release 17.1.0

This commit is contained in:
John "Juce" Bruce
2022-07-07 17:14:31 -07:00
parent 8c17574083
commit 694cf6fb25
2233 changed files with 272026 additions and 223371 deletions

View File

@@ -1,6 +1,6 @@
// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
// source code may only be used and distributed under the Widevine Master
// License Agreement.
// source code may only be used and distributed under the Widevine License
// Agreement.
#include "initialization_data.h"
@@ -452,7 +452,7 @@ bool InitializationData::ConstructWidevineInitData(
}
std::vector<uint8_t> json_init_data =
Base64Decode(uri.substr(pos + kBase64String.size()));
wvutil::Base64Decode(uri.substr(pos + kBase64String.size()));
if (json_init_data.size() == 0) {
LOGV("Base64 decode of json data failed");
return false;
@@ -519,7 +519,7 @@ bool InitializationData::ConstructWidevineInitData(
std::string base64_content_id(json_string, tokens[i].start,
tokens[i].end - tokens[i].start);
std::vector<uint8_t> content_id_data =
Base64Decode(base64_content_id);
wvutil::Base64Decode(base64_content_id);
content_id.assign(reinterpret_cast<const char*>(&content_id_data[0]),
content_id_data.size());
}
@@ -529,7 +529,7 @@ bool InitializationData::ConstructWidevineInitData(
if (tokens[i].type == JSMN_ARRAY) {
number_of_key_ids = tokens[i].size;
} else if (tokens[i].type == JSMN_STRING) {
std::string key_id(a2bs_hex(json_string.substr(
std::string key_id(wvutil::a2bs_hex(json_string.substr(
tokens[i].start, tokens[i].end - tokens[i].start)));
if (key_id.size() == 16) key_ids.push_back(key_id);
--number_of_key_ids;
@@ -558,13 +558,16 @@ bool InitializationData::ConstructWidevineInitData(
// Now format as Widevine init data protobuf
WidevinePsshData cenc_header;
// TODO(rfrias): The algorithm is a deprecated field, but proto changes
// have not yet been pushed to production. Set until then.
// TODO(rfrias): The algorithm and provider are deprecated fields, but proto
// changes have not yet been pushed to production. Set until then.
CORE_UTIL_IGNORE_DEPRECATED
cenc_header.set_algorithm(WidevinePsshData_Algorithm_AESCTR);
cenc_header.set_provider(provider);
CORE_UTIL_RESTORE_WARNINGS
for (size_t i = 0; i < key_ids.size(); ++i) {
cenc_header.add_key_ids(key_ids[i]);
}
cenc_header.set_provider(provider);
cenc_header.set_content_id(content_id);
if (method == kHlsMethodAes128)
cenc_header.set_protection_scheme(kFourCcCbc1);
@@ -597,7 +600,7 @@ bool InitializationData::ExtractHexAttribute(const std::string& attribute_list,
for (size_t i = 2; i < val.size(); ++i) {
if (!isxdigit(val[i])) return false;
}
*value = a2b_hex(val.substr(2, val.size() - 2));
*value = wvutil::a2b_hex(val.substr(2, val.size() - 2));
return result;
}
@@ -692,7 +695,7 @@ void InitializationData::DumpToLogs() const {
video_widevine::WidevinePsshData pssh;
if (!pssh.ParseFromString(data())) {
LOGD("InitData: invalid pssh: %s", b2a_hex(data()).c_str());
LOGD("InitData: invalid pssh: %s", wvutil::b2a_hex(data()).c_str());
return;
}
if (pssh.has_content_id()) {
@@ -700,8 +703,9 @@ void InitializationData::DumpToLogs() const {
}
if (pssh.has_protection_scheme()) {
uint32_t scheme = pssh.protection_scheme();
LOGD("InitData: Protection Scheme: %c%c%c%c", (scheme >> 24) & 0xFF,
(scheme >> 16) & 0xFF, (scheme >> 8) & 0xFF, (scheme >> 0) & 0xFF);
LOGD("InitData: Protection Scheme: %c%c%c%c",
static_cast<char>(scheme >> 24), static_cast<char>(scheme >> 16),
static_cast<char>(scheme >> 8), static_cast<char>(scheme >> 0));
}
switch (pssh.type()) {
case video_widevine::WidevinePsshData_Type_SINGLE:
@@ -725,14 +729,15 @@ void InitializationData::DumpToLogs() const {
LOGD("InitData: Key Sequence %u", pssh.key_sequence());
for (int i = 0; i < pssh.key_ids_size(); i++) {
LOGD("InitData: key_id %d: %s", i, b2a_hex(pssh.key_ids(i)).c_str());
LOGD("InitData: key_id %d: %s", i,
wvutil::b2a_hex(pssh.key_ids(i)).c_str());
}
for (int i = 0; i < pssh.entitled_keys_size(); i++) {
video_widevine::WidevinePsshData_EntitledKey key = pssh.entitled_keys(i);
LOGD("InitData: entitlement_key_id %d: %s -> %s", i,
b2a_hex(key.entitlement_key_id()).c_str(),
b2a_hex(key.key_id()).c_str());
wvutil::b2a_hex(key.entitlement_key_id()).c_str(),
wvutil::b2a_hex(key.key_id()).c_str());
}
}