Include client_version in license requests.

"client_version" is an optional, information field in the protocol for
license requests.  It was requested that the CE CDM includes this
information in the license request.  It does not hurt to include this
information in the Android license requests too.

If, for some reason, the client cannot provide this information, the
request is still sent out as normal.  No reason to prevent an otherwise
valid license request due to a missing optional field.

Note: This field is directly in the LicenseRequest message and not the
ClientIdentification message.

Bug: 253013596
Test: license_unittest
Change-Id: I9dc342301fffdc174122088af39406150b34562e
This commit is contained in:
Alex Dale
2023-10-25 16:58:39 -07:00
committed by Robert Shih
parent a4158f16ad
commit 151a0e1a76
2 changed files with 13 additions and 4 deletions

View File

@@ -1026,13 +1026,20 @@ CdmResponseType CdmLicense::PrepareClientId(
license_request->mutable_encrypted_client_id();
status = service_certificate_.EncryptClientId(crypto_session_, client_id,
encrypted_client_id);
if (NO_ERROR == status) {
license_request->clear_client_id();
} else {
if (status != NO_ERROR) {
LOGE("Failed to encrypt client ID: status = %s",
status.ToString().c_str());
license_request->clear_encrypted_client_id();
}
return status;
}
license_request->clear_client_id();
}
std::string client_version;
if (Properties::GetWVCdmVersion(&client_version)) {
license_request->set_client_version(std::move(client_version));
}
return CdmResponseType(NO_ERROR);
}

View File

@@ -427,6 +427,7 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidation) {
EXPECT_EQ(kLicenseStartTime, license_request.request_time());
EXPECT_EQ(video_widevine::VERSION_2_1, license_request.protocol_version());
EXPECT_EQ(kNonce, license_request.key_control_nonce());
EXPECT_FALSE(license_request.client_version().empty());
}
TEST_F(CdmLicenseTest, PrepareKeyRequestValidationV15) {
@@ -561,6 +562,7 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidationV15) {
EXPECT_EQ(kLicenseStartTime, license_request.request_time());
EXPECT_EQ(video_widevine::VERSION_2_1, license_request.protocol_version());
EXPECT_EQ(kNonce, license_request.key_control_nonce());
EXPECT_FALSE(license_request.client_version().empty());
}
struct EntitledKeyVariant {