Merge "Search for keys in shared sessions only when content is encrypted" into klp-dev
This commit is contained in:
@@ -119,11 +119,12 @@ CdmResponseType WvContentDecryptionModule::Decrypt(
|
||||
const CdmSessionId& session_id,
|
||||
const CdmDecryptionParameters& parameters) {
|
||||
CdmSessionId id = session_id;
|
||||
if (Properties::GetSessionSharingId(session_id) != 0) {
|
||||
if (parameters.is_encrypted &&
|
||||
Properties::GetSessionSharingId(session_id) != 0) {
|
||||
bool status = cdm_engine_->FindSessionForKey(*parameters.key_id, &id);
|
||||
if (!status) {
|
||||
LOGE("WvContentDecryptionModule::Decrypt: unable to find session");
|
||||
return KEY_ERROR;
|
||||
return NEED_KEY;
|
||||
}
|
||||
}
|
||||
return cdm_engine_->Decrypt(id, parameters);
|
||||
|
||||
@@ -575,12 +575,16 @@ TEST_P(WvCdmSessionSharingTest, SessionSharingTest) {
|
||||
&decrypt_buffer[0]);
|
||||
decryption_parameters.is_encrypted = data->is_encrypted;
|
||||
decryption_parameters.is_secure = data->is_secure;
|
||||
EXPECT_EQ(
|
||||
NO_ERROR == decryptor_.Decrypt(gp_session_id_2, decryption_parameters),
|
||||
enable_session_sharing);
|
||||
EXPECT_EQ(std::equal(data->decrypt_data.begin(), data->decrypt_data.end(),
|
||||
decrypt_buffer.begin()),
|
||||
enable_session_sharing);
|
||||
|
||||
if (enable_session_sharing) {
|
||||
EXPECT_EQ(NO_ERROR, decryptor_.Decrypt(gp_session_id_2,
|
||||
decryption_parameters));
|
||||
EXPECT_TRUE(std::equal(data->decrypt_data.begin(), data->decrypt_data.end(),
|
||||
decrypt_buffer.begin()));
|
||||
} else {
|
||||
EXPECT_EQ(NEED_KEY, decryptor_.Decrypt(gp_session_id_2,
|
||||
decryption_parameters));
|
||||
}
|
||||
|
||||
decryptor_.CloseSession(gp_session_id_1);
|
||||
decryptor_.CloseSession(gp_session_id_2);
|
||||
|
||||
Reference in New Issue
Block a user