51 lines
2.0 KiB
C++
51 lines
2.0 KiB
C++
// Copyright 2020 Google LLC. All Rights Reserved. This file and proprietary
|
|
// source code may only be used and distributed under the Widevine License
|
|
// Agreement.
|
|
#ifndef WVCDM_CORE_POLICY_TIMERS_V16_H_
|
|
#define WVCDM_CORE_POLICY_TIMERS_V16_H_
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include "license_protocol.pb.h"
|
|
#include "policy_timers.h"
|
|
#include "wv_cdm_types.h"
|
|
#include "wv_class_utils.h"
|
|
|
|
namespace wvcdm {
|
|
// OEMCrypto v16 and core messages introduced changes to how duration values
|
|
// and clocks should be evaluated. This class provides backward compatibility
|
|
// for licenses that do not include a core message. Durations are handled
|
|
// in the same way as in earlier releases.
|
|
//
|
|
// Backward compatibility may be needed if
|
|
// * OEMCrypto has not been upgraded to v16
|
|
// * Licenses were persisted before the device was upgraded to v16
|
|
// * License service does not yet support core messages
|
|
class PolicyTimersV16 : public PolicyTimers {
|
|
public:
|
|
PolicyTimersV16() = default;
|
|
WVCDM_DISALLOW_COPY_AND_MOVE(PolicyTimersV16);
|
|
|
|
~PolicyTimersV16() override {}
|
|
|
|
// UpdateLicense is used in handling a license response, a renewal response,
|
|
// or when restoring or releasing a persistent license.
|
|
// In a renewal the response may only contain policy fields that have
|
|
// changed. In this case an exact copy is not what we want to happen.
|
|
// |renewal_start_time_| is set to the time mentioned in the renewal
|
|
// response.
|
|
// UpdateLicense will return false if |license_start_time| is not
|
|
// present or playback is not allowed due to policy or timer duration
|
|
// expiration.
|
|
bool UpdateLicense(int64_t current_time,
|
|
const video_widevine::License& license) override;
|
|
|
|
// Call this on first decrypt to set the start of playback.
|
|
void BeginDecryption(int64_t current_time) override;
|
|
|
|
// Renewal related methods
|
|
bool HasRenewalDelayExpired(int64_t current_time) override;
|
|
}; // class PolicyTimersV16
|
|
} // namespace wvcdm
|
|
#endif // WVCDM_CORE_POLICY_TIMERS_V16_H_
|