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

@@ -367,6 +367,10 @@ struct WVDrmPlugin : public IDrmPlugin, IDrmPluginListener,
const std::string& origin() const { return mCdmIdentifier.origin; }
bool set_origin(const std::string& id);
// Indicates whether the builder can still be modified. This returns false
// until a call to getCdmIdentifier.
bool is_sealed() { return mIsIdentifierSealed; }
private:
WVDRM_DISALLOW_COPY_AND_ASSIGN(CdmIdentifierBuilder);
@@ -384,6 +388,13 @@ struct WVDrmPlugin : public IDrmPlugin, IDrmPluginListener,
// outside this class should use getDeviceUniqueId() to get the
// application-safe device-unique ID.
Status getOemcryptoDeviceId(std::string* id);
// The unique identifier is meant to ensure that two clients with the
// same spoid, origin and app package name still get different cdm engine
// instances. This is a stepping stone to simplifying the implementation.
// Note that we do not have a lock or mutex around this object. We assume
// that locking is handled external to this object.
uint32_t getNextUniqueId();
} mCdmIdentifierBuilder;
sp<wvcdm::WvContentDecryptionModule> const mCDM;