Add ATSC support - part 1

[ Merge of http://go/wvgerrit/100864 and http://go/ag/10704773 ]

ATSC 3.0 allows for licenses to be downloaded OTA and are tied to
a DRM certificate that may be shared across apps. The provisioning
process for ATSC may happen at the factory or during an OS update.

This contrasts from the regular OTT model, which requires that
provisioning and license download have an uplink as well as a
downlink connection.

This adds support for the ATSC mode property. ATSC mode can only be
set (or unset) before sessions are opened. Once the CDM identifier is
set/sealed, requests to modify the ATSC mode will be rejected.

If one needs to open sessions with both ATSC mode and regular (non-ATSC)
mode, separate MediaDrm objects will need to be created. The default
mode is to not use ATSC.

Enable ATSC mode by calling
  mediaDrm.setPropertyString("atscMode", "enable")

Disable ATSC mode by calling
  mediaDrm.setPropertyString("atscMode", "disable")

Provisioning and unprovisioning requests for ATSC will be rejected as
certificates will be retrieved by the ATSC service.

Bug: 139730600
Test: WV unit/integration test, GtsMediaTestCases
Change-Id: I142f286c711fe007ff42125c3c8cdc6450b6ea36
This commit is contained in:
Rahul Frias
2020-03-16 18:18:46 -07:00
parent aa5fc5afd0
commit bbe9f6afc4
18 changed files with 256 additions and 10 deletions

View File

@@ -24,6 +24,7 @@ class CdmClientPropertySet {
virtual uint32_t session_sharing_id() const = 0;
virtual void set_session_sharing_id(uint32_t id) = 0;
virtual const std::string& app_id() const = 0;
virtual bool use_atsc_mode() const = 0;
};
} // namespace wvcdm

View File

@@ -45,6 +45,7 @@ static const uint32_t OEM_CRYPTO_API_VERSION_SUPPORTS_RESOURCE_RATING_TIER = 15;
static const char SESSION_ID_PREFIX[] = "sid";
static const char KEY_SET_ID_PREFIX[] = "ksid";
static const char KEY_SYSTEM[] = "com.widevine";
static const char ATSC_APP_PACKAGE_NAME[] = "org.atsc";
// define query keys, values here
static const std::string QUERY_KEY_LICENSE_TYPE =

View File

@@ -408,10 +408,12 @@ enum CdmResponseType {
CANNOT_DECRYPT_ZERO_SUBSAMPLES = 354,
SAMPLE_AND_SUBSAMPLE_SIZE_MISMATCH = 355,
INVALID_IV_SIZE = 356,
LOAD_USAGE_ENTRY_INVALID_SESSION = 357,
PROVISIONING_NOT_ALLOWED_FOR_ATSC = 357,
// 357 was |LOAD_USAGE_ENTRY_INVALID_SESSION| in early R builds
MOVE_USAGE_ENTRY_DESTINATION_IN_USE = 358,
SHRINK_USAGE_TABLE_HEADER_ENTRY_IN_USE = 359,
LICENSE_USAGE_ENTRY_MISSING = 360,
LOAD_USAGE_ENTRY_INVALID_SESSION = 361,
// Don't forget to add new values to
// * core/test/test_printers.cpp.
// * android/include/mapErrors-inl.h

View File

@@ -62,6 +62,7 @@ class UsagePropertySet : public CdmClientPropertySet {
void set_session_sharing_id(uint32_t /* id */) override {}
const std::string& app_id() const override { return app_id_; }
void set_app_id(const std::string& appId) { app_id_ = appId; }
bool use_atsc_mode() const override { return false; }
private:
std::string app_id_;

View File

@@ -38,6 +38,8 @@ class MockCdmClientPropertySet : public CdmClientPropertySet {
MOCK_CONST_METHOD0(is_session_sharing_enabled, bool());
MOCK_CONST_METHOD0(session_sharing_id, uint32_t());
MOCK_METHOD1(set_session_sharing_id, void(uint32_t));
MOCK_CONST_METHOD0(use_atsc_mode, bool());
MOCK_METHOD1(set_use_atsc_mode, void(bool));
MOCK_CONST_METHOD0(app_id, const std::string&());
};

View File

@@ -15,8 +15,8 @@ namespace wvcdm {
// Google license servers.
class LicenseRequest {
public:
LicenseRequest() {};
~LicenseRequest() {};
LicenseRequest() {}
~LicenseRequest() {}
void GetDrmMessage(const std::string& response, std::string& drm_msg);

View File

@@ -79,6 +79,7 @@ class StubCdmClientPropertySet : public CdmClientPropertySet {
}
uint32_t session_sharing_id() const override { return session_sharing_id_; }
virtual bool use_atsc_mode() const { return false; }
void set_session_sharing_id(uint32_t id) override {
session_sharing_id_ = id;

View File

@@ -935,6 +935,9 @@ void PrintTo(const enum CdmResponseType& value, ::std::ostream* os) {
case WEBM_INIT_DATA_UNAVAILABLE:
*os << "WEBM_INIT_DATA_UNAVAILABLE";
break;
case PROVISIONING_NOT_ALLOWED_FOR_ATSC:
*os << "PROVISIONING_NOT_ALLOWED_FOR_ATSC";
break;
default:
*os << "Unknown CdmResponseType";
break;