Merge "Add mutex to CdmEngine for use of cert_provisioning_." into rvc-dev
This commit is contained in:
@@ -390,6 +390,8 @@ class CdmEngine {
|
||||
CdmSessionMap session_map_;
|
||||
CdmReleaseKeySetMap release_key_sets_;
|
||||
std::unique_ptr<CertificateProvisioning> cert_provisioning_;
|
||||
// Lock must be acquired before using |cert_provisioning_|.
|
||||
std::mutex cert_provisioning_mutex_;
|
||||
FileSystem* file_system_;
|
||||
Clock clock_;
|
||||
std::string spoid_;
|
||||
|
||||
@@ -73,7 +73,6 @@ class UsagePropertySet : public CdmClientPropertySet {
|
||||
CdmEngine::CdmEngine(FileSystem* file_system,
|
||||
std::shared_ptr<metrics::EngineMetrics> metrics)
|
||||
: metrics_(metrics),
|
||||
cert_provisioning_(),
|
||||
file_system_(file_system),
|
||||
spoid_(EMPTY_SPOID),
|
||||
usage_session_(),
|
||||
@@ -902,6 +901,7 @@ CdmResponseType CdmEngine::GetProvisioningRequest(
|
||||
}
|
||||
|
||||
// TODO(b/141705730): Remove usage entries on provisioning.
|
||||
std::unique_lock<std::mutex> cert_lock(cert_provisioning_mutex_);
|
||||
if (!cert_provisioning_) {
|
||||
cert_provisioning_.reset(
|
||||
new CertificateProvisioning(metrics_->GetCryptoMetrics()));
|
||||
@@ -929,6 +929,7 @@ CdmResponseType CdmEngine::HandleProvisioningResponse(
|
||||
SecurityLevel requested_security_level, std::string* cert,
|
||||
std::string* wrapped_key) {
|
||||
LOGI("Handling provision request");
|
||||
std::unique_lock<std::mutex> cert_lock(cert_provisioning_mutex_);
|
||||
if (response.empty()) {
|
||||
LOGE("Empty provisioning response");
|
||||
cert_provisioning_.reset();
|
||||
|
||||
@@ -973,11 +973,10 @@ CdmResponseType CdmSession::RemoveKeys() {
|
||||
}
|
||||
|
||||
CdmResponseType CdmSession::RemoveLicense() {
|
||||
CdmResponseType sts = NO_ERROR;
|
||||
if (is_offline_ || has_provider_session_token()) {
|
||||
if (usage_support_type_ == kUsageEntrySupport &&
|
||||
has_provider_session_token()) {
|
||||
sts = DeleteUsageEntry(usage_entry_number_);
|
||||
DeleteUsageEntry(usage_entry_number_);
|
||||
}
|
||||
DeleteLicenseFile();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user