From 0423acde34297a907f2d3692df66e1168eb37ddf Mon Sep 17 00:00:00 2001 From: laamy Date: Sat, 19 Apr 2025 07:43:46 +0000 Subject: [PATCH] Remove redundant code Signed-off-by: laamy --- .../server_manager/media_server_manager.cpp | 72 +------------------ .../server_manager/media_server_manager.h | 2 - 2 files changed, 1 insertion(+), 73 deletions(-) diff --git a/services/services/sa_media/server_manager/media_server_manager.cpp b/services/services/sa_media/server_manager/media_server_manager.cpp index 8f81f8961..844ee0dff 100644 --- a/services/services/sa_media/server_manager/media_server_manager.cpp +++ b/services/services/sa_media/server_manager/media_server_manager.cpp @@ -119,12 +119,6 @@ int32_t MediaServerManager::Dump(int32_t fd, const std::vector & CHECK_AND_RETURN_RET_LOG(ret == NO_ERROR, OHOS::INVALID_OPERATION, "Failed to write RecorderServer information"); - dumpString += "------------------CodecServer------------------\n"; - ret = WriteInfo(fd, dumpString, dumperTbl_[StubType::AVCODEC], - argSets.find(u"codec") != argSets.end()); - CHECK_AND_RETURN_RET_LOG(ret == NO_ERROR, - OHOS::INVALID_OPERATION, "Failed to write CodecServer information"); - dumpString += "------------------AVMetaServer------------------\n"; ret = WriteInfo(fd, dumpString, dumperTbl_[StubType::AVMETADATAHELPER], false); CHECK_AND_RETURN_RET_LOG(ret == NO_ERROR, @@ -169,8 +163,6 @@ MediaServerManager::~MediaServerManager() recorderStubMap_.clear(); playerStubMap_.clear(); avMetadataHelperStubMap_.clear(); - avCodecListStubMap_.clear(); - avCodecStubMap_.clear(); recorderProfilesStubMap_.clear(); screenCaptureStubMap_.clear(); screenCaptureMonitorStubMap_.clear(); @@ -436,38 +428,6 @@ sptr MediaServerManager::GetMonitorStubObject() return object; } -void MediaServerManager::DestroyAVCodecStub(StubType type, sptr object, pid_t pid) -{ - switch (type) { - case AVCODEC: { - for (auto it = avCodecStubMap_.begin(); it != avCodecStubMap_.end(); it++) { - if (it->first == object) { - MEDIA_LOGD("destroy avcodec stub services(%{public}zu) pid(%{public}d).", - avCodecStubMap_.size(), pid); - (void)avCodecStubMap_.erase(it); - return; - } - } - MEDIA_LOGE("find avcodec object failed, pid(%{public}d).", pid); - break; - } - case AVCODECLIST: { - for (auto it = avCodecListStubMap_.begin(); it != avCodecListStubMap_.end(); it++) { - if (it->first == object) { - MEDIA_LOGD("destroy avcodeclist stub services(%{public}zu) pid(%{public}d).", - avCodecListStubMap_.size(), pid); - (void)avCodecListStubMap_.erase(it); - return; - } - } - MEDIA_LOGE("find avcodeclist object failed, pid(%{public}d).", pid); - break; - } - default: - break; - } -} - void MediaServerManager::DestroyAVTransCoderStub(StubType type, sptr object, pid_t pid) { switch (type) { @@ -615,10 +575,6 @@ void MediaServerManager::DestroyStubObject(StubType type, sptr ob case AVMETADATAHELPER: DestroyAVPlayerStub(type, object, pid); break; - case AVCODEC: - case AVCODECLIST: - DestroyAVCodecStub(type, object, pid); - break; case SCREEN_CAPTURE: case SCREEN_CAPTURE_MONITOR: case SCREEN_CAPTURE_CONTROLLER: @@ -686,31 +642,6 @@ void MediaServerManager::DestroyAVTranscoderStubForPid(pid_t pid) MEDIA_LOGD("AVTranscoder stub services(%{public}zu).", transCoderStubMap_.size()); } -void MediaServerManager::DestroyAVCodecStubForPid(pid_t pid) -{ - MEDIA_LOGD("avcodec stub services(%{public}zu) pid(%{public}d).", avCodecStubMap_.size(), pid); - for (auto itAvCodec = avCodecStubMap_.begin(); itAvCodec != avCodecStubMap_.end();) { - if (itAvCodec->second == pid) { - executor_.Commit(itAvCodec->first); - itAvCodec = avCodecStubMap_.erase(itAvCodec); - } else { - itAvCodec++; - } - } - MEDIA_LOGD("avcodec stub services(%{public}zu).", avCodecStubMap_.size()); - - MEDIA_LOGD("avcodeclist stub services(%{public}zu) pid(%{public}d).", avCodecListStubMap_.size(), pid); - for (auto itAvCodecList = avCodecListStubMap_.begin(); itAvCodecList != avCodecListStubMap_.end();) { - if (itAvCodecList->second == pid) { - executor_.Commit(itAvCodecList->first); - itAvCodecList = avCodecListStubMap_.erase(itAvCodecList); - } else { - itAvCodecList++; - } - } - MEDIA_LOGD("avcodeclist stub services(%{public}zu).", avCodecListStubMap_.size()); -} - void MediaServerManager::DestroyAVPlayerStubForPid(pid_t pid) { MEDIA_LOGD("player stub services(%{public}zu) pid(%{public}d).", playerStubMap_.size(), pid); @@ -767,7 +698,6 @@ void MediaServerManager::DestroyStubObjectForPid(pid_t pid) DestroyDumperForPid(pid); DestroyAVRecorderStubForPid(pid); DestroyAVPlayerStubForPid(pid); - DestroyAVCodecStubForPid(pid); DestroyAVTranscoderStubForPid(pid); DestroyAVScreenCaptureStubForPid(pid); MonitorServiceStub::GetInstance()->OnClientDie(pid); @@ -910,7 +840,7 @@ int32_t MediaServerManager::GetInstanceCountLocked() int32_t MediaServerManager::GetInstanceCount() { return static_cast(recorderStubMap_.size() + playerStubMap_.size() + avMetadataHelperStubMap_.size() + - avCodecListStubMap_.size() + avCodecStubMap_.size() + recorderProfilesStubMap_.size() + + recorderProfilesStubMap_.size() + screenCaptureStubMap_.size() + screenCaptureControllerStubMap_.size() + screenCaptureMonitorStubMap_.size() + transCoderStubMap_.size()); } diff --git a/services/services/sa_media/server_manager/media_server_manager.h b/services/services/sa_media/server_manager/media_server_manager.h index 3b6608e59..0d0ff3565 100644 --- a/services/services/sa_media/server_manager/media_server_manager.h +++ b/services/services/sa_media/server_manager/media_server_manager.h @@ -92,12 +92,10 @@ private: #endif sptr GetMonitorStubObject(); - void DestroyAVCodecStub(StubType type, sptr object, pid_t pid); void DestroyAVPlayerStub(StubType type, sptr object, pid_t pid); void DestroyAVRecorderStub(StubType type, sptr object, pid_t pid); void DestroyAVTransCoderStub(StubType type, sptr object, pid_t pid); void DestroyAVScreenCaptureStub(StubType type, sptr object, pid_t pid); - void DestroyAVCodecStubForPid(pid_t pid); void DestroyAVPlayerStubForPid(pid_t pid); void DestroyAVRecorderStubForPid(pid_t pid); void DestroyAVTranscoderStubForPid(pid_t pid); -- Gitee