Create unique cdm engines per WVDrmPlugin instance

This change creates a unique id in the cdm identifier in order to force
a one-to-one mapping between WVDrmPlugin instances and CDM Engines. This
change simplifies some assumptions. This includes ensuring that the
metrics for a given MediaDrm instance map to a given CdmEngine instance.

This change contains the original change go/ag/3819203 and a fix to the
deadlock that was seen on Marlin and Taimen.

Bug: 73724453
Test: Updated unit tests. GTS test pass. Shaka Player, Netflix and Google Play test.
Change-Id: Ib208204a1b794df9f306fa11d13a8bb6cd6889f7
This commit is contained in:
Adam Stone
2018-03-29 12:28:57 -07:00
parent 1a25cbdad6
commit 5c71603e8c
11 changed files with 354 additions and 207 deletions

View File

@@ -394,7 +394,7 @@ status_t WVDrmPlugin::provideProvisionResponse(
}
CdmProvisioningResponse cdmResponse(response.begin(), response.end());
if (cdmResponse == kSpecialUnprovisionResponse) {
if (mCdmIdentifier == kDefaultCdmIdentifier) {
if (mCdmIdentifier.IsEquivalentToDefault()) {
return kErrorNoOriginSpecified;
}
return unprovision(mCdmIdentifier);
@@ -542,9 +542,14 @@ status_t WVDrmPlugin::getPropertyByteArray(const String8& name,
} else if (name == "serviceCertificate") {
value = ToVector(mPropertySet.service_certificate());
} else if (name == "metrics") {
std::string metrics_value;
mCDM->GetSerializedMetrics(&metrics_value);
value = ToVector(metrics_value);
std::string serialized_metrics;
drm_metrics::WvCdmMetrics metrics;
mCDM->GetMetrics(mCdmIdentifier, &metrics);
if (!metrics.SerializeToString(&serialized_metrics)) {
return android::ERROR_DRM_UNKNOWN;
} else {
value = ToVector(serialized_metrics);
}
} else {
ALOGE("App requested unknown byte array property %s", name.string());
return android::ERROR_DRM_CANNOT_HANDLE;