Merge "Add arguments to Widevine lshal debug hook."

This commit is contained in:
Edwin Wong
2020-07-20 22:24:53 +00:00
committed by Android (Google) Code Review
7 changed files with 569 additions and 15 deletions

View File

@@ -149,6 +149,13 @@ class WvContentDecryptionModule : public android::RefBase, public TimerHandler {
virtual CdmResponseType GetMetrics(const CdmIdentifier& identifier,
drm_metrics::WvCdmMetrics* metrics);
// Fill the metrics parameter with the metrics data for all the CdmEngine
// associated with the given CdmIdentifiers. If there are no CdmEngine
// instances, this will return an error.
virtual CdmResponseType GetMetrics(
std::vector<drm_metrics::WvCdmMetrics>* metrics,
bool* full_list_returned);
// Closes the CdmEngine and sessions associated with the given CdmIdentifier.
virtual CdmResponseType CloseCdm(const CdmIdentifier& identifier);

View File

@@ -378,6 +378,32 @@ bool WvContentDecryptionModule::IsValidServiceCertificate(
return cert.has_certificate();
}
CdmResponseType WvContentDecryptionModule::GetMetrics(
std::vector<drm_metrics::WvCdmMetrics>* metrics, bool* full_list_returned) {
if (!metrics || !full_list_returned) {
return PARAMETER_NULL;
}
for (auto& key_value_pair : cdms_) {
drm_metrics::WvCdmMetrics metric;
CdmResponseType status = GetMetrics(key_value_pair.first, &metric);
if (status == NO_ERROR) {
metrics->push_back(metric);
} else {
LOGD("GetMetrics call failed: cdm identifier=%u, error=%d",
key_value_pair.first.unique_id, status);
}
}
// With no streaming activities, cdms_ size would be zero,
// treat it as a non full list in that case.
*full_list_returned = !cdms_.empty() && metrics->size() == cdms_.size();
// We only return error if no metrics is returned when cdms_ is not empty.
// - metrics && cdms_ sizes can both be zero, returns NO_ERROR
// - metrics size <= cdms_, returns NO_ERROR
// - metrics is empty, but cdms_ is not, returns UNKNOWN_ERROR
return (metrics->empty() && !cdms_.empty()) ? UNKNOWN_ERROR : NO_ERROR;
}
CdmResponseType WvContentDecryptionModule::GetMetrics(
const CdmIdentifier& identifier, drm_metrics::WvCdmMetrics* metrics) {
if (!metrics) {