From 70926c8b3ef5ed3333e80a3ac2657b97b6ce253d Mon Sep 17 00:00:00 2001 From: m0_54007497 Date: Wed, 20 Aug 2025 17:18:53 +0800 Subject: [PATCH 1/2] new debug Signed-off-by: m0_54007497 --- frameworks/js/drm_napi/native_module_ohos_drm.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/frameworks/js/drm_napi/native_module_ohos_drm.cpp b/frameworks/js/drm_napi/native_module_ohos_drm.cpp index 56ad0d7..20bd565 100644 --- a/frameworks/js/drm_napi/native_module_ohos_drm.cpp +++ b/frameworks/js/drm_napi/native_module_ohos_drm.cpp @@ -27,6 +27,7 @@ static napi_value Export(napi_env env, napi_value exports) MediaKeySessionNapi::Init(env, exports); MediaKeySystemNapi::Init(env, exports); return exports; + } /* -- Gitee From 51e13b3a64088ce0f27af71bd6c21155e4835fa9 Mon Sep 17 00:00:00 2001 From: m0_54007497 Date: Wed, 20 Aug 2025 20:32:00 +0800 Subject: [PATCH 2/2] debug Signed-off-by: m0_54007497 --- .../c/drm_capi/native_mediakeysession.cpp | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/frameworks/c/drm_capi/native_mediakeysession.cpp b/frameworks/c/drm_capi/native_mediakeysession.cpp index 240d52e..c5383c6 100644 --- a/frameworks/c/drm_capi/native_mediakeysession.cpp +++ b/frameworks/c/drm_capi/native_mediakeysession.cpp @@ -191,8 +191,38 @@ Drm_ErrCode OH_MediaKeySession_ClearMediaKeys(MediaKeySession *mediaKeySessoin) Drm_ErrCode OH_MediaKeySession_GenerateOfflineReleaseRequest(MediaKeySession *mediaKeySessoin, uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen, uint8_t *releaseRequest, int32_t *releaseRequestLen) -{ +{ + if (mediaKeySession == nullptr) { + DRM_INFO_LOG("mediaKeySession is nullptr1"); + return DRM_ERR_INVALID_VAL; +} + +if (offlineMediaKeyId == nullptr) { + DRM_INFO_LOG("offlineMediaKeyId is nullptr1"); + return DRM_ERR_INVALID_VAL; +} + +if (offlineMediaKeyIdLen == nullptr) { + DRM_INFO_LOG("offlineMediaKeyIdLen is nullptr1"); + return DRM_ERR_INVALID_VAL; +} + +if (*offlineMediaKeyIdLen <= 0 || *offlineMediaKeyIdLen > MAX_OFFLINE_MEDIA_KEY_ID_LEN) { + DRM_INFO_LOG("offlineMediaKeyIdLen is invalid: %d", *offlineMediaKeyIdLen); + return DRM_ERR_INVALID_VAL; +} + +if (releaseRequest == nullptr) { + DRM_INFO_LOG("releaseRequest is nullptr1"); + return DRM_ERR_INVALID_VAL; +} + +if (releaseRequestLen == nullptr) { + DRM_INFO_LOG("releaseRequestLen is nullptr1"); + return DRM_ERR_INVALID_VAL; +} DRM_INFO_LOG("OH_MediaKeySession_GenerateOfflineReleaseRequest enter"); + DRM_CHECK_AND_RETURN_RET_LOG(((mediaKeySessoin != nullptr) && (offlineMediaKeyId != nullptr) && (offlineMediaKeyIdLen > 0) && (offlineMediaKeyIdLen <= MAX_OFFLINE_MEDIA_KEY_ID_LEN) && (releaseRequest != nullptr) && (releaseRequestLen != nullptr)), -- Gitee