Cas Client repo update-2.
-Parse EMM in Cas plugin -Entitlement key rotation support -Multi_content_license support
This commit is contained in:
@@ -30,6 +30,7 @@ WidevineCasSession::~WidevineCasSession() {
|
||||
CasStatus WidevineCasSession::initialize(
|
||||
std::shared_ptr<CryptoSession> crypto_session,
|
||||
CasEventListener* event_listener, uint32_t* session_id) {
|
||||
std::unique_lock<std::mutex> lock(crypto_lock_);
|
||||
if (crypto_session == nullptr || session_id == nullptr) {
|
||||
LOGE("WidevineCasSession::initialize: missing input parameters");
|
||||
return CasStatus(CasStatusCode::kInvalidParameter,
|
||||
@@ -42,9 +43,21 @@ CasStatus WidevineCasSession::initialize(
|
||||
return CasStatusCode::kNoError;
|
||||
}
|
||||
|
||||
CasStatus WidevineCasSession::resetCryptoSession(
|
||||
std::shared_ptr<CryptoSession> crypto_session) {
|
||||
std::unique_lock<std::mutex> lock(crypto_lock_);
|
||||
if (crypto_session == nullptr) {
|
||||
return CasStatus(CasStatusCode::kInvalidParameter,
|
||||
"Can not reset crypto session to null");
|
||||
}
|
||||
crypto_session_ = std::move(crypto_session);
|
||||
return crypto_session_->ReassociateEntitledKeySession(key_session_id_);
|
||||
}
|
||||
|
||||
CasStatus WidevineCasSession::processEcm(const CasEcm& ecm,
|
||||
uint8_t parental_control_age,
|
||||
const std::string& license_group_id) {
|
||||
std::unique_lock<std::mutex> lock(crypto_lock_);
|
||||
if (ecm != current_ecm_) {
|
||||
LOGD("WidevineCasSession::processEcm: received new ecm");
|
||||
std::unique_ptr<EcmParser> ecm_parser = getEcmParser(ecm);
|
||||
@@ -67,7 +80,7 @@ CasStatus WidevineCasSession::processEcm(const CasEcm& ecm,
|
||||
std::vector<uint8_t> message;
|
||||
if (!ecm_parser->fingerprinting().control().empty()) {
|
||||
message.push_back(static_cast<uint8_t>(
|
||||
SessionFingerprintingFieldType::FINGERPRINTING_CONTROL));
|
||||
SessionFingerprintingFieldType::SESSION_FINGERPRINTING_CONTROL));
|
||||
const std::string control = ecm_parser->fingerprinting().control();
|
||||
message.push_back((control.size() >> 8) & 0xff);
|
||||
message.push_back(control.size() & 0xff);
|
||||
@@ -86,8 +99,9 @@ CasStatus WidevineCasSession::processEcm(const CasEcm& ecm,
|
||||
message.clear();
|
||||
for (int i = 0; i < ecm_parser->service_blocking().device_groups_size();
|
||||
++i) {
|
||||
message.push_back(static_cast<uint8_t>(
|
||||
SessionServiceBlockingFieldType::SERVICE_BLOCKING_DEVICE_GROUP));
|
||||
message.push_back(
|
||||
static_cast<uint8_t>(SessionServiceBlockingFieldType::
|
||||
SESSION_SERVICE_BLOCKING_DEVICE_GROUP));
|
||||
const std::string device_group =
|
||||
ecm_parser->service_blocking().device_groups(i);
|
||||
message.push_back((device_group.size() >> 8) & 0xff);
|
||||
@@ -104,10 +118,12 @@ CasStatus WidevineCasSession::processEcm(const CasEcm& ecm,
|
||||
}
|
||||
}
|
||||
|
||||
entitlement_period_index_ = ecm_parser->entitlement_period_index();
|
||||
entitlement_rotation_window_left_ =
|
||||
ecm_parser->entitlement_rotation_window_left();
|
||||
|
||||
bool load_even = false;
|
||||
bool load_odd = false;
|
||||
|
||||
std::unique_lock<std::mutex> lock(lock_);
|
||||
KeySlotId keyslot_id = KeySlotId::kEvenKeySlot;
|
||||
// Temporary key slots to only have successfully loaded keys in |keys_|.
|
||||
CasKeySlotData keys;
|
||||
|
||||
Reference in New Issue
Block a user