Add Max-Res Decode Engine to CDM Core

(This is a port of http://go/wvgerrit/11555 from the Widevine CDM
repo.)

Bug: 16034599
Change-Id: Ie69afac7d89e27623adbc84d2baebccf1d1ba6e6
This commit is contained in:
John "Juce" Bruce
2014-10-30 23:38:48 -07:00
parent b3650a9661
commit 12821d5968
14 changed files with 748 additions and 99 deletions

View File

@@ -6,6 +6,7 @@
#include <string>
#include "license_protocol.pb.h"
#include "max_res_engine.h"
#include "wv_cdm_types.h"
namespace wvcdm {
@@ -13,13 +14,14 @@ namespace wvcdm {
using video_widevine_server::sdk::LicenseIdentification;
class Clock;
class CryptoSession;
class PolicyEngineTest;
// This acts as an oracle that basically says "Yes(true) you may still decrypt
// or no(false) you may not decrypt this data anymore."
class PolicyEngine {
public:
PolicyEngine();
explicit PolicyEngine(CryptoSession* crypto_session);
virtual ~PolicyEngine();
// The value returned should be taken as a hint rather than an absolute
@@ -27,7 +29,7 @@ class PolicyEngine {
// UpdateLicense/OnTimerEvent/BeginDecryption and may be out of sync
// depending on the amount of time elapsed. The current decryption
// status is not calculated to avoid overhead in the decryption path.
virtual bool can_decrypt() { return can_decrypt_; }
virtual bool CanDecrypt(const KeyId& key_id);
// OnTimerEvent is called when a timer fires. It notifies the Policy Engine
// that the timer has fired and that it should check whether any events have
@@ -118,11 +120,12 @@ class PolicyEngine {
int64_t next_renewal_time_;
int64_t policy_max_duration_seconds_;
MaxResEngine max_res_engine_;
Clock* clock_;
// For testing
friend class PolicyEngineTest;
PolicyEngine(Clock* clock);
PolicyEngine(CryptoSession* crypto_session, Clock* clock);
CORE_DISALLOW_COPY_AND_ASSIGN(PolicyEngine);
};