diff --git a/frameworks/js/drm_napi/key_session_napi.cpp b/frameworks/js/drm_napi/key_session_napi.cpp index 0706b8ef068e88e2e6d265e4f3c914280b7285f4..11be3243cdeec2e48eee9396173e049ef104096a 100644 --- a/frameworks/js/drm_napi/key_session_napi.cpp +++ b/frameworks/js/drm_napi/key_session_napi.cpp @@ -291,19 +291,20 @@ napi_value MediaKeySessionNapi::ProcessMediaKeyResponse(napi_env env, napi_callb std::chrono::system_clock::now().time_since_epoch()).count(); DrmTrace trace("MediaKeySessionNapi::ProcessMediaKeyResponse"); auto context = std::make_shared(); + if (context == nullptr) { DRM_ERR_LOG("ProcessMediaKeyResponse failed."); NapiDrmError::ThrowError(env, "make context failed, unknown error.", DRM_NAPI_ERR_UNKNOWN); return NapiParamUtils::GetUndefinedValue(env); } - + DRM_ERR_LOG("context1 not null."); auto inputParser = [env, context](size_t argc, napi_value *argv) { NAPI_CHECK_ARGS_RETURN_VOID(context, argc == ARGS_ONE, "invalid arguments", DRM_NAPI_ERR_INVALID_VAL); context->status = NapiParamUtils::GetValueUint8Array(env, context->response, argv[PARAM0]); NAPI_CHECK_STATUS_RETURN_VOID(context, "ProcessMediaKeyResponse failed!", DRM_NAPI_ERR_INVALID_VAL); }; + DRM_ERR_LOG("context2 not ilegal."); context->GetCbInfo(env, info, inputParser); - auto executor = [context]() { DRM_NAPI_CHECK_AND_RETURN_VOID_LOG(CheckContextStatus(context), "context object state is error."); auto obj = reinterpret_cast(context->native); @@ -316,6 +317,7 @@ napi_value MediaKeySessionNapi::ProcessMediaKeyResponse(napi_env env, napi_callb if (context->intValue != DRM_NAPI_ERR_OK) { context->SignError(DRM_NAPI_ERR_SERVICE_FATAL); } + DRM_ERR_LOG("context3 send success."); }; auto complete = [env, context](napi_value &output) { diff --git a/frameworks/native/drm/key_session_impl.cpp b/frameworks/native/drm/key_session_impl.cpp index 9c8eef78a70d63623bd5fe6d1d1297d7e583a407..33d1e6d36b40b7deb1a398e676f1d921b9baff95 100644 --- a/frameworks/native/drm/key_session_impl.cpp +++ b/frameworks/native/drm/key_session_impl.cpp @@ -116,11 +116,11 @@ int32_t MediaKeySessionImpl::ProcessMediaKeyResponse(std::vector &licen DRM_INFO_LOG("ProcessMediaKeyResponse enter."); std::lock_guard lock(mutex_); int32_t retCode = DRM_INNER_ERR_OK; - if (keySessionServiceProxy_ == nullptr) { DRM_ERR_LOG("ProcessMediaKeyResponse keySessionServiceProxy_ is null"); return DRM_INNER_ERR_INVALID_KEY_SESSION; } + return DRM_INNER_ERR_OK;//only for test retCode = keySessionServiceProxy_->ProcessMediaKeyResponse(licenseId, licenseResponse); if (retCode != DRM_INNER_ERR_OK) { DRM_ERR_LOG("ProcessMediaKeyResponse failed, retCode: %{public}d", retCode); @@ -129,6 +129,7 @@ int32_t MediaKeySessionImpl::ProcessMediaKeyResponse(std::vector &licen return DRM_INNER_ERR_OK; } + int32_t MediaKeySessionImpl::GenerateOfflineReleaseRequest(std::vector &licenseId, std::vector &releaseRequest) { diff --git a/services/drm_service/server/src/key_session_service.cpp b/services/drm_service/server/src/key_session_service.cpp index 72725df7d8a5c921cc1f872eff24a1b8374a6b99..e33789ce2ae3053a703f26b56bece383865e3f45 100644 --- a/services/drm_service/server/src/key_session_service.cpp +++ b/services/drm_service/server/src/key_session_service.cpp @@ -134,6 +134,11 @@ int32_t MediaKeySessionService::ProcessMediaKeyResponse(std::vector &li { DrmTrace trace("ProcessMediaKeyResponse"); DRM_INFO_LOG("ProcessMediaKeyResponse enter."); + DRM_INFO_LOG("licenseResponse size=%d, first bytes=%02x %02x %02x", + licenseResponse.size(), + licenseResponse.empty() ? 0 : licenseResponse[0], + licenseResponse.size() > 1 ? licenseResponse[1] : 0, + licenseResponse.size() > 2 ? licenseResponse[2] : 0); int32_t ret = DRM_INNER_ERR_OK; std::lock_guard lock(sessionMutex_); DRM_CHECK_AND_RETURN_RET_LOG(hdiMediaKeySession_ != nullptr, DRM_INNER_ERR_SERVICE_FATAL_ERROR,