Add decrypt hash support
[ Merge of http://go/wvgerrit/68083 ] Add ability to query decrypt hash support, set a hash computed over a frame and retrieve the last error at a later point. Bug: 34080802 Test: WV unit/integration tests. New tests added to cdm_engine_test, libwvdrmdrmplugin_hidl_test and request_license_test. Change-Id: I7548c8798c873a6af3e1cfc0df57c117e1e474a6
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include "metrics.pb.h"
|
||||
#include "properties.h"
|
||||
#include "service_certificate.h"
|
||||
#include "string_conversions.h"
|
||||
#include "wv_cdm_constants.h"
|
||||
#include "wv_cdm_event_listener.h"
|
||||
|
||||
@@ -456,6 +457,44 @@ CdmResponseType WvContentDecryptionModule::CloseCdm(
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
CdmResponseType WvContentDecryptionModule::SetDecryptHash(
|
||||
const std::string& hash_data, CdmSessionId* id) {
|
||||
if (id == nullptr) {
|
||||
LOGE("WVContentDecryptionModule::SetDecryptHash: |id| was not provided");
|
||||
return PARAMETER_NULL;
|
||||
}
|
||||
|
||||
uint32_t frame_number;
|
||||
std::string hash;
|
||||
CdmResponseType res =
|
||||
CdmEngine::ParseDecryptHashString(hash_data, id, &frame_number, &hash);
|
||||
|
||||
if (res != NO_ERROR) return res;
|
||||
|
||||
CdmEngine* cdm_engine = GetCdmForSessionId(*id);
|
||||
|
||||
if (!cdm_engine) {
|
||||
LOGE("WVContentDecryptionModule::SetDecryptHash: Unable to find CdmEngine");
|
||||
return SESSION_NOT_FOUND_20;
|
||||
}
|
||||
|
||||
res = cdm_engine->SetDecryptHash(*id, frame_number, hash);
|
||||
return res;
|
||||
}
|
||||
|
||||
CdmResponseType WvContentDecryptionModule::GetDecryptHashError(
|
||||
const CdmSessionId& session_id,
|
||||
std::string* hash_error_string) {
|
||||
CdmEngine* cdm_engine = GetCdmForSessionId(session_id);
|
||||
|
||||
if (!cdm_engine) {
|
||||
LOGE("WVContentDecryptionModule::GetDecryptHashError: Unable to find "
|
||||
"CdmEngine");
|
||||
return SESSION_NOT_FOUND_20;
|
||||
}
|
||||
return cdm_engine->GetDecryptHashError(session_id, hash_error_string);
|
||||
}
|
||||
|
||||
void WvContentDecryptionModule::EnablePolicyTimer() {
|
||||
std::unique_lock<std::mutex> auto_lock(policy_timer_lock_);
|
||||
if (!policy_timer_.IsRunning())
|
||||
|
||||
Reference in New Issue
Block a user