Report key status change

Also modified PolicyEngine::CanDecrypt to use the new Keys_status_.

Bug: 19771431

Merged from Widevine CDM repo:
https://widevine-internal-review.googlesource.com/#/c/13904/

Change-Id: If7fb7fa45ecf9ff4e65278cda00ad7230b57f50b
This commit is contained in:
Kongqun Yang
2015-03-30 19:10:56 -07:00
parent bdb82e04f8
commit 4621028434
10 changed files with 315 additions and 26 deletions

View File

@@ -3,6 +3,7 @@
#ifndef WVCDM_CORE_POLICY_ENGINE_H_
#define WVCDM_CORE_POLICY_ENGINE_H_
#include <map>
#include <string>
#include "license_protocol.pb.h"
@@ -59,6 +60,8 @@ class PolicyEngine {
// Used for notifying the Policy Engine of resolution changes
virtual void NotifyResolution(uint32_t width, uint32_t height);
virtual void NotifySessionExpiration();
virtual CdmResponseType Query(CdmQueryMap* key_info);
virtual const LicenseIdentification& license_id() { return license_id_; }
@@ -105,15 +108,19 @@ class PolicyEngine {
void UpdateRenewalRequest(int64_t current_time);
// Notifies updates in keys information and fire OnKeysChange event if
// key changes.
void NotifyKeysChange(CdmKeyStatus new_status);
// Notifies updates in expiry time and fire OnExpirationUpdate event if
// expiry time changes.
void NotifyExpirationUpdate();
// These setters are for testing only. Takes ownership of the pointers.
void set_clock(Clock* clock);
void set_max_res_engine(MaxResEngine* max_res_engine);
LicenseState license_state_;
bool can_decrypt_;
// This is the current policy information for this license. This gets updated
// as license renewals occur.
@@ -142,7 +149,10 @@ class PolicyEngine {
CdmSessionId session_id_;
WvCdmEventListener* event_listener_;
MaxResEngine max_res_engine_;
scoped_ptr<MaxResEngine> max_res_engine_;
std::map<KeyId, CdmKeyStatus> keys_status_;
scoped_ptr<Clock> clock_;
CORE_DISALLOW_COPY_AND_ASSIGN(PolicyEngine);