Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry pick PR #1402: [media] Create CDM with valid WidevineStorage #1466

Merged
merged 2 commits into from
Nov 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions starboard/shared/widevine/drm_system_widevine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,10 @@ SbDrmStatus CdmStatusToSbDrmStatus(const wv3cdm::Status status) {
SB_ONCE_INITIALIZE_FUNCTION(Mutex, GetInitializationMutex);

void EnsureWidevineCdmIsInitialized(const std::string& company_name,
const std::string& model_name) {
const std::string& model_name,
WidevineStorage* storage) {
SB_DCHECK(storage) << "|storage| is NULL.";
static WidevineClock s_clock;
static WidevineStorage s_storage(GetWidevineStoragePath());
static WidevineTimer s_timer;
static bool s_initialized = false;

Expand Down Expand Up @@ -190,7 +191,7 @@ void EnsureWidevineCdmIsInitialized(const std::string& company_name,
log_level = wv3cdm::kSilent;
#endif // COBALT_BUILD_TYPE_GOLD
wv3cdm::Status status =
wv3cdm::initialize(wv3cdm::kNoSecureOutput, client_info, &s_storage,
wv3cdm::initialize(wv3cdm::kNoSecureOutput, client_info, storage,
&s_clock, &s_timer, log_level);
SB_DCHECK(status == wv3cdm::kSuccess);
s_initialized = true;
Expand Down Expand Up @@ -235,9 +236,10 @@ DrmSystemWidevine::DrmSystemWidevine(
}
#endif // !defined(COBALT_BUILD_TYPE_GOLD)

EnsureWidevineCdmIsInitialized(company_name, model_name);
static WidevineStorage s_storage(GetWidevineStoragePath());
EnsureWidevineCdmIsInitialized(company_name, model_name, &s_storage);
const bool kEnablePrivacyMode = true;
cdm_.reset(wv3cdm::create(this, NULL, kEnablePrivacyMode));
cdm_.reset(wv3cdm::create(this, &s_storage, kEnablePrivacyMode));
SB_DCHECK(cdm_);

// Get cert scope and pass to widevine.
Expand Down