diff --git a/services/drm_service/server/include/key_session_service.h b/services/drm_service/server/include/key_session_service.h index 23d04fa0..536c6d98 100644 --- a/services/drm_service/server/include/key_session_service.h +++ b/services/drm_service/server/include/key_session_service.h @@ -76,7 +76,7 @@ private: StatisticsInfo statisticsInfo_; std::string generationResult_; std::string mediaKeyType_; - uint32_t generationDuration_; + uint32_t generationDuration_ = 0; }; class IMediaKeySessionServiceOperatorsCallback : public virtual RefBase { diff --git a/services/drm_service/server/include/mediakeysystem_service.h b/services/drm_service/server/include/mediakeysystem_service.h index dd561809..10c706c2 100644 --- a/services/drm_service/server/include/mediakeysystem_service.h +++ b/services/drm_service/server/include/mediakeysystem_service.h @@ -88,7 +88,7 @@ private: sptr hdiKeySystem_; StatisticsInfo statisticsInfo_; std::string generationResult_; - uint32_t generationDuration_; + uint32_t generationDuration_ = 0; }; class IMediaKeySystemServiceOperatorsCallback : public virtual RefBase { diff --git a/services/drm_service/server/src/drm_host_manager.cpp b/services/drm_service/server/src/drm_host_manager.cpp index dcb70d6f..fb89cb26 100644 --- a/services/drm_service/server/src/drm_host_manager.cpp +++ b/services/drm_service/server/src/drm_host_manager.cpp @@ -311,9 +311,12 @@ int32_t DrmHostManager::GetSevices(std::string &name, bool *isSurpported) std::vector serviceName; /* The plugin service corresponding to name has been started, no need to reload, just mark the count. */ if (drmHostServieProxyMap[name] != nullptr) { - pluginCountMap[name]++; - DRM_DEBUG_LOG("DrmHostManager::GetSevices, the plugin service has been pulled up."); - return DRM_OK; + ret = drmHostServieProxyMap[name]->IsMediaKeySystemSupported(name, "", SECURE_UNKNOWN, *isSurpported); + if (ret == DRM_OK) { + pluginCountMap[name]++; + DRM_DEBUG_LOG("DrmHostManager::GetSevices, the plugin service has been pulled up."); + return DRM_OK; + } } auto servmgr = IServiceManager::Get(); ret = servmgr->ListServiceByInterfaceDesc(serviceName, "ohos.hdi.drm.v1_0.IMediaKeySystemFactory"); @@ -321,15 +324,15 @@ int32_t DrmHostManager::GetSevices(std::string &name, bool *isSurpported) DRM_ERR_LOG("ListServiceByInterfaceDesc faild, return Code:%{public}d", ret); return ret; } + /* + * If the plugin is configured with lazy loading, read the service name from the configuration file. + * If lazy loading is not configured, traverse the service bound by the interface descriptor, and obtain + * the plugin service instance through the uuid and issuport interfaces + */ + loadPluginInfo(PLUGIN_LAZYLOAD_CONFIG_PATH); if (lazyLoadPluginInfoMap.count(name) > 0) { auto it = std::find(serviceName.begin(), serviceName.end(), lazyLoadPluginInfoMap[name]); if (it == serviceName.end()) { - /* - * If the plugin is configured with lazy loading, read the service name from the configuration file. - * If lazy loading is not configured, traverse the service bound by the interface descriptor, and obtain - * the plugin service instance through the uuid and issuport interfaces - */ - loadPluginInfo(PLUGIN_LAZYLOAD_CONFIG_PATH); sptr deviceMgr = IDeviceManager::Get(); if (deviceMgr == nullptr) { DRM_ERR_LOG("DrmHostManager:GetSevices deviceMgr == nullptr"); @@ -379,7 +382,6 @@ int32_t DrmHostManager::IsMediaKeySystemSupported(std::string &name, bool *isSur ReleaseSevices(name); return DRM_SERVICE_ERROR; } - *isSurpported = true; drmHostServieProxyMap[name] = nullptr; ReleaseSevices(name); DRM_INFO_LOG("DrmHostManager::IsMediaKeySystemSupported one parameters exit, isSurpported:%{public}d.", @@ -463,7 +465,7 @@ int32_t DrmHostManager::CreateMediaKeySystem(std::string &name, sptr lock(lazyLoadPluginInfoMapMtx); int32_t ret = GetSevices(name, &isSurpported); if (ret != DRM_OK || drmHostServieProxyMap[name] == nullptr) { - DRM_INFO_LOG("DrmHostManager::CreateMediaKeySystem faild."); + DRM_ERR_LOG("DrmHostManager::CreateMediaKeySystem faild."); return ret; } drmHostDeathRecipient_ = new DrmHostDeathRecipient(); diff --git a/services/drm_service/server/src/key_session_service.cpp b/services/drm_service/server/src/key_session_service.cpp index a783168e..8a680745 100644 --- a/services/drm_service/server/src/key_session_service.cpp +++ b/services/drm_service/server/src/key_session_service.cpp @@ -126,7 +126,7 @@ int32_t MediaKeySessionService::GenerateMediaKeyRequest( ret = hdiMediaKeySession_->GenerateMediaKeyRequest(hdiMediaKeyRequestInfo, hdiMediaKeyRequest); auto timeAfter = std::chrono::system_clock::now(); auto duration = timeAfter - timeBefore; - generationDuration_ = duration.count(); + generationDuration_ = (uint32_t)duration.count(); if (ret != DRM_OK) { generationResult_ = "failed"; DRM_ERR_LOG("MediaKeySessionService::GenerateMediaKeyRequest failed."); diff --git a/services/drm_service/server/src/mediakeysystem_service.cpp b/services/drm_service/server/src/mediakeysystem_service.cpp index c85a278b..acbc4c80 100644 --- a/services/drm_service/server/src/mediakeysystem_service.cpp +++ b/services/drm_service/server/src/mediakeysystem_service.cpp @@ -118,7 +118,7 @@ int32_t MediaKeySystemService::GenerateKeySystemRequest(std::vector &re ret = hdiKeySystem_->GenerateKeySystemRequest(defaultUrl, request); auto timeAfter = std::chrono::system_clock::now(); auto duration = timeAfter - timeBefore; - generationDuration_ = duration.count(); + generationDuration_ = (uint32_t)duration.count(); if (ret != DRM_OK) { DRM_ERR_LOG("MediaKeySystemService::GenerateKeySystemRequest failed."); ReportFaultEvent(ret, "GenerateKeySystemRequest failed", "");