From 689616f200477703e1971f92dcbfb0ee1f78e4f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=BE=E6=98=8A=E7=82=9C?= Date: Fri, 29 Aug 2025 17:08:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A5=E5=BF=97=E6=89=93?= =?UTF-8?q?=E5=8D=B0=E9=94=99=E4=B9=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 贾昊炜 --- common/BUILD.gn | 33 ++++++------- .../task_manager/task_group/base_task_group.h | 6 --- .../task_group/delayed_task_group.h | 4 -- .../task_manager/task_group/itask_group.h | 2 - .../task_manager/task_group/task_group.h | 0 .../include}/task_manager/task_manager.h | 6 --- .../include}/task_manager/task_registry.h | 5 -- .../include}/task_manager/thread_pool.h | 9 +--- .../include}/task_manager/thread_utils.h | 0 .../include}/timer/camera_deferred_timer.h | 0 .../include}/timer/core/timer_core.h | 8 +--- .../include}/timer/steady_clock.h | 10 +--- .../include}/timer/time_broker.h | 9 ++-- .../task_group/base_task_group.cpp | 33 +++++++------ .../task_group/delayed_task_group.cpp | 19 ++++---- .../task_manager/task_group/task_group.cpp | 6 +-- .../src}/task_manager/task_manager.cpp | 47 ++++++++++--------- .../src}/task_manager/task_registry.cpp | 37 ++++++++------- .../src}/task_manager/thread_pool.cpp | 41 ++++++++-------- .../src}/task_manager/thread_utils.cpp | 12 +++-- .../src}/timer/camera_deferred_timer.cpp | 0 .../src}/timer/core/timer_core.cpp | 33 +++++++------ .../src}/timer/steady_clock.cpp | 12 ++--- .../base => common/src}/timer/time_broker.cpp | 25 +++++----- .../include => common}/utils/watch_dog.h | 31 ++++++------ dynamic_libs/BUILD.gn | 11 ----- .../camera/base/src/output/photo_output.cpp | 6 +-- .../camera_deferred_unittest/BUILD.gn | 4 -- .../src/camera_deferred_base_unittest.cpp | 2 +- .../src/deferred_utils_unittest.cpp | 2 +- services/camera_service/BUILD.gn | 1 + .../photo_asset_auxiliary_consumer.cpp | 6 +-- .../photo_asset_buffer_consumer.cpp | 4 +- .../src/dfx/camera_report_dfx_uitls.cpp | 2 +- .../src/dfx/camera_report_uitls.cpp | 2 +- .../base/command_server/command_server_impl.h | 2 +- .../include/utils/dp_utils.h | 5 +- .../src/dfx/dps_event_report.cpp | 6 +-- .../src/utils/dp_utils.cpp | 6 --- test/fuzztest/hstreamoperator_fuzzer/BUILD.gn | 4 +- test/fuzztest/timercore_fuzzer/BUILD.gn | 3 -- 41 files changed, 196 insertions(+), 258 deletions(-) rename {services/deferred_processing_service/include/base => common/include}/task_manager/task_group/base_task_group.h (94%) rename {services/deferred_processing_service/include/base => common/include}/task_manager/task_group/delayed_task_group.h (95%) rename {services/deferred_processing_service/include/base => common/include}/task_manager/task_group/itask_group.h (97%) rename {services/deferred_processing_service/include/base => common/include}/task_manager/task_group/task_group.h (100%) rename {services/deferred_processing_service/include/base => common/include}/task_manager/task_manager.h (95%) rename {services/deferred_processing_service/include/base => common/include}/task_manager/task_registry.h (94%) rename {services/deferred_processing_service/include/base => common/include}/task_manager/thread_pool.h (94%) rename {services/deferred_processing_service/include/base => common/include}/task_manager/thread_utils.h (100%) rename {services/deferred_processing_service/include/base => common/include}/timer/camera_deferred_timer.h (100%) rename {services/deferred_processing_service/include/base => common/include}/timer/core/timer_core.h (93%) rename {services/deferred_processing_service/include/base => common/include}/timer/steady_clock.h (88%) rename {services/deferred_processing_service/include/base => common/include}/timer/time_broker.h (95%) rename {services/deferred_processing_service/src/base => common/src}/task_manager/task_group/base_task_group.cpp (69%) rename {services/deferred_processing_service/src/base => common/src}/task_manager/task_group/delayed_task_group.cpp (76%) rename {services/deferred_processing_service/src/base => common/src}/task_manager/task_group/task_group.cpp (90%) rename {services/deferred_processing_service/src/base => common/src}/task_manager/task_manager.cpp (78%) rename {services/deferred_processing_service/src/base => common/src}/task_manager/task_registry.cpp (72%) rename {services/deferred_processing_service/src/base => common/src}/task_manager/thread_pool.cpp (78%) rename {services/deferred_processing_service/src/base => common/src}/task_manager/thread_utils.cpp (80%) rename {services/deferred_processing_service/src/base => common/src}/timer/camera_deferred_timer.cpp (100%) rename {services/deferred_processing_service/src/base => common/src}/timer/core/timer_core.cpp (83%) rename {services/deferred_processing_service/src/base => common/src}/timer/steady_clock.cpp (87%) rename {services/deferred_processing_service/src/base => common/src}/timer/time_broker.cpp (81%) rename {services/deferred_processing_service/include => common}/utils/watch_dog.h (73%) diff --git a/common/BUILD.gn b/common/BUILD.gn index ad283415b..e2790d3b1 100644 --- a/common/BUILD.gn +++ b/common/BUILD.gn @@ -16,6 +16,11 @@ import("../multimedia_camera_framework.gni") config("camera_utils_config") { include_dirs = [ + "include", + "include/task_manager", + "include/task_manager/task_group", + "include/timer", + "include/timer/core", "utils", "utils/av_codec/include", "utils/camera_notification/include", @@ -33,26 +38,22 @@ config("camera_utils_config") { "${multimedia_camera_framework_path}/services/camera_service/binder/base/include", "${multimedia_camera_framework_path}/services/deferred_processing_service/include/base", "${multimedia_camera_framework_path}/services/deferred_processing_service/include/utils", - "${multimedia_camera_framework_path}/services/deferred_processing_service/include/base/task_manager", - "${multimedia_camera_framework_path}/services/deferred_processing_service/include/base/task_manager/task_group", - "${multimedia_camera_framework_path}/services/deferred_processing_service/include/base/timer", - "${multimedia_camera_framework_path}/services/deferred_processing_service/include/base/timer/core", ] } + common_sources = [ - "${multimedia_camera_framework_path}/services/deferred_processing_service/src/base/task_manager/task_group/base_task_group.cpp", - "${multimedia_camera_framework_path}/services/deferred_processing_service/src/base/task_manager/task_group/delayed_task_group.cpp", - "${multimedia_camera_framework_path}/services/deferred_processing_service/src/base/task_manager/task_group/task_group.cpp", - "${multimedia_camera_framework_path}/services/deferred_processing_service/src/base/task_manager/task_manager.cpp", - "${multimedia_camera_framework_path}/services/deferred_processing_service/src/base/task_manager/task_registry.cpp", - "${multimedia_camera_framework_path}/services/deferred_processing_service/src/base/task_manager/thread_pool.cpp", - "${multimedia_camera_framework_path}/services/deferred_processing_service/src/base/task_manager/thread_utils.cpp", - "${multimedia_camera_framework_path}/services/deferred_processing_service/src/base/timer/core/timer_core.cpp", - "${multimedia_camera_framework_path}/services/deferred_processing_service/src/base/timer/steady_clock.cpp", - "${multimedia_camera_framework_path}/services/deferred_processing_service/src/base/timer/time_broker.cpp", - "${multimedia_camera_framework_path}/services/deferred_processing_service/src/base/timer/camera_deferred_timer.cpp", - "${multimedia_camera_framework_path}/services/deferred_processing_service/src/utils/dp_utils.cpp", + "src/task_manager/task_group/base_task_group.cpp", + "src/task_manager/task_group/delayed_task_group.cpp", + "src/task_manager/task_group/task_group.cpp", + "src/task_manager/task_manager.cpp", + "src/task_manager/task_registry.cpp", + "src/task_manager/thread_pool.cpp", + "src/task_manager/thread_utils.cpp", + "src/timer/core/timer_core.cpp", + "src/timer/steady_clock.cpp", + "src/timer/time_broker.cpp", + "src/timer/camera_deferred_timer.cpp", "utils/anonymization.cpp", "utils/av_codec/src/av_codec_proxy.cpp", "utils/camera_dynamic_loader.cpp", diff --git a/services/deferred_processing_service/include/base/task_manager/task_group/base_task_group.h b/common/include/task_manager/task_group/base_task_group.h similarity index 94% rename from services/deferred_processing_service/include/base/task_manager/task_group/base_task_group.h rename to common/include/task_manager/task_group/base_task_group.h index 4e7b87ed4..eb3f18fb5 100644 --- a/services/deferred_processing_service/include/base/task_manager/task_group/base_task_group.h +++ b/common/include/task_manager/task_group/base_task_group.h @@ -16,12 +16,6 @@ #ifndef OHOS_DEFERRED_PROCESSING_SERVICE_BASE_TASK_GROUP_H #define OHOS_DEFERRED_PROCESSING_SERVICE_BASE_TASK_GROUP_H -#include -#include -#include -#include -#include -#include #include "itask_group.h" #include "blocking_queue.h" #include "thread_pool.h" diff --git a/services/deferred_processing_service/include/base/task_manager/task_group/delayed_task_group.h b/common/include/task_manager/task_group/delayed_task_group.h similarity index 95% rename from services/deferred_processing_service/include/base/task_manager/task_group/delayed_task_group.h rename to common/include/task_manager/task_group/delayed_task_group.h index b4b84b9ca..8810c7cee 100644 --- a/services/deferred_processing_service/include/base/task_manager/task_group/delayed_task_group.h +++ b/common/include/task_manager/task_group/delayed_task_group.h @@ -16,10 +16,6 @@ #ifndef OHOS_DEFERRED_PROCESSING_SERVICE_DELAYED_TASK_GROUP_H #define OHOS_DEFERRED_PROCESSING_SERVICE_DELAYED_TASK_GROUP_H -#include -#include -#include -#include #include "base_task_group.h" #include "timer/time_broker.h" diff --git a/services/deferred_processing_service/include/base/task_manager/task_group/itask_group.h b/common/include/task_manager/task_group/itask_group.h similarity index 97% rename from services/deferred_processing_service/include/base/task_manager/task_group/itask_group.h rename to common/include/task_manager/task_group/itask_group.h index e7df7dd01..446732de4 100644 --- a/services/deferred_processing_service/include/base/task_manager/task_group/itask_group.h +++ b/common/include/task_manager/task_group/itask_group.h @@ -17,9 +17,7 @@ #define OHOS_DEFERRED_PROCESSING_SERVICE_I_TASK_GROUP_H #include -#include #include -#include namespace OHOS { namespace CameraStandard { diff --git a/services/deferred_processing_service/include/base/task_manager/task_group/task_group.h b/common/include/task_manager/task_group/task_group.h similarity index 100% rename from services/deferred_processing_service/include/base/task_manager/task_group/task_group.h rename to common/include/task_manager/task_group/task_group.h diff --git a/services/deferred_processing_service/include/base/task_manager/task_manager.h b/common/include/task_manager/task_manager.h similarity index 95% rename from services/deferred_processing_service/include/base/task_manager/task_manager.h rename to common/include/task_manager/task_manager.h index 4c30d5299..f6b776523 100644 --- a/services/deferred_processing_service/include/base/task_manager/task_manager.h +++ b/common/include/task_manager/task_manager.h @@ -17,13 +17,7 @@ #define OHOS_DEFERRED_PROCESSING_SERVICE_TASK_MANAGER_H #define EXPORT_API __attribute__((visibility("default"))) -#include -#include -#include -#include -#include #include "task_registry.h" -#include "thread_pool.h" namespace OHOS { namespace CameraStandard { diff --git a/services/deferred_processing_service/include/base/task_manager/task_registry.h b/common/include/task_manager/task_registry.h similarity index 94% rename from services/deferred_processing_service/include/base/task_manager/task_registry.h rename to common/include/task_manager/task_registry.h index ce64872bb..e98b9518c 100644 --- a/services/deferred_processing_service/include/base/task_manager/task_registry.h +++ b/common/include/task_manager/task_registry.h @@ -16,12 +16,7 @@ #ifndef OHOS_DEFERRED_PROCESSING_SERVICE_TASK_REGISTRY_H #define OHOS_DEFERRED_PROCESSING_SERVICE_TASK_REGISTRY_H -#include -#include -#include #include -#include -#include #include "thread_pool.h" #include "itask_group.h" diff --git a/services/deferred_processing_service/include/base/task_manager/thread_pool.h b/common/include/task_manager/thread_pool.h similarity index 94% rename from services/deferred_processing_service/include/base/task_manager/thread_pool.h rename to common/include/task_manager/thread_pool.h index 320048ce9..ac81f7b18 100644 --- a/services/deferred_processing_service/include/base/task_manager/thread_pool.h +++ b/common/include/task_manager/thread_pool.h @@ -16,16 +16,9 @@ #ifndef OHOS_DEFERRED_PROCESSING_SERVICE_THREAD_POOL_H #define OHOS_DEFERRED_PROCESSING_SERVICE_THREAD_POOL_H -#include -#include -#include -#include +#include #include -#include -#include -#include #include -#include namespace OHOS { namespace CameraStandard { diff --git a/services/deferred_processing_service/include/base/task_manager/thread_utils.h b/common/include/task_manager/thread_utils.h similarity index 100% rename from services/deferred_processing_service/include/base/task_manager/thread_utils.h rename to common/include/task_manager/thread_utils.h diff --git a/services/deferred_processing_service/include/base/timer/camera_deferred_timer.h b/common/include/timer/camera_deferred_timer.h similarity index 100% rename from services/deferred_processing_service/include/base/timer/camera_deferred_timer.h rename to common/include/timer/camera_deferred_timer.h diff --git a/services/deferred_processing_service/include/base/timer/core/timer_core.h b/common/include/timer/core/timer_core.h similarity index 93% rename from services/deferred_processing_service/include/base/timer/core/timer_core.h rename to common/include/timer/core/timer_core.h index 9338af81e..92d678d4e 100644 --- a/services/deferred_processing_service/include/base/timer/core/timer_core.h +++ b/common/include/timer/core/timer_core.h @@ -16,18 +16,12 @@ #ifndef OHOS_DEFERRED_PROCESSING_SERVICE_TIMER_CORE_H #define OHOS_DEFERRED_PROCESSING_SERVICE_TIMER_CORE_H -#include -#include -#include -#include #include -#include -#include #include #include -#include #include "timer/camera_deferred_timer.h" + namespace OHOS { namespace CameraStandard { namespace DeferredProcessing { diff --git a/services/deferred_processing_service/include/base/timer/steady_clock.h b/common/include/timer/steady_clock.h similarity index 88% rename from services/deferred_processing_service/include/base/timer/steady_clock.h rename to common/include/timer/steady_clock.h index ac0c08bed..3febe57d2 100644 --- a/services/deferred_processing_service/include/base/timer/steady_clock.h +++ b/common/include/timer/steady_clock.h @@ -17,16 +17,8 @@ #define OHOS_DEFERRED_PROCESSING_SERVICE_STEADY_CLOCK_H #define EXPORT_API __attribute__((visibility("default"))) -#include -#include -#include -#include -#include -#include -#include -#include -#include "timer/camera_deferred_timer.h" +#include namespace OHOS { namespace CameraStandard { namespace DeferredProcessing { diff --git a/services/deferred_processing_service/include/base/timer/time_broker.h b/common/include/timer/time_broker.h similarity index 95% rename from services/deferred_processing_service/include/base/timer/time_broker.h rename to common/include/timer/time_broker.h index c91a421ac..2b4ba31d1 100644 --- a/services/deferred_processing_service/include/base/timer/time_broker.h +++ b/common/include/timer/time_broker.h @@ -16,14 +16,11 @@ #ifndef OHOS_DEFERRED_PROCESSING_SERVICE_TIME_BROKER_H #define OHOS_DEFERRED_PROCESSING_SERVICE_TIME_BROKER_H -#include -#include + #include -#include -#include + #include -#include -#include + #include "timer/camera_deferred_timer.h" namespace OHOS { diff --git a/services/deferred_processing_service/src/base/task_manager/task_group/base_task_group.cpp b/common/src/task_manager/task_group/base_task_group.cpp similarity index 69% rename from services/deferred_processing_service/src/base/task_manager/task_group/base_task_group.cpp rename to common/src/task_manager/task_group/base_task_group.cpp index 270fd1b66..7eba3d40f 100644 --- a/services/deferred_processing_service/src/base/task_manager/task_group/base_task_group.cpp +++ b/common/src/task_manager/task_group/base_task_group.cpp @@ -14,7 +14,8 @@ */ #include "base_task_group.h" -#include "dp_log.h" + +#include "camera_log.h" namespace OHOS { namespace CameraStandard { @@ -28,12 +29,12 @@ BaseTaskGroup::BaseTaskGroup(const std::string& name, TaskFunc func, bool serial inflight_(false), que_(name + " queue") { - DP_DEBUG_LOG("task group (%s).", name_.c_str()); + MEDIA_DEBUG_LOG("task group (%s).", name_.c_str()); } BaseTaskGroup::~BaseTaskGroup() { - DP_DEBUG_LOG("task group name: %s, handle: %{public}d", name_.c_str(), static_cast(handle_)); + MEDIA_DEBUG_LOG("task group name: %s, handle: %{public}d", name_.c_str(), static_cast(handle_)); que_.SetActive(false); que_.Clear(); } @@ -42,7 +43,7 @@ void BaseTaskGroup::Initialize() { handle_ = GenerateHandle(); que_.SetActive(true); - DP_DEBUG_LOG("task group (%s), handle: %{public}d", name_.c_str(), static_cast(handle_)); + MEDIA_DEBUG_LOG("task group (%s), handle: %{public}d", name_.c_str(), static_cast(handle_)); } const std::string& BaseTaskGroup::GetName() @@ -59,9 +60,10 @@ bool BaseTaskGroup::SubmitTask(std::any param) { std::lock_guard lock(mutex_); if (que_.Full()) { - DP_WARNING_LOG("Submit task (%s), handle: %{public}d, que is full!", name_.c_str(), static_cast(handle_)); + MEDIA_WARNING_LOG("Submit task (%s), handle: %{public}d, que is full!", name_.c_str(), + static_cast(handle_)); } else { - DP_DEBUG_LOG("Submit task (%s), handle: %{public}d, size: %zu.", name_.c_str(), + MEDIA_DEBUG_LOG("Submit task (%s), handle: %{public}d, size: %zu.", name_.c_str(), static_cast(handle_), que_.Size()); } que_.Push(std::move(param)); @@ -72,23 +74,24 @@ bool BaseTaskGroup::SubmitTask(std::any param) void BaseTaskGroup::CancelAllTasks() { std::lock_guard lock(mutex_); - DP_DEBUG_LOG("Cancel all tasks for task group (%s), handle: %{public}d", name_.c_str(), static_cast(handle_)); + MEDIA_DEBUG_LOG("Cancel all tasks for task group (%s), handle: %{public}d", name_.c_str(), + static_cast(handle_)); que_.Clear(); - DP_CHECK_RETURN(!serial_); + CHECK_RETURN(!serial_); inflight_ = false; } size_t BaseTaskGroup::GetTaskCount() { std::lock_guard lock(mutex_); - DP_DEBUG_LOG("Get task count for task group (%s), handle: %{public}d", name_.c_str(), static_cast(handle_)); + MEDIA_DEBUG_LOG("Get task count for task group (%s), handle: %{public}d", name_.c_str(), static_cast(handle_)); return que_.Size(); } std::function BaseTaskGroup::GetTaskUnlocked() { if (que_.Empty()) { - DP_DEBUG_LOG("(%s) no available tasks.", name_.c_str()); + MEDIA_DEBUG_LOG("(%s) no available tasks.", name_.c_str()); return {}; } std::weak_ptr weakThis(shared_from_this()); @@ -99,7 +102,7 @@ std::function BaseTaskGroup::GetTaskUnlocked() thiz->OnTaskComplete(); } }; - DP_DEBUG_LOG("return one task %s, handle:%{public}d, size: %zu.", name_.c_str(), static_cast(handle_), + MEDIA_DEBUG_LOG("return one task %s, handle:%{public}d, size: %zu.", name_.c_str(), static_cast(handle_), que_.Size()); return task; } @@ -107,7 +110,7 @@ std::function BaseTaskGroup::GetTaskUnlocked() TaskGroupHandle BaseTaskGroup::GenerateHandle() { static std::atomic counter = 0; - DP_DEBUG_LOG("(%s) entered.", name_.c_str()); + MEDIA_DEBUG_LOG("(%s) entered.", name_.c_str()); uint64_t prefix = std::hash{}(name_); uint64_t handle = ++counter; return prefix | handle; @@ -115,9 +118,9 @@ TaskGroupHandle BaseTaskGroup::GenerateHandle() void BaseTaskGroup::DispatchTaskUnlocked() { - DP_DEBUG_LOG("(%s) entered.", name_.c_str()); + MEDIA_DEBUG_LOG("(%s) entered.", name_.c_str()); if (serial_ && inflight_.load()) { - DP_DEBUG_LOG("(%s), task is running, redispatch tasks after finish running.", name_.c_str()); + MEDIA_DEBUG_LOG("(%s), task is running, redispatch tasks after finish running.", name_.c_str()); return; } auto task = GetTaskUnlocked(); @@ -125,7 +128,7 @@ void BaseTaskGroup::DispatchTaskUnlocked() inflight_ = true; threadPool_->Submit([task = std::move(task)] { task(); }); } else { - DP_DEBUG_LOG("all tasks have completed for %s handle:%{public}d.", name_.c_str(), static_cast(handle_)); + MEDIA_DEBUG_LOG("all tasks have completed for %s handle:%{public}d.", name_.c_str(), static_cast(handle_)); } } void BaseTaskGroup::OnTaskComplete() diff --git a/services/deferred_processing_service/src/base/task_manager/task_group/delayed_task_group.cpp b/common/src/task_manager/task_group/delayed_task_group.cpp similarity index 76% rename from services/deferred_processing_service/src/base/task_manager/task_group/delayed_task_group.cpp rename to common/src/task_manager/task_group/delayed_task_group.cpp index 8bc6cb1b8..a561bf67f 100644 --- a/services/deferred_processing_service/src/base/task_manager/task_group/delayed_task_group.cpp +++ b/common/src/task_manager/task_group/delayed_task_group.cpp @@ -14,8 +14,9 @@ */ #include "delayed_task_group.h" +#include "camera_log.h" #include "timer/steady_clock.h" -#include "dp_log.h" + namespace OHOS { namespace CameraStandard { @@ -23,13 +24,13 @@ namespace DeferredProcessing { DelayedTaskGroup::DelayedTaskGroup(const std::string& name, TaskFunc func, const ThreadPool* threadPool) : BaseTaskGroup(name, std::move(func), true, threadPool), mutex_(), timeBroker_(nullptr), paramMap_() { - DP_DEBUG_LOG("(%s) entered.", GetName().c_str()); + MEDIA_DEBUG_LOG("(%s) entered.", GetName().c_str()); Initialize(); } DelayedTaskGroup::~DelayedTaskGroup() { - DP_DEBUG_LOG("(%s) entered.", GetName().c_str()); + MEDIA_DEBUG_LOG("(%s) entered.", GetName().c_str()); std::lock_guard lock(mutex_); if (timeBroker_) { timeBroker_.reset(); @@ -39,7 +40,7 @@ DelayedTaskGroup::~DelayedTaskGroup() void DelayedTaskGroup::Initialize() { - DP_DEBUG_LOG("(%s) Initialize entered.", GetName().c_str()); + MEDIA_DEBUG_LOG("(%s) Initialize entered.", GetName().c_str()); BaseTaskGroup::Initialize(); timeBroker_ = TimeBroker::Create("DelayedTaskGroup"); } @@ -47,12 +48,12 @@ void DelayedTaskGroup::Initialize() bool DelayedTaskGroup::SubmitTask(std::any param) { if (!param.has_value()) { - DP_DEBUG_LOG("(%s) SubmitTask failed due to containing no parameter.", GetName().c_str()); + MEDIA_DEBUG_LOG("(%s) SubmitTask failed due to containing no parameter.", GetName().c_str()); return false; } std::lock_guard lock(mutex_); auto&& [delayTimeMs, task] = std::any_cast>&&>(std::move(param)); - DP_DEBUG_LOG("(%s) SubmitTask, delayTimeMs %{public}d ,expiring timestamp: %{public}d", + MEDIA_DEBUG_LOG("(%s) SubmitTask, delayTimeMs %{public}d ,expiring timestamp: %{public}d", GetName().c_str(), static_cast(delayTimeMs), static_cast(SteadyClock::GetTimestampMilli() + delayTimeMs)); @@ -61,17 +62,17 @@ bool DelayedTaskGroup::SubmitTask(std::any param) if (ret) { paramMap_.emplace(handle, std::move(task)); } else { - DP_ERR_LOG("(%s) SubmitTask failed due to RegisterCallback.", GetName().c_str()); + MEDIA_ERR_LOG("(%s) SubmitTask failed due to RegisterCallback.", GetName().c_str()); } return ret; } void DelayedTaskGroup::TimerExpired(uint32_t handle) { - DP_DEBUG_LOG("(%s) TimerExpired, handle = %{public}d", GetName().c_str(), static_cast(handle)); + MEDIA_DEBUG_LOG("(%s) TimerExpired, handle = %{public}d", GetName().c_str(), static_cast(handle)); std::lock_guard lock(mutex_); if (paramMap_.count(handle) == 0) { - DP_DEBUG_LOG("(%s) TimerExpired, handle = %{public}d", GetName().c_str(), static_cast(handle)); + MEDIA_DEBUG_LOG("(%s) TimerExpired, handle = %{public}d", GetName().c_str(), static_cast(handle)); return; } BaseTaskGroup::SubmitTask(std::move(paramMap_[handle])); diff --git a/services/deferred_processing_service/src/base/task_manager/task_group/task_group.cpp b/common/src/task_manager/task_group/task_group.cpp similarity index 90% rename from services/deferred_processing_service/src/base/task_manager/task_group/task_group.cpp rename to common/src/task_manager/task_group/task_group.cpp index 5910c89de..44ffeffb0 100644 --- a/services/deferred_processing_service/src/base/task_manager/task_group/task_group.cpp +++ b/common/src/task_manager/task_group/task_group.cpp @@ -14,8 +14,8 @@ */ #include "task_group.h" -#include "base_task_group.h" -#include "dp_log.h" + +#include "camera_log.h" namespace OHOS { namespace CameraStandard { @@ -23,7 +23,7 @@ namespace DeferredProcessing { TaskGroup::TaskGroup(const std::string& name, TaskFunc func, bool serial, const ThreadPool* threadPool) : BaseTaskGroup(name, std::move(func), serial, threadPool) { - DP_DEBUG_LOG("(%s) entered.", GetName().c_str()); + MEDIA_DEBUG_LOG("(%s) entered.", GetName().c_str()); } } //namespace DeferredProcessing diff --git a/services/deferred_processing_service/src/base/task_manager/task_manager.cpp b/common/src/task_manager/task_manager.cpp similarity index 78% rename from services/deferred_processing_service/src/base/task_manager/task_manager.cpp rename to common/src/task_manager/task_manager.cpp index d8d152814..7aabae631 100644 --- a/services/deferred_processing_service/src/base/task_manager/task_manager.cpp +++ b/common/src/task_manager/task_manager.cpp @@ -13,11 +13,11 @@ * limitations under the License. */ -#include - #include "task_manager.h" -#include "dp_log.h" +#include + +#include "camera_log.h" namespace OHOS { namespace CameraStandard { namespace DeferredProcessing { @@ -29,28 +29,28 @@ TaskManager::TaskManager(const std::string& name, uint32_t numThreads, bool ser taskRegistry_(nullptr), delayedTaskHandle_(INVALID_TASK_GROUP_HANDLE) { - DP_INFO_LOG("name: %s, maxThreads: %{public}d.", name.c_str(), numThreads); + MEDIA_INFO_LOG("name: %s, maxThreads: %{public}d.", name.c_str(), numThreads); Initialize(); } void TaskManager::Initialize() { - CAMERA_DP_SYNC_TRACE; - DP_INFO_LOG("entered."); + CAMERA_SYNC_TRACE; + MEDIA_INFO_LOG("entered."); pool_ = ThreadPool::Create(name_, numThreads_); taskRegistry_ = std::make_unique(name_, pool_.get()); std::weak_ptr defaultTaskHandle = defaultTaskHandle_; auto ret = RegisterTaskGroup("defaultTaskGroup", [this, defaultTaskHandle](std::any param) { auto taskHandle = defaultTaskHandle.lock(); - DP_CHECK_RETURN(!taskHandle); + CHECK_RETURN(!taskHandle); if (param.has_value()) { DoDefaultWorks(std::move(param)); } else { - DP_ERR_LOG("register default task group: failed, param has no value"); + MEDIA_ERR_LOG("register default task group: failed, param has no value"); } }, serial_, false, *defaultTaskHandle_); - DP_INFO_LOG("register default task group: %{public}d, handle: %{public}d", ret, + MEDIA_INFO_LOG("register default task group: %{public}d, handle: %{public}d", ret, static_cast(*defaultTaskHandle_)); (void)(ret); return; @@ -58,8 +58,8 @@ void TaskManager::Initialize() TaskManager::~TaskManager() { - CAMERA_DP_SYNC_TRACE; - DP_INFO_LOG("TaskManager name: %{public}s.", name_.c_str()); + CAMERA_SYNC_TRACE; + MEDIA_INFO_LOG("TaskManager name: %{public}s.", name_.c_str()); DeregisterTaskGroup("defaultTaskGroup", *defaultTaskHandle_); *defaultTaskHandle_ = INVALID_TASK_GROUP_HANDLE; if (delayedTaskHandle_ != INVALID_TASK_GROUP_HANDLE) { @@ -79,11 +79,12 @@ void TaskManager::CreateDelayedTaskGroupIfNeed() RegisterTaskGroup("delayedTaskGroup", [this, defaultTaskHandle](std::any param) { auto taskHandle = defaultTaskHandle.lock(); - DP_CHECK_RETURN(!taskHandle); + CHECK_RETURN(!taskHandle); if (param.has_value()) { DoDefaultWorks(std::move(param)); } else { - DP_ERR_LOG("CreateDelayedTaskGroupIfNeed register default task group: failed, param has no value"); + MEDIA_ERR_LOG("CreateDelayedTaskGroupIfNeed register default \ + task group: failed, param has no value"); } }, true, true, delayedTaskHandle_); } @@ -92,12 +93,12 @@ void TaskManager::CreateDelayedTaskGroupIfNeed() void TaskManager::BeginBackgroundTasks() { - DP_INFO_LOG("name: %s.", name_.c_str()); + MEDIA_INFO_LOG("name: %s.", name_.c_str()); } void TaskManager::EndBackgroundTasks() { - DP_INFO_LOG("name: %s.", name_.c_str()); + MEDIA_INFO_LOG("name: %s.", name_.c_str()); } bool TaskManager::RegisterTaskGroup(const std::string& name, TaskFunc func, bool serial, TaskGroupHandle& handle) @@ -107,13 +108,13 @@ bool TaskManager::RegisterTaskGroup(const std::string& name, TaskFunc func, bool bool TaskManager::DeregisterTaskGroup(const std::string& name, TaskGroupHandle& handle) { - CAMERA_DP_SYNC_TRACE; + CAMERA_SYNC_TRACE; bool ret = false; if (taskRegistry_) { ret = taskRegistry_->DeregisterTaskGroup(name, handle); - DP_INFO_LOG("deregister task group: %s, ret: %{public}d", name.c_str(), ret); + MEDIA_INFO_LOG("deregister task group: %s, ret: %{public}d", name.c_str(), ret); } else { - DP_INFO_LOG("invalid ptr"); + MEDIA_INFO_LOG("invalid ptr"); } return ret; } @@ -131,9 +132,9 @@ bool TaskManager::SubmitTask(std::function task, uint32_t delayMilli) bool TaskManager::SubmitTask(TaskGroupHandle handle, std::any param) { - DP_INFO_LOG("submit task to handle: %{public}d", static_cast(handle)); + MEDIA_DEBUG_LOG("submit task to handle: %{public}d", static_cast(handle)); if (taskRegistry_ == nullptr) { - DP_ERR_LOG("invalid ptr"); + MEDIA_ERR_LOG("invalid ptr"); return false; } return taskRegistry_->SubmitTask(handle, std::move(param)); @@ -141,9 +142,9 @@ bool TaskManager::SubmitTask(TaskGroupHandle handle, std::any param) void TaskManager::CancelAllTasks() { - DP_INFO_LOG("Cancel all tasks to handle: %{public}d", static_cast(*defaultTaskHandle_)); + MEDIA_INFO_LOG("Cancel all tasks to handle: %{public}d", static_cast(*defaultTaskHandle_)); if (taskRegistry_ == nullptr) { - DP_ERR_LOG("invalid ptr"); + MEDIA_ERR_LOG("invalid ptr"); return; } taskRegistry_->CancelAllTasks(*defaultTaskHandle_); @@ -151,7 +152,7 @@ void TaskManager::CancelAllTasks() bool TaskManager::IsEmpty() { - DP_INFO_LOG("Get tasks count: %{public}d", static_cast(*defaultTaskHandle_)); + MEDIA_INFO_LOG("Get tasks count: %{public}d", static_cast(*defaultTaskHandle_)); if (taskRegistry_ == nullptr) { return true; } diff --git a/services/deferred_processing_service/src/base/task_manager/task_registry.cpp b/common/src/task_manager/task_registry.cpp similarity index 72% rename from services/deferred_processing_service/src/base/task_manager/task_registry.cpp rename to common/src/task_manager/task_registry.cpp index d267a8f69..0754b0b3a 100644 --- a/services/deferred_processing_service/src/base/task_manager/task_registry.cpp +++ b/common/src/task_manager/task_registry.cpp @@ -14,9 +14,10 @@ */ #include "task_registry.h" + #include "delayed_task_group.h" #include "task_group.h" -#include "dp_log.h" +#include "camera_log.h" namespace OHOS { namespace CameraStandard { @@ -24,13 +25,13 @@ namespace DeferredProcessing { TaskRegistry::TaskRegistry(const std::string& name, const ThreadPool* threadPool) : name_(name), threadPool_(threadPool), mutex_(), registry_() { - DP_DEBUG_LOG("name: %s.", name.c_str()); + MEDIA_DEBUG_LOG("name: %s.", name.c_str()); } TaskRegistry::~TaskRegistry() { - CAMERA_DP_SYNC_TRACE; - DP_DEBUG_LOG("name: %s.", name_.c_str()); + CAMERA_SYNC_TRACE; + MEDIA_DEBUG_LOG("name: %s.", name_.c_str()); std::lock_guard lock(mutex_); registry_.clear(); } @@ -38,9 +39,9 @@ TaskRegistry::~TaskRegistry() bool TaskRegistry::RegisterTaskGroup(const std::string& name, TaskFunc func, bool serial, bool delayTask, TaskGroupHandle& handle) { - DP_DEBUG_LOG("name: %s, serial: %{public}d, delayTask: %{public}d.", name.c_str(), serial, delayTask); + MEDIA_DEBUG_LOG("name: %s, serial: %{public}d, delayTask: %{public}d.", name.c_str(), serial, delayTask); if (IsTaskGroupAlreadyRegistered(name)) { - DP_DEBUG_LOG("failed, task group (%s) already existed!", name.c_str()); + MEDIA_DEBUG_LOG("failed, task group (%s) already existed!", name.c_str()); return false; } std::lock_guard lock(mutex_); @@ -60,17 +61,17 @@ bool TaskRegistry::RegisterTaskGroup(const std::string& name, TaskFunc func, boo bool TaskRegistry::DeregisterTaskGroup(const std::string& name, TaskGroupHandle& handle) { - CAMERA_DP_SYNC_TRACE; - DP_DEBUG_LOG("name: %s.", name.c_str()); + CAMERA_SYNC_TRACE; + MEDIA_DEBUG_LOG("name: %s.", name.c_str()); if (!IsTaskGroupAlreadyRegistered(name)) { - DP_DEBUG_LOG("name: %s, with handle:%{public}d, failed due to non exist task group!", + MEDIA_DEBUG_LOG("name: %s, with handle:%{public}d, failed due to non exist task group!", name.c_str(), static_cast(handle)); return false; } std::lock_guard lock(mutex_); auto it = registry_.find(handle); if (it == registry_.end()) { - DP_DEBUG_LOG("name: %s, handle:%{public}d failed due to non-existent task group!", + MEDIA_DEBUG_LOG("name: %s, handle:%{public}d failed due to non-existent task group!", name.c_str(), static_cast(handle)); return false; } @@ -80,11 +81,11 @@ bool TaskRegistry::DeregisterTaskGroup(const std::string& name, TaskGroupHandle& bool TaskRegistry::SubmitTask(TaskGroupHandle handle, std::any param) { - DP_DEBUG_LOG("submit one task to %{public}d", static_cast(handle)); + MEDIA_DEBUG_LOG("submit one task to %{public}d", static_cast(handle)); std::lock_guard lock(mutex_); auto it = registry_.find(handle); if (it == registry_.end()) { - DP_DEBUG_LOG("failed due to task group %{public}d non-exist!", static_cast(handle)); + MEDIA_DEBUG_LOG("failed due to task group %{public}d non-exist!", static_cast(handle)); return false; } return it->second->SubmitTask(std::move(param)); @@ -92,11 +93,11 @@ bool TaskRegistry::SubmitTask(TaskGroupHandle handle, std::any param) void TaskRegistry::CancelAllTasks(TaskGroupHandle handle) { - DP_DEBUG_LOG("Cancel all tasks to %{public}d", static_cast(handle)); + MEDIA_DEBUG_LOG("Cancel all tasks to %{public}d", static_cast(handle)); std::lock_guard lock(mutex_); auto it = registry_.find(handle); if (it == registry_.end()) { - DP_DEBUG_LOG("failed due to task group %{public}d non-exist!", static_cast(handle)); + MEDIA_DEBUG_LOG("failed due to task group %{public}d non-exist!", static_cast(handle)); return; } it->second->CancelAllTasks(); @@ -104,11 +105,11 @@ void TaskRegistry::CancelAllTasks(TaskGroupHandle handle) size_t TaskRegistry::GetTaskCount(TaskGroupHandle handle) { - DP_DEBUG_LOG("Get task count %{public}d", static_cast(handle)); + MEDIA_DEBUG_LOG("Get task count %{public}d", static_cast(handle)); std::lock_guard lock(mutex_); auto it = registry_.find(handle); if (it == registry_.end()) { - DP_DEBUG_LOG("failed due to task group %{public}d non-exist!", static_cast(handle)); + MEDIA_DEBUG_LOG("failed due to task group %{public}d non-exist!", static_cast(handle)); return 0; } return it->second->GetTaskCount(); @@ -119,11 +120,11 @@ bool TaskRegistry::IsTaskGroupAlreadyRegistered(const std::string& name) std::lock_guard lock(mutex_); for (auto it = registry_.begin(); it != registry_.end(); ++it) { if (it->second->GetName() == name) { - DP_DEBUG_LOG("task group (%s) had registered.", name.c_str()); + MEDIA_DEBUG_LOG("task group (%s) had registered.", name.c_str()); return true; } } - DP_DEBUG_LOG("task group (%s) hasn't been registered.", name.c_str()); + MEDIA_DEBUG_LOG("task group (%s) hasn't been registered.", name.c_str()); return false; } } //namespace DeferredProcessing diff --git a/services/deferred_processing_service/src/base/task_manager/thread_pool.cpp b/common/src/task_manager/thread_pool.cpp similarity index 78% rename from services/deferred_processing_service/src/base/task_manager/thread_pool.cpp rename to common/src/task_manager/thread_pool.cpp index f79c4d265..2de8e32fa 100644 --- a/services/deferred_processing_service/src/base/task_manager/thread_pool.cpp +++ b/common/src/task_manager/thread_pool.cpp @@ -14,10 +14,12 @@ */ #include "thread_pool.h" + #include #include + +#include "camera_log.h" #include "thread_utils.h" -#include "dp_log.h" namespace OHOS { namespace CameraStandard { @@ -38,18 +40,18 @@ ThreadPool::ThreadPool(const std::string& name, uint32_t numThreads) numThreads_ = 1; } numThreads_ = std::min(numThreads_, static_cast(std::thread::hardware_concurrency())); - DP_DEBUG_LOG("name: %s, numThreads, orig: %u, new: %u.", name.c_str(), numThreads, numThreads_); + MEDIA_DEBUG_LOG("name: %s, numThreads, orig: %u, new: %u.", name.c_str(), numThreads, numThreads_); } ThreadPool::~ThreadPool() { - CAMERA_DP_SYNC_TRACE; - DP_DEBUG_LOG("name: %s.", name_.c_str()); + CAMERA_SYNC_TRACE; + MEDIA_DEBUG_LOG("name: %s.", name_.c_str()); isStopped_ = true; taskCv_.notify_all(); for (auto& threadInfo : workers_) { if (threadInfo.thread.joinable()) { - DP_DEBUG_LOG("joining thread (%s).", threadInfo.name.c_str()); + MEDIA_DEBUG_LOG("joining thread (%s).", threadInfo.name.c_str()); threadInfo.thread.join(); } } @@ -57,7 +59,7 @@ ThreadPool::~ThreadPool() void ThreadPool::Initialize() { - DP_DEBUG_LOG("entered."); + MEDIA_DEBUG_LOG("entered."); workers_.reserve(numThreads_); std::string threadNamePrefix = name_ + "_DPS_Worker_"; for (uint32_t i = 0; i < numThreads_; ++i) { @@ -70,24 +72,24 @@ void ThreadPool::Initialize() void ThreadPool::WorkerLoop(const std::string& threadName) { - DP_DEBUG_LOG("(%s) entered.", threadName.c_str()); + MEDIA_DEBUG_LOG("(%s) entered.", threadName.c_str()); while (!isStopped_.load()) { - DP_DEBUG_LOG("(%s) task excute start entered.", threadName.c_str()); + MEDIA_DEBUG_LOG("(%s) task excute start entered.", threadName.c_str()); auto task = GetTask(); if (task) { - DP_DEBUG_LOG("(%s) task excuting entered.", threadName.c_str()); + MEDIA_DEBUG_LOG("(%s) task excuting entered.", threadName.c_str()); task(); - DP_DEBUG_LOG("(%s) task excuting complete.", threadName.c_str()); + MEDIA_DEBUG_LOG("(%s) task excuting complete.", threadName.c_str()); } else { - DP_DEBUG_LOG("empty task."); + MEDIA_DEBUG_LOG("empty task."); } } - DP_DEBUG_LOG("(%s) exited.", threadName.c_str()); + MEDIA_DEBUG_LOG("(%s) exited.", threadName.c_str()); } void ThreadPool::BeginBackgroundTasks() const { - DP_DEBUG_LOG("entered."); + MEDIA_DEBUG_LOG("entered."); for (auto& workerInfo : workers_) { SetThreadPriority(workerInfo.thread.native_handle(), PRIORITY_BACKGROUND); } @@ -95,7 +97,7 @@ void ThreadPool::BeginBackgroundTasks() const void ThreadPool::EndBackgroundTasks() const { - DP_DEBUG_LOG("entered."); + MEDIA_DEBUG_LOG("entered."); for (auto& workerInfo : workers_) { SetThreadPriority(workerInfo.thread.native_handle(), PRIORITY_NORMAL); } @@ -103,7 +105,7 @@ void ThreadPool::EndBackgroundTasks() const void ThreadPool::SetThreadPoolPriority(int priority) { - DP_DEBUG_LOG("entered."); + MEDIA_DEBUG_LOG("entered."); for (auto& workerInfo : workers_) { SetThreadPriority(workerInfo.thread.native_handle(), priority); } @@ -121,10 +123,11 @@ void ThreadPool::PrintThreadInfo() for (auto& workerInfo : workers_) { int ret = pthread_getschedparam(workerInfo.thread.native_handle(), &policy, &sch); if (ret == 0) { - DP_DEBUG_LOG("thread (%s) priority: %{public}d, policy = %{public}d(0:OTHER, 1:FIFO, 2:RR)", + MEDIA_DEBUG_LOG("thread (%s) priority: %{public}d, policy = %{public}d(0:OTHER, 1:FIFO, 2:RR)", workerInfo.name.c_str(), sch.sched_priority, policy); } else { - DP_DEBUG_LOG("thread (%s) pthread_getschedparam failed, ret = %{public}d.", workerInfo.name.c_str(), ret); + MEDIA_DEBUG_LOG("thread (%s) pthread_getschedparam failed, ret = %{public}d.", + workerInfo.name.c_str(), ret); } } } @@ -149,7 +152,7 @@ bool ThreadPool::HasPendingTasks() const bool ThreadPool::Submit(Task func, bool isUrgent) const { - DP_DEBUG_LOG("entered."); + MEDIA_DEBUG_LOG("entered."); if (!isStopped_.load()) { { std::unique_lock lock(mutex_); @@ -161,7 +164,7 @@ bool ThreadPool::Submit(Task func, bool isUrgent) const } taskCv_.notify_one(); } else { - DP_ERR_LOG("failed due to thread pool has been stopped."); + MEDIA_ERR_LOG("failed due to thread pool has been stopped."); return false; } return true; diff --git a/services/deferred_processing_service/src/base/task_manager/thread_utils.cpp b/common/src/task_manager/thread_utils.cpp similarity index 80% rename from services/deferred_processing_service/src/base/task_manager/thread_utils.cpp rename to common/src/task_manager/thread_utils.cpp index 8a992eda4..790eee992 100644 --- a/services/deferred_processing_service/src/base/task_manager/thread_utils.cpp +++ b/common/src/task_manager/thread_utils.cpp @@ -14,8 +14,10 @@ */ #include "thread_utils.h" + #include -#include "dp_log.h" + +#include "camera_log.h" namespace OHOS { namespace CameraStandard { @@ -27,10 +29,10 @@ void SetThreadName(pthread_t tid, const std::string& name) constexpr int threadNameMaxSize = 15; auto threadName = name.size() > threadNameMaxSize ? name.substr(0, threadNameMaxSize).c_str() : name; if (name.size() > threadNameMaxSize) { - DP_DEBUG_LOG("task name %s exceed max size: %{public}d", name.c_str(), threadNameMaxSize); + MEDIA_DEBUG_LOG("task name %s exceed max size: %{public}d", name.c_str(), threadNameMaxSize); } int ret = pthread_setname_np(tid, threadName.c_str()); - DP_DEBUG_LOG("threadId: %{public}ld, threadName: %s, pthread_setname_np ret = %{public}d.", + MEDIA_DEBUG_LOG("threadId: %{public}ld, threadName: %s, pthread_setname_np ret = %{public}d.", static_cast(pthread_gettid_np(tid)), threadName.c_str(), ret); } @@ -43,9 +45,9 @@ void SetThreadPriority(pthread_t handle, int priority) } int ret = setpriority(PRIO_PROCESS, tid, priority); if (ret == 0) { - DP_DEBUG_LOG("succeed for tid (%ld) with priority (%{public}d).", static_cast(tid), priority); + MEDIA_DEBUG_LOG("succeed for tid (%ld) with priority (%{public}d).", static_cast(tid), priority); } else { - DP_DEBUG_LOG("failed for tid (%ld) with priority (%{public}d), ret = %{public}d.", + MEDIA_DEBUG_LOG("failed for tid (%ld) with priority (%{public}d), ret = %{public}d.", static_cast(tid), priority, ret); } } diff --git a/services/deferred_processing_service/src/base/timer/camera_deferred_timer.cpp b/common/src/timer/camera_deferred_timer.cpp similarity index 100% rename from services/deferred_processing_service/src/base/timer/camera_deferred_timer.cpp rename to common/src/timer/camera_deferred_timer.cpp diff --git a/services/deferred_processing_service/src/base/timer/core/timer_core.cpp b/common/src/timer/core/timer_core.cpp similarity index 83% rename from services/deferred_processing_service/src/base/timer/core/timer_core.cpp rename to common/src/timer/core/timer_core.cpp index d51a25eb5..759ce92e9 100644 --- a/services/deferred_processing_service/src/base/timer/core/timer_core.cpp +++ b/common/src/timer/core/timer_core.cpp @@ -13,12 +13,11 @@ * limitations under the License. */ -#include -#include + #include "timer/core/timer_core.h" #include "thread_utils.h" #include "timer/steady_clock.h" -#include "dp_log.h" +#include "camera_log.h" namespace OHOS { namespace CameraStandard { @@ -35,12 +34,12 @@ TimerCore& TimerCore::GetInstance() TimerCore::TimerCore() { - DP_DEBUG_LOG("entered."); + MEDIA_DEBUG_LOG("entered."); } TimerCore::~TimerCore() { - DP_DEBUG_LOG("entered."); + MEDIA_DEBUG_LOG("entered."); { std::unique_lock lock(mutex_); registeredTimers_.clear(); @@ -50,12 +49,12 @@ TimerCore::~TimerCore() if (worker_.joinable()) { worker_.join(); } - DP_DEBUG_LOG("exited."); + MEDIA_DEBUG_LOG("exited."); } bool TimerCore::Initialize() { - DP_DEBUG_LOG("entered."); + MEDIA_DEBUG_LOG("entered."); std::unique_lock lock(mutex_); if (!active_) { active_ = true; @@ -73,7 +72,7 @@ bool TimerCore::RegisterTimer(uint64_t timestampMs, const std::shared_ptr return false; } if (timer == nullptr) { - DP_DEBUG_LOG("failed due to nullptr."); + MEDIA_DEBUG_LOG("failed due to nullptr."); return false; } std::unique_lock lock(mutex_); @@ -85,7 +84,7 @@ bool TimerCore::RegisterTimer(uint64_t timestampMs, const std::shared_ptr } } registeredTimers_[timestampMs].push_back(timer); - DP_DEBUG_LOG("register timer (%s), timestamp: %{public}d, timeline.top: %{public}d", timer->GetName().c_str(), + MEDIA_DEBUG_LOG("register timer (%s), timestamp: %{public}d, timeline.top: %{public}d", timer->GetName().c_str(), static_cast(timestampMs), static_cast(timeline_.top())); return true; } @@ -96,10 +95,10 @@ bool TimerCore::DeregisterTimer(uint64_t timestampMs, const std::shared_ptr