Source release 19.5.0

This commit is contained in:
Cong Lin
2025-04-02 10:27:18 -07:00
parent 4407acee62
commit f7ec4fdeff
295 changed files with 32196 additions and 21748 deletions

View File

@@ -12,6 +12,8 @@
#include <string>
#include <vector>
#include "cdm_version.h"
// Uncomment this line when making static CDM builds. This will be edited by
// release scripts.
//#define CDM_STATIC 1
@@ -35,7 +37,7 @@
# endif // defined(_WIN32)
#endif // defined(CDM_STATIC)
namespace widevine {
namespace CDM_NAMESPACE {
class CDM_EXPORT ITimerClient {
public:
@@ -954,6 +956,6 @@ class CDM_EXPORT Cdm : public ITimerClient {
Cdm() {}
};
} // namespace widevine
} // namespace CDM_NAMESPACE
#endif // WVCDM_CDM_CDM_H_

View File

@@ -10,7 +10,7 @@
# define CDM_VERSION_MAJOR 19
#endif
#ifndef CDM_VERSION_MINOR
# define CDM_VERSION_MINOR 4
# define CDM_VERSION_MINOR 5
#endif
#ifndef CDM_VERSION_PATCH
# define CDM_VERSION_PATCH 0
@@ -22,4 +22,8 @@
CDM_VERSION_STR(CDM_VERSION_MAJOR, CDM_VERSION_MINOR, CDM_VERSION_PATCH, \
CDM_VERSION_TAG)
#ifndef CDM_NAMESPACE
# define CDM_NAMESPACE widevine
#endif // defined(CDM_NAMESPACE)
#define EME_VERSION "https://www.w3.org/TR/2017/REC-encrypted-media-20170918"

View File

@@ -7,7 +7,7 @@
#include "cdm.h"
namespace widevine {
namespace CDM_NAMESPACE {
extern Cdm::ILogger* g_logger;
}

View File

@@ -10,7 +10,7 @@
# include <gtest/gtest.h>
#endif
namespace widevine {
namespace CDM_NAMESPACE {
class PropertiesCE {
public:
@@ -30,6 +30,6 @@ class PropertiesCE {
#endif
};
} // namespace widevine
} // namespace CDM_NAMESPACE
#endif // WVCDM_CDM_PROPERTIES_CE_H_

View File

@@ -6,7 +6,9 @@
#include <string>
namespace widevine {
#include "cdm_version.h"
namespace CDM_NAMESPACE {
// This function must be implemented by partners who wish to use run-time client
// information. (i.e. Those that set 'client_info_source' to 'runtime' in their
@@ -27,6 +29,6 @@ bool ReadClientInformation(std::string* company_name, std::string* model_name,
std::string* platform, std::string* form_factor,
std::string* version);
} // namespace widevine
} // namespace CDM_NAMESPACE
#endif // WVCDM_CDM_READ_CLIENT_INFO_H_

View File

@@ -13,7 +13,7 @@
#include "cdm.h"
namespace widevine {
namespace CDM_NAMESPACE {
class StderrLogger : public Cdm::ILogger {
public:
StderrLogger() {}
@@ -23,6 +23,6 @@ class StderrLogger : public Cdm::ILogger {
std::cerr << message << std::endl << std::flush;
}
};
} // namespace widevine
} // namespace CDM_NAMESPACE
#endif // WVCDM_CDM_STDERR_LOGGER_H_

View File

@@ -36,12 +36,15 @@
#include "cdm_version.h"
#include "properties_ce.h"
// For reverse-compatibility this is always defined in the "widevine" namespace.
namespace widevine {
#ifdef HAS_EMBEDDED_CERT
extern const uint8_t kDeviceCert[];
extern const size_t kDeviceCertSize;
#endif
} // namespace widevine
namespace CDM_NAMESPACE {
using namespace wvcdm;
using namespace wvutil;
@@ -1641,11 +1644,12 @@ Cdm* Cdm::create(IEventListener* listener, IStorage* storage, bool privacy_mode,
}
}
} // namespace widevine
} // namespace CDM_NAMESPACE
// Missing symbols from core:
namespace wvutil {
using namespace CDM_NAMESPACE;
using namespace widevine;
int64_t Clock::GetCurrentTime() { return host.clock->now() / 1000; }
@@ -1725,17 +1729,18 @@ class FileCertImpl final : public File {
class FileSystem::Impl {
public:
Impl(widevine::Cdm::IStorage* storage) : storage_(storage) {
Impl(CDM_NAMESPACE::Cdm::IStorage* storage) : storage_(storage) {
assert(storage);
}
widevine::Cdm::IStorage* const storage_;
CDM_NAMESPACE::Cdm::IStorage* const storage_;
};
FileSystem::FileSystem() : impl_(new Impl(host.storage)) {}
FileSystem::FileSystem(const std::string& origin, void* extra_data)
: impl_(new Impl(reinterpret_cast<widevine::Cdm::IStorage*>(extra_data))),
: impl_(new Impl(
reinterpret_cast<CDM_NAMESPACE::Cdm::IStorage*>(extra_data))),
origin_(origin) {}
FileSystem::~FileSystem() {}

View File

@@ -30,7 +30,7 @@ void InitLogging() {}
void Log(const char* file, const char* function, int line, LogPriority level,
const char* fmt, ...) {
if (widevine::g_logger == nullptr) {
if (CDM_NAMESPACE::g_logger == nullptr) {
// If somehow we got here with no logger configured, as a last resort
// complain to stderr and bail.
fprintf(stderr, "[FATAL:%s(%d):%s] NO LOGGER CONFIGURED\n", file, line,
@@ -46,7 +46,7 @@ void Log(const char* file, const char* function, int line, LogPriority level,
FormatString(&fatal_message,
"[FATAL:%s(%d):%s] Invalid log priority level: %d", file, line,
function, level);
widevine::g_logger->log(fatal_message);
CDM_NAMESPACE::g_logger->log(fatal_message);
return;
}
@@ -62,7 +62,7 @@ void Log(const char* file, const char* function, int line, LogPriority level,
FormatString(&log_line, "[%s:%s(%d):%s] %s", severities[level], file, line,
function, formatted_message.c_str());
widevine::g_logger->log(log_line);
CDM_NAMESPACE::g_logger->log(log_line);
}
} // namespace wvutil

View File

@@ -4,6 +4,6 @@
#include "logger_global.h"
namespace widevine {
namespace CDM_NAMESPACE {
Cdm::ILogger* g_logger = nullptr;
}

View File

@@ -26,8 +26,8 @@ bool use_userspace_buffers_ = true;
bool set_provisioning_messages_to_binary_ = false;
std::string sandbox_id_;
widevine::Cdm::SecureOutputType secure_output_type_ =
widevine::Cdm::kNoSecureOutput;
CDM_NAMESPACE::Cdm::SecureOutputType secure_output_type_ =
CDM_NAMESPACE::Cdm::kNoSecureOutput;
bool client_info_is_valid_;
std::string company_name_;
@@ -64,7 +64,7 @@ void SetClientInfo() {
std::string version;
#if defined(RUNTIME_CLIENT_INFO)
if (!widevine::ReadClientInformation(
if (!CDM_NAMESPACE::ReadClientInformation(
&company_name_, &model_name_, &model_year_, &product_name_,
&device_name_, &arch_name_, &platform, &form_factor, &version)) {
LOGE("ReadClientInformation failed.");
@@ -131,7 +131,7 @@ bool GetValue(const char* source, std::string* output) {
} // namespace
namespace widevine {
namespace CDM_NAMESPACE {
// static
void PropertiesCE::SetSecureOutputType(
@@ -176,7 +176,7 @@ void PropertiesCE::SetSandboxId(const std::string& sandbox_id) {
// static
bool PropertiesCE::ClientInfoIsValid() { return client_info_is_valid_; }
} // namespace widevine
} // namespace CDM_NAMESPACE
namespace wvcdm {

View File

@@ -24,7 +24,7 @@
#include "test_base.h"
#include "test_host.h"
using namespace widevine;
using namespace CDM_NAMESPACE;
// TODO(b/195338975): document how a partner should modify this so that they can
// use a real host.

View File

@@ -46,7 +46,7 @@ using namespace testing;
using namespace wvcdm;
using namespace wvutil;
namespace widevine {
namespace CDM_NAMESPACE {
using video_widevine::LicenseError;
using video_widevine::SignedMessage;
@@ -2815,4 +2815,4 @@ TEST_F(CdmProv40IndividualizationTest, IsProvisioned) {
} // namespace
} // namespace widevine
} // namespace CDM_NAMESPACE

View File

@@ -16,7 +16,7 @@
#include "test_base.h"
#include "test_host.h"
using namespace widevine;
using namespace CDM_NAMESPACE;
TestHost* g_host = nullptr;

View File

@@ -4,7 +4,7 @@
#include "cdm_test_printers.h"
namespace widevine {
namespace CDM_NAMESPACE {
void PrintTo(const Cdm::MessageType& value, ::std::ostream* os) {
switch (value) {
@@ -115,4 +115,4 @@ void PrintTo(const Cdm::KeyStatus& value, ::std::ostream* os) {
}
}
} // namespace widevine
} // namespace CDM_NAMESPACE

View File

@@ -10,12 +10,12 @@
#include <iostream>
#include "cdm.h"
namespace widevine {
namespace CDM_NAMESPACE {
void PrintTo(const Cdm::MessageType& value, ::std::ostream* os);
void PrintTo(const Cdm::Status& value, ::std::ostream* os);
void PrintTo(const Cdm::KeyStatus& value, ::std::ostream* os);
} // namespace widevine
} // namespace CDM_NAMESPACE
#endif // WVCDM_CDM_TEST_CDM_TEST_PRINTERS_H_

View File

@@ -19,10 +19,10 @@
#include "test_base.h"
#include "test_host.h"
widevine::StderrLogger g_stderr_logger;
CDM_NAMESPACE::StderrLogger g_stderr_logger;
std::string g_sandbox_id;
namespace widevine {
namespace CDM_NAMESPACE {
namespace {
constexpr char kSandboxIdParam[] = "--sandbox_id=";
constexpr char kCertPathParam[] = "--cert_path=";
@@ -121,4 +121,4 @@ int Main(Cdm::IStorage* storage, Cdm::IClock* clock, Cdm::ITimer* timer,
return RUN_ALL_TESTS();
}
} // namespace widevine
} // namespace CDM_NAMESPACE

View File

@@ -8,13 +8,13 @@
#include <iostream>
#include "cdm.h"
namespace widevine {
namespace CDM_NAMESPACE {
// Run all CDM tests using the specified storage, clock, and timer. It parses
// standard command line arguments, sets some default test client info,
// initializes a CDM object, and then runs all the tests.
// Returns 0 on success.
int Main(Cdm::IStorage* storage, Cdm::IClock* clock, Cdm::ITimer* timer,
Cdm::ILogger* logger, int argc, char** argv);
} // namespace widevine
} // namespace CDM_NAMESPACE
#endif // WVCDM_CDM_TEST_CDM_TEST_RUNNER_H_

View File

@@ -30,9 +30,9 @@
#define WALL_NOW std::chrono::high_resolution_clock::now()
TestHost* g_host = nullptr;
widevine::StderrLogger g_stderr_logger;
CDM_NAMESPACE::StderrLogger g_stderr_logger;
namespace widevine {
namespace CDM_NAMESPACE {
namespace {
@@ -342,4 +342,4 @@ int PerfTestMain(InitFuncType init_func, CreateFuncType create) {
#endif
}
} // namespace widevine
} // namespace CDM_NAMESPACE

View File

@@ -9,7 +9,7 @@
#include "cdm.h"
namespace widevine {
namespace CDM_NAMESPACE {
using InitFuncType = Cdm::Status (*)(Cdm::SecureOutputType, Cdm::IStorage*,
Cdm::IClock*, Cdm::ITimer*, Cdm::ILogger*,
@@ -19,6 +19,6 @@ using CreateFuncType =
int PerfTestMain(InitFuncType init_func, CreateFuncType create_func);
} // namespace widevine
} // namespace CDM_NAMESPACE
#endif // WVCDM_CDM_TEST_PERF_TEST_H_

View File

@@ -16,7 +16,7 @@
#include "perf_test.h"
#include "test_host.h"
namespace widevine {
namespace CDM_NAMESPACE {
constexpr char kInitName[] =
"_ZN8widevine3Cdm10initializeENS0_16SecureOutputTypeEPNS0_8IStorageEPNS0_"
@@ -42,7 +42,7 @@ std::tuple<InitFuncType, CreateFuncType> LoadCdm(const char* path) {
return std::make_tuple(init, create);
}
} // namespace widevine
} // namespace CDM_NAMESPACE
namespace wvutil {
@@ -57,6 +57,6 @@ int main(int argc, char** argv) {
return 1;
}
auto funcs = widevine::LoadCdm(argv[1]);
return widevine::PerfTestMain(std::get<0>(funcs), std::get<1>(funcs));
auto funcs = CDM_NAMESPACE::LoadCdm(argv[1]);
return CDM_NAMESPACE::PerfTestMain(std::get<0>(funcs), std::get<1>(funcs));
}

View File

@@ -20,7 +20,8 @@
int argc = 1;
testing::InitGoogleTest(&argc, argv);
XCTAssertEqual(widevine::PerfTestMain(&widevine::Cdm::initialize, &widevine::Cdm::create), 0);
XCTAssertEqual(
CDM_NAMESPACE::PerfTestMain(&CDM_NAMESPACE::Cdm::initialize, &CDM_NAMESPACE::Cdm::create), 0);
}
@end

View File

@@ -12,7 +12,7 @@
#include "file_store.h"
#include "log.h"
using namespace widevine;
using namespace CDM_NAMESPACE;
using video_widevine_client::sdk::SavedStorage;
namespace {

View File

@@ -16,11 +16,11 @@
// This provides a host environment for running CDM tests. It implements the
// IStorage, IClock and ITimer interfaces that a host would normally implement,
// while allowing them to be manipulated by the test.
class TestHost : public widevine::Cdm::IClock,
public widevine::Cdm::ITimer,
class TestHost : public CDM_NAMESPACE::Cdm::IClock,
public CDM_NAMESPACE::Cdm::ITimer,
public wvutil::TestSleep::CallBack {
public:
class Storage : public widevine::Cdm::IStorage {
class Storage : public CDM_NAMESPACE::Cdm::IStorage {
public:
typedef std::map<std::string, std::string> StorageMap;
@@ -36,7 +36,7 @@ class TestHost : public widevine::Cdm::IClock,
void ResetFiles(const StorageMap& files) { files_ = files; };
const StorageMap& files() const { return files_; }
// widevine::Cdm::IStorage
// CDM_NAMESPACE::Cdm::IStorage
bool read(const std::string& name, std::string* data) override;
bool write(const std::string& name, const std::string& data) override;
bool exists(const std::string& name) override;
@@ -62,10 +62,10 @@ class TestHost : public widevine::Cdm::IClock,
Storage& global_storage() { return global_storage_; }
Storage& per_origin_storage() { return per_origin_storage_; }
// widevine::Cdm::IClock
// CDM_NAMESPACE::Cdm::IClock
int64_t now() override;
// widevine::Cdm::ITimer
// CDM_NAMESPACE::Cdm::ITimer
void setTimeout(int64_t delay_ms, IClient* client, void* context) override;
void cancel(IClient* client) override;
@@ -107,7 +107,7 @@ class TestHost : public widevine::Cdm::IClock,
// Owned and managed by the test runner.
extern TestHost* g_host;
extern widevine::StderrLogger g_stderr_logger;
extern CDM_NAMESPACE::StderrLogger g_stderr_logger;
extern std::string g_sandbox_id;
#endif // WVCDM_CDM_TEST_TEST_HOST_H_

View File

@@ -15,9 +15,9 @@ int main(int argc, char** argv) {
const char* bundle_version = argv[1];
fprintf(stderr, "Header: " CDM_VERSION "\n");
fprintf(stderr, "Library: %s\n", widevine::Cdm::version());
fprintf(stderr, "Library: %s\n", CDM_NAMESPACE::Cdm::version());
fprintf(stderr, "Bundle: %s\n", bundle_version);
if (strcmp(CDM_VERSION, widevine::Cdm::version()) ||
if (strcmp(CDM_VERSION, CDM_NAMESPACE::Cdm::version()) ||
strcmp(CDM_VERSION, bundle_version)) {
fprintf(stderr, "ERROR: Mismatched version\n");
return 1;

View File

@@ -17,10 +17,10 @@
- (void)testVersion {
fprintf(stderr, "Header: " CDM_VERSION "\n");
fprintf(stderr, "Library: %s\n", widevine::Cdm::version());
fprintf(stderr, "Library: %s\n", CDM_NAMESPACE::Cdm::version());
fprintf(stderr, "Bundle: " EXPECTED_CDM_VERSION "\n");
XCTAssertEqual(STR(CDM_VERSION), STR(widevine::Cdm::version()));
XCTAssertEqual(STR(CDM_VERSION), STR(CDM_NAMESPACE::Cdm::version()));
XCTAssertEqual(STR(CDM_VERSION), STR(EXPECTED_CDM_VERSION));
}