Fixes for query information and usage reporting
* The Usage APIs return usage reports from either L1 or L3 (if available). * Correction to when usage reports are saved. In addition to other events they are now saved when keys are loaded, usage reports are released and soon after first decryption and periodically (60 seconds) after that, if decryption takes place. * Usage reports now get deleted on an unprovision request. * Policy timer is now started when offline licenses are restored. * Usage session is now released, when a usage response is received. * Usage tests ahev been enabled. * Added CDM extended duration (integration) tests to test usage reporting and querying. These need to be run manually as they take a while (currently half an hour). b/15592374 [ Merge of https://widevine-internal-review.googlesource.com/#/c/10800 from the Widevine CDM repo ] Change-Id: Ia817e03ebbe880e08ba7b4a235ecb82b3ff35fbf
This commit is contained in:
@@ -17,6 +17,7 @@ namespace wvcdm {
|
||||
|
||||
class CdmClientPropertySet;
|
||||
class CryptoEngine;
|
||||
class UsagePropertySet;
|
||||
class WvCdmEventListener;
|
||||
|
||||
typedef std::map<CdmSessionId, CdmSession*> CdmSessionMap;
|
||||
@@ -117,6 +118,8 @@ class CdmEngine {
|
||||
private:
|
||||
// private methods
|
||||
bool ValidateKeySystem(const CdmKeySystem& key_system);
|
||||
CdmResponseType GetUsageInfo(SecurityLevel requested_security_level,
|
||||
CdmUsageInfo* usage_info);
|
||||
|
||||
void OnKeyReleaseEvent(const CdmKeySetId& key_set_id);
|
||||
|
||||
@@ -132,7 +135,8 @@ class CdmEngine {
|
||||
|
||||
// usage related variables
|
||||
scoped_ptr<CdmSession> usage_session_;
|
||||
int64_t last_usage_information_update_time;
|
||||
scoped_ptr<UsagePropertySet> usage_property_set_;
|
||||
int64_t last_usage_information_update_time_;
|
||||
|
||||
CORE_DISALLOW_COPY_AND_ASSIGN(CdmEngine);
|
||||
};
|
||||
|
||||
@@ -88,8 +88,10 @@ class CdmSession {
|
||||
|
||||
virtual CdmResponseType UpdateUsageInformation();
|
||||
|
||||
virtual bool is_initial_usage_update() { return is_initial_usage_update_; }
|
||||
virtual bool is_usage_update_needed() { return is_usage_update_needed_; }
|
||||
virtual void reset_is_usage_update_needed() {
|
||||
virtual void reset_usage_flags() {
|
||||
is_initial_usage_update_ = false;
|
||||
is_usage_update_needed_ = false;
|
||||
}
|
||||
|
||||
@@ -117,10 +119,13 @@ class CdmSession {
|
||||
bool license_received_;
|
||||
bool is_offline_;
|
||||
bool is_release_;
|
||||
bool is_usage_update_needed_;
|
||||
CdmSecurityLevel security_level_;
|
||||
|
||||
// decryption and usage flags
|
||||
bool is_initial_decryption_;
|
||||
bool has_decrypted_recently_;
|
||||
CdmSecurityLevel security_level_;
|
||||
bool is_initial_usage_update_;
|
||||
bool is_usage_update_needed_;
|
||||
|
||||
// information useful for offline and usage scenarios
|
||||
CdmKeyMessage key_request_;
|
||||
|
||||
@@ -84,6 +84,7 @@ class CryptoSession {
|
||||
// Media data path
|
||||
virtual CdmResponseType Decrypt(const CdmDecryptionParameters& parameters);
|
||||
|
||||
// Usage related methods
|
||||
virtual bool UsageInformationSupport(bool* has_support);
|
||||
virtual CdmResponseType UpdateUsageInformation();
|
||||
virtual CdmResponseType DeactivateUsageInformation(
|
||||
@@ -95,6 +96,7 @@ class CryptoSession {
|
||||
virtual CdmResponseType ReleaseUsageInformation(
|
||||
const std::string& message, const std::string& signature,
|
||||
const std::string& provider_session_token);
|
||||
virtual CdmResponseType DeleteAllUsageReports();
|
||||
|
||||
virtual bool GetHdcpCapabilities(OemCryptoHdcpVersion* current,
|
||||
OemCryptoHdcpVersion* max);
|
||||
|
||||
@@ -97,7 +97,7 @@ class DeviceFiles {
|
||||
FRIEND_TEST(DeviceFilesUsageInfoTest, Store);
|
||||
FRIEND_TEST(WvCdmRequestLicenseTest, UnprovisionTest);
|
||||
FRIEND_TEST(WvCdmRequestLicenseTest, ForceL3Test);
|
||||
FRIEND_TEST(WvCdmUsageInfoTest, DISABLED_UsageInfo);
|
||||
FRIEND_TEST(WvCdmUsageInfoTest, UsageInfo);
|
||||
#endif
|
||||
|
||||
scoped_ptr<File> file_;
|
||||
|
||||
@@ -47,8 +47,8 @@ class CdmLicense {
|
||||
const CdmKeyResponse& license_renewal_response,
|
||||
int64_t playback_start_time,
|
||||
int64_t last_playback_time);
|
||||
virtual bool RestoreUsageLicense(const CdmKeyMessage& license_request,
|
||||
const CdmKeyResponse& license_response);
|
||||
virtual bool RestoreLicenseForRelease(const CdmKeyMessage& license_request,
|
||||
const CdmKeyResponse& license_response);
|
||||
virtual bool HasInitData() { return !stored_init_data_.empty(); }
|
||||
virtual bool IsKeyLoaded(const KeyId& key_id);
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ std::string HexEncode(const uint8_t* bytes, unsigned size);
|
||||
std::string IntToString(int value);
|
||||
std::string UintToString(unsigned int value);
|
||||
int64_t htonll64(int64_t x);
|
||||
int64_t ntohll64(int64_t x);
|
||||
|
||||
}; // namespace wvcdm
|
||||
|
||||
|
||||
Reference in New Issue
Block a user