From e15d838939c15c1c476bf1276790b812ba3da3b7 Mon Sep 17 00:00:00 2001 From: zuotao Date: Fri, 25 Jul 2025 17:10:33 +0800 Subject: [PATCH 1/6] update priority Signed-off-by: zuotao --- frameworks/js/avrecorder/avrecorder_napi.cpp | 7 +++++ services/include/i_recorder_service.h | 2 ++ .../recorder/client/recorder_client.cpp | 15 +++++++++ .../recorder/client/recorder_client.h | 1 + .../ipc/i_standard_recorder_service.h | 3 ++ .../recorder/ipc/recorder_service_proxy.cpp | 20 ++++++++++++ .../recorder/ipc/recorder_service_proxy.h | 1 + .../recorder/ipc/recorder_service_stub.cpp | 16 ++++++++++ .../recorder/ipc/recorder_service_stub.h | 2 ++ .../recorder/server/recorder_server.cpp | 31 +++++++++++++++++++ .../recorder/server/recorder_server.h | 2 ++ .../mock/recorder_service_stub.h | 1 + 12 files changed, 101 insertions(+) diff --git a/frameworks/js/avrecorder/avrecorder_napi.cpp b/frameworks/js/avrecorder/avrecorder_napi.cpp index a02f12870..7bd472db9 100644 --- a/frameworks/js/avrecorder/avrecorder_napi.cpp +++ b/frameworks/js/avrecorder/avrecorder_napi.cpp @@ -266,6 +266,12 @@ napi_value AVRecorderNapi::JsPrepare(napi_env env, napi_callback_info info) if (asyncCtx->napi->CheckStateMachine(opt) == MSERR_OK) { if (asyncCtx->napi->GetConfig(asyncCtx, env, args[0]) == MSERR_OK) { + QOS::QosLevel level; + GetThreadQos(level); + MEDIA_LOGI("GetThreadQos %{public}d", (int32_t)level); + if (level == QOS::QosLevel::QOS_USER_INTERACTIVE) { + asyncCtx->napi->taskQue_->SetQos(level); + } asyncCtx->task_ = AVRecorderNapi::GetPrepareTask(asyncCtx); (void)asyncCtx->napi->taskQue_->EnqueueTask(asyncCtx->task_); } @@ -285,6 +291,7 @@ napi_value AVRecorderNapi::JsPrepare(napi_env env, napi_callback_info info) asyncCtx->SignError(result.Value().first, result.Value().second); } } + asyncCtx->napi->taskQue_->ResetQos(); MEDIA_LOGI("The js thread of prepare finishes execution and returns"); }, MediaAsyncContext::CompleteCallback, static_cast(asyncCtx.get()), &asyncCtx->work)); NAPI_CALL(env, napi_queue_async_work_with_qos(env, asyncCtx->work, napi_qos_user_initiated)); diff --git a/services/include/i_recorder_service.h b/services/include/i_recorder_service.h index 48282bd69..6d420bd3e 100644 --- a/services/include/i_recorder_service.h +++ b/services/include/i_recorder_service.h @@ -21,6 +21,7 @@ #include "refbase.h" #include "surface.h" #include "media_data_source.h" +#include "qos.h" namespace OHOS { namespace Media { @@ -630,6 +631,7 @@ public: virtual int32_t SetUserMeta(const std::shared_ptr &userMeta) = 0; virtual int32_t SetWillMuteWhenInterrupted(bool muteWhenInterrupted) = 0; + virtual int32_t TransmitQos(QOS::QosLevel level) = 0; }; } // namespace Media } // namespace OHOS diff --git a/services/services/recorder/client/recorder_client.cpp b/services/services/recorder/client/recorder_client.cpp index 486df4710..de7848770 100644 --- a/services/services/recorder/client/recorder_client.cpp +++ b/services/services/recorder/client/recorder_client.cpp @@ -40,6 +40,12 @@ RecorderClient::RecorderClient(const sptr &ipcProxy) : recorderProxy_(ipcProxy) { MEDIA_LOGD("0x%{public}06" PRIXPTR " Instances create", FAKE_POINTER(this)); + QOS::QosLevel level; + GetThreadQos(level); + MEDIA_LOGI("GetThreadQos %{public}d", (int32_t)level); + if (level == QOS::QosLevel::QOS_USER_INTERACTIVE) { + recorderProxy_->TransmitQos(level); + } } RecorderClient::~RecorderClient() @@ -564,5 +570,14 @@ int32_t RecorderClient::SetWillMuteWhenInterrupted(bool muteWhenInterrupted) MEDIA_LOGD("SetWillMuteWhenInterrupted"); return recorderProxy_->SetWillMuteWhenInterrupted(muteWhenInterrupted); } + +int32_t RecorderClient::TransmitQos(QOS::QosLevel level) +{ + std::lock_guard lock(mutex_); + CHECK_AND_RETURN_RET_LOG(recorderProxy_ != nullptr, MSERR_NO_MEMORY, "recorder service does not exist."); + + MEDIA_LOGD("TransmitQos"); + return recorderProxy_->TransmitQos(level); +} } // namespace Media } // namespace OHOS diff --git a/services/services/recorder/client/recorder_client.h b/services/services/recorder/client/recorder_client.h index 04af37297..0f731dcc8 100644 --- a/services/services/recorder/client/recorder_client.h +++ b/services/services/recorder/client/recorder_client.h @@ -82,6 +82,7 @@ public: int32_t SetWatermark(std::shared_ptr &waterMarkBuffer) override; int32_t SetUserMeta(const std::shared_ptr &userMeta) override; int32_t SetWillMuteWhenInterrupted(bool muteWhenInterrupted) override; + int32_t TransmitQos(QOS::QosLevel level) override; // RecorderClient void MediaServerDied(); diff --git a/services/services/recorder/ipc/i_standard_recorder_service.h b/services/services/recorder/ipc/i_standard_recorder_service.h index cc180ee6f..43e5e22bf 100644 --- a/services/services/recorder/ipc/i_standard_recorder_service.h +++ b/services/services/recorder/ipc/i_standard_recorder_service.h @@ -21,6 +21,7 @@ #include "iremote_proxy.h" #include "iremote_stub.h" #include "recorder.h" +#include "qos.h" namespace OHOS { namespace Media { @@ -98,6 +99,7 @@ public: virtual int32_t SetWatermark(std::shared_ptr &waterMarkBuffer) = 0; virtual int32_t SetUserMeta(const std::shared_ptr &userMeta) = 0; virtual int32_t SetWillMuteWhenInterrupted(bool muteWhenInterrupted) = 0; + virtual int32_t TransmitQos(QOS::QosLevel level) = 0; /** * IPC code ID */ @@ -154,6 +156,7 @@ public: SET_WATERMARK, SET_USERMETA, SET_INTERRUPT_STRATEGY, + TRANSMIT_QOS, }; DECLARE_INTERFACE_DESCRIPTOR(u"IStandardRecorderService"); diff --git a/services/services/recorder/ipc/recorder_service_proxy.cpp b/services/services/recorder/ipc/recorder_service_proxy.cpp index 242473fb7..22deec294 100644 --- a/services/services/recorder/ipc/recorder_service_proxy.cpp +++ b/services/services/recorder/ipc/recorder_service_proxy.cpp @@ -17,6 +17,7 @@ #include "recorder_listener_stub.h" #include "media_log.h" #include "media_errors.h" +#include "qos.h" namespace { constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, LOG_DOMAIN_RECORDER, "RecorderServiceProxy"}; @@ -1024,5 +1025,24 @@ int32_t RecorderServiceProxy::SetWillMuteWhenInterrupted(bool muteWhenInterrupte return reply.ReadInt32(); } + +int32_t RecorderServiceProxy::TransmitQos(QOS::QosLevel level) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + bool token = data.WriteInterfaceToken(RecorderServiceProxy::GetDescriptor()); + CHECK_AND_RETURN_RET_LOG(token, MSERR_INVALID_OPERATION, "Failed to write descriptor!"); + + token = data.WriteInt32(static_cast(level)); + CHECK_AND_RETURN_RET_LOG(token, MSERR_INVALID_OPERATION, "write data failed"); + + int error = Remote()->SendRequest(TRANSMIT_QOS, data, reply, option); + CHECK_AND_RETURN_RET_LOG(error == MSERR_OK, MSERR_INVALID_OPERATION, + "TransmitQos failed, error: %{public}d", error); + + return reply.ReadInt32(); +} } // namespace Media } // namespace OHOS diff --git a/services/services/recorder/ipc/recorder_service_proxy.h b/services/services/recorder/ipc/recorder_service_proxy.h index c76069da5..efd16e9fe 100644 --- a/services/services/recorder/ipc/recorder_service_proxy.h +++ b/services/services/recorder/ipc/recorder_service_proxy.h @@ -78,6 +78,7 @@ public: int32_t SetWatermark(std::shared_ptr &waterMarkBuffer) override; int32_t SetUserMeta(const std::shared_ptr &userMeta) override; int32_t SetWillMuteWhenInterrupted(bool muteWhenInterrupted) override; + int32_t TransmitQos(QOS::QosLevel level) override; private: static inline BrokerDelegator delegator_; }; diff --git a/services/services/recorder/ipc/recorder_service_stub.cpp b/services/services/recorder/ipc/recorder_service_stub.cpp index 6938c9045..7dd317b53 100644 --- a/services/services/recorder/ipc/recorder_service_stub.cpp +++ b/services/services/recorder/ipc/recorder_service_stub.cpp @@ -170,6 +170,8 @@ void RecorderServiceStub::FillRecFuncPart3() [this](MessageParcel &data, MessageParcel &reply) { return SetWillMuteWhenInterrupted(data, reply); }; recFuncs_[SET_VIDEO_ENABLE_B_FRAME] = [this](MessageParcel &data, MessageParcel &reply) { return SetVideoEnableBFrame(data, reply); }; + recFuncs_[TRANSMIT_QOS] = + [this](MessageParcel &data, MessageParcel &reply) { return TransmitQos(data, reply); }; } int32_t RecorderServiceStub::DestroyStub() @@ -536,6 +538,12 @@ int32_t RecorderServiceStub::SetUserMeta(const std::shared_ptr &userMeta) return recorderServer_->SetUserMeta(userMeta); } +int32_t RecorderServiceStub::TransmitQos(QOS::QosLevel level) +{ + CHECK_AND_RETURN_RET_LOG(recorderServer_ != nullptr, MSERR_NO_MEMORY, "recorder server is nullptr"); + return recorderServer_->TransmitQos(level); +} + int32_t RecorderServiceStub::DoIpcAbnormality() { MEDIA_LOGI("Enter DoIpcAbnormality."); @@ -990,6 +998,7 @@ int32_t RecorderServiceStub::IsWatermarkSupported(MessageParcel &data, MessagePa CHECK_AND_RETURN_RET_LOG(reply.WriteInt32(ret), MSERR_INVALID_OPERATION, "reply write failed"); return MSERR_OK; } + int32_t RecorderServiceStub::SetWatermark(MessageParcel &data, MessageParcel &reply) { std::shared_ptr buffer = AVBuffer::CreateAVBuffer(); @@ -1015,5 +1024,12 @@ int32_t RecorderServiceStub::SetWillMuteWhenInterrupted(MessageParcel &data, Mes reply.WriteInt32(SetWillMuteWhenInterrupted(muteWhenInterrupted)); return MSERR_OK; } + +int32_t RecorderServiceStub::TransmitQos(MessageParcel &data, MessageParcel &reply) +{ + (void)reply; + QOS::QosLevel level = static_cast(data.ReadInt32()); + return TransmitQos(level); +} } // namespace Media } // namespace OHOS diff --git a/services/services/recorder/ipc/recorder_service_stub.h b/services/services/recorder/ipc/recorder_service_stub.h index e522a7cab..5fad6aa9f 100644 --- a/services/services/recorder/ipc/recorder_service_stub.h +++ b/services/services/recorder/ipc/recorder_service_stub.h @@ -84,6 +84,7 @@ public: int32_t SetWatermark(std::shared_ptr &waterMarkBuffer) override; int32_t SetUserMeta(const std::shared_ptr &userMeta) override; int32_t SetWillMuteWhenInterrupted(bool muteWhenInterrupted) override; + int32_t TransmitQos(QOS::QosLevel level) override; // MonitorServerObject override int32_t DoIpcAbnormality() override; int32_t DoIpcRecovery(bool fromMonitor) override; @@ -139,6 +140,7 @@ private: int32_t SetWatermark(MessageParcel &data, MessageParcel &reply); int32_t SetUserMeta(MessageParcel &data, MessageParcel &reply); int32_t SetWillMuteWhenInterrupted(MessageParcel &data, MessageParcel &reply); + int32_t TransmitQos(MessageParcel &data, MessageParcel &reply); int32_t CheckPermission(); void FillRecFuncPart1(); void FillRecFuncPart2(); diff --git a/services/services/recorder/server/recorder_server.cpp b/services/services/recorder/server/recorder_server.cpp index d2166426c..7f02ae81a 100644 --- a/services/services/recorder/server/recorder_server.cpp +++ b/services/services/recorder/server/recorder_server.cpp @@ -33,9 +33,14 @@ #ifdef SUPPORT_POWER_MANAGER #include "shutdown/shutdown_priority.h" #endif +#include "res_type.h" +#include "res_sched_client.h" namespace { constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, LOG_DOMAIN_RECORDER, "RecorderServer"}; + constexpr uint32_t THREAD_PRIORITY_41 = 7; + constexpr uint32_t RES_TYPE = OHOS::ResourceSchedule::ResType::RES_TYPE_THREAD_QOS_CHANGE; + constexpr int64_t RES_VALUE = 0; const std::map RECORDER_STATE_MAP = { {OHOS::Media::RecorderServer::REC_INITIALIZED, "initialized"}, {OHOS::Media::RecorderServer::REC_CONFIGURED, "configured"}, @@ -1186,6 +1191,32 @@ int32_t RecorderServer::SetUserMeta(const std::shared_ptr &userMeta) return result.Value(); } +int32_t RecorderServer::TransmitQos(QOS::QosLevel level) +{ + MEDIA_LOGI("TransmitQos in"); + std::lock_guard lock(mutex_); + MEDIA_LOGI("TransmitQos %{public}d", (int32_t)level); + clientQos_ = level; + + auto task = std::make_shared>([&, this] { + MEDIA_LOGI("clientQos_ %{public}d", (int32_t)clientQos_); + if (clientQos_ == QOS::QosLevel::QOS_USER_INTERACTIVE) { + MEDIA_LOGI("RES_TYPE_THREAD_QOS_CHANGE"); + std::unordered_map mapPayload; + mapPayload["bundleName"] = "media_service"; + mapPayload["pid"] = std::to_string(getpid()); + mapPayload[std::to_string(gettid())] = std::to_string(THREAD_PRIORITY_41); + OHOS::ResourceSchedule::ResSchedClient::GetInstance().ReportData(RES_TYPE, RES_VALUE, mapPayload); + } + return MSERR_OK; + }); + int32_t ret = taskQue_.EnqueueTask(task); + CHECK_AND_RETURN_RET_LOG(ret == MSERR_OK, ret, "EnqueueTask failed"); + + auto result = task->GetResult(); + return result.Value(); +} + int32_t RecorderServer::SetWillMuteWhenInterrupted(bool muteWhenInterrupted) { MEDIA_LOGI("SetWillMuteWhenInterrupted in"); diff --git a/services/services/recorder/server/recorder_server.h b/services/services/recorder/server/recorder_server.h index 82502fc1c..9b954e831 100644 --- a/services/services/recorder/server/recorder_server.h +++ b/services/services/recorder/server/recorder_server.h @@ -122,6 +122,7 @@ public: int32_t SetWatermark(std::shared_ptr &waterMarkBuffer) override; int32_t SetUserMeta(const std::shared_ptr &userMeta) override; int32_t SetWillMuteWhenInterrupted(bool muteWhenInterrupted) override; + int32_t TransmitQos(QOS::QosLevel level) override; // IRecorderEngineObs override void OnError(ErrorType errorType, int32_t errorCode) override; @@ -197,6 +198,7 @@ private: int32_t startLatency = -1; } statisticalEventInfo_; int64_t startTime_ = 0; + QOS::QosLevel clientQos_ = QOS::QosLevel::QOS_BACKGROUND; #ifdef SUPPORT_POWER_MANAGER sptr syncCallback_ = nullptr; PowerMgr::ShutdownClient &shutdownClient_ = PowerMgr::ShutdownClient::GetInstance(); diff --git a/test/unittest/media_server_manager_unittest/mock/recorder_service_stub.h b/test/unittest/media_server_manager_unittest/mock/recorder_service_stub.h index a4df2eccf..42fd1c563 100644 --- a/test/unittest/media_server_manager_unittest/mock/recorder_service_stub.h +++ b/test/unittest/media_server_manager_unittest/mock/recorder_service_stub.h @@ -90,6 +90,7 @@ public: MOCK_METHOD(int32_t, SetWatermark, (std::shared_ptr &waterMarkBuffer), (override)); MOCK_METHOD(int32_t, SetUserMeta, (const std::shared_ptr &userMeta), (override)); MOCK_METHOD(int32_t, SetWillMuteWhenInterrupted, (bool muteWhenInterrupted), (override)); + MOCK_METHOD(int32_t, TransmitQos, (QOS::QosLevel level), (override)); MOCK_METHOD(int32_t, DoIpcAbnormality, (), (override)); MOCK_METHOD(int32_t, DoIpcRecovery, (bool fromMonitor), (override)); MOCK_METHOD(int32_t, SetListenerObjectInner, (MessageParcel &data, MessageParcel &reply)); -- Gitee From cb4eb2d22c49daf5e265aed39ef70e479cd21a12 Mon Sep 17 00:00:00 2001 From: zuotao Date: Sat, 26 Jul 2025 19:15:58 +0800 Subject: [PATCH 2/6] update priority Signed-off-by: zuotao --- frameworks/js/avrecorder/avrecorder_napi.cpp | 2 +- services/services/recorder/client/recorder_client.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/js/avrecorder/avrecorder_napi.cpp b/frameworks/js/avrecorder/avrecorder_napi.cpp index 7bd472db9..0b54f3868 100644 --- a/frameworks/js/avrecorder/avrecorder_napi.cpp +++ b/frameworks/js/avrecorder/avrecorder_napi.cpp @@ -268,7 +268,7 @@ napi_value AVRecorderNapi::JsPrepare(napi_env env, napi_callback_info info) if (asyncCtx->napi->GetConfig(asyncCtx, env, args[0]) == MSERR_OK) { QOS::QosLevel level; GetThreadQos(level); - MEDIA_LOGI("GetThreadQos %{public}d", (int32_t)level); + MEDIA_LOGI("GetThreadQos %{public}d", static_cast(level)); if (level == QOS::QosLevel::QOS_USER_INTERACTIVE) { asyncCtx->napi->taskQue_->SetQos(level); } diff --git a/services/services/recorder/client/recorder_client.cpp b/services/services/recorder/client/recorder_client.cpp index de7848770..4c9415370 100644 --- a/services/services/recorder/client/recorder_client.cpp +++ b/services/services/recorder/client/recorder_client.cpp @@ -42,7 +42,7 @@ RecorderClient::RecorderClient(const sptr &ipcProxy) MEDIA_LOGD("0x%{public}06" PRIXPTR " Instances create", FAKE_POINTER(this)); QOS::QosLevel level; GetThreadQos(level); - MEDIA_LOGI("GetThreadQos %{public}d", (int32_t)level); + MEDIA_LOGI("GetThreadQos %{public}d", static_cast(level)); if (level == QOS::QosLevel::QOS_USER_INTERACTIVE) { recorderProxy_->TransmitQos(level); } -- Gitee From 18cc1b8dae173b877b04b4d383174608df790687 Mon Sep 17 00:00:00 2001 From: zuotao Date: Mon, 28 Jul 2025 18:34:49 +0800 Subject: [PATCH 3/6] update priority Signed-off-by: zuotao --- services/services/recorder/ipc/recorder_service_proxy.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/services/services/recorder/ipc/recorder_service_proxy.cpp b/services/services/recorder/ipc/recorder_service_proxy.cpp index 22deec294..8e58d32bc 100644 --- a/services/services/recorder/ipc/recorder_service_proxy.cpp +++ b/services/services/recorder/ipc/recorder_service_proxy.cpp @@ -17,7 +17,6 @@ #include "recorder_listener_stub.h" #include "media_log.h" #include "media_errors.h" -#include "qos.h" namespace { constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, LOG_DOMAIN_RECORDER, "RecorderServiceProxy"}; -- Gitee From 1cac48708ea9ea6be5b141fed3737b2aab5cdb1c Mon Sep 17 00:00:00 2001 From: zuotao Date: Wed, 30 Jul 2025 09:24:38 +0800 Subject: [PATCH 4/6] update priority Signed-off-by: zuotao --- services/services/recorder/server/recorder_server.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/services/services/recorder/server/recorder_server.cpp b/services/services/recorder/server/recorder_server.cpp index 7f02ae81a..ebf78ba90 100644 --- a/services/services/recorder/server/recorder_server.cpp +++ b/services/services/recorder/server/recorder_server.cpp @@ -1195,13 +1195,12 @@ int32_t RecorderServer::TransmitQos(QOS::QosLevel level) { MEDIA_LOGI("TransmitQos in"); std::lock_guard lock(mutex_); - MEDIA_LOGI("TransmitQos %{public}d", (int32_t)level); + MEDIA_LOGI("TransmitQos %{public}d", static_cast(level)); clientQos_ = level; auto task = std::make_shared>([&, this] { - MEDIA_LOGI("clientQos_ %{public}d", (int32_t)clientQos_); + MEDIA_LOGI("clientQos_ %{public}d", static_cast(clientQos_)); if (clientQos_ == QOS::QosLevel::QOS_USER_INTERACTIVE) { - MEDIA_LOGI("RES_TYPE_THREAD_QOS_CHANGE"); std::unordered_map mapPayload; mapPayload["bundleName"] = "media_service"; mapPayload["pid"] = std::to_string(getpid()); -- Gitee From 4f018d4101826b50964e1be1a005d69f9def3f35 Mon Sep 17 00:00:00 2001 From: zuotao Date: Sat, 2 Aug 2025 17:34:50 +0800 Subject: [PATCH 5/6] update priority Signed-off-by: zuotao --- .../recorder/server/recorder_server.cpp | 10 ++++------ .../include/recorder_server_mock.h | 1 + .../src/recorder_server_mock.cpp | 6 ++++++ .../src/recorder_server_unit_test.cpp | 20 +++++++++++++++++++ 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/services/services/recorder/server/recorder_server.cpp b/services/services/recorder/server/recorder_server.cpp index ebf78ba90..7dacfa70a 100644 --- a/services/services/recorder/server/recorder_server.cpp +++ b/services/services/recorder/server/recorder_server.cpp @@ -38,9 +38,10 @@ namespace { constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, LOG_DOMAIN_RECORDER, "RecorderServer"}; - constexpr uint32_t THREAD_PRIORITY_41 = 7; + constexpr uint32_t THREAD_PRIORITY_41 = 7; // evevate priority for avRecorder constexpr uint32_t RES_TYPE = OHOS::ResourceSchedule::ResType::RES_TYPE_THREAD_QOS_CHANGE; constexpr int64_t RES_VALUE = 0; + const std::string PAYLOAD_BUNDLE_NAME_VAL = "media_service"; const std::map RECORDER_STATE_MAP = { {OHOS::Media::RecorderServer::REC_INITIALIZED, "initialized"}, {OHOS::Media::RecorderServer::REC_CONFIGURED, "configured"}, @@ -1193,16 +1194,13 @@ int32_t RecorderServer::SetUserMeta(const std::shared_ptr &userMeta) int32_t RecorderServer::TransmitQos(QOS::QosLevel level) { - MEDIA_LOGI("TransmitQos in"); + MEDIA_LOGI("TransmitQos in %{public}d", static_cast(level)); std::lock_guard lock(mutex_); - MEDIA_LOGI("TransmitQos %{public}d", static_cast(level)); clientQos_ = level; - auto task = std::make_shared>([&, this] { - MEDIA_LOGI("clientQos_ %{public}d", static_cast(clientQos_)); if (clientQos_ == QOS::QosLevel::QOS_USER_INTERACTIVE) { std::unordered_map mapPayload; - mapPayload["bundleName"] = "media_service"; + mapPayload["bundleName"] = PAYLOAD_BUNDLE_NAME_VAL; mapPayload["pid"] = std::to_string(getpid()); mapPayload[std::to_string(gettid())] = std::to_string(THREAD_PRIORITY_41); OHOS::ResourceSchedule::ResSchedClient::GetInstance().ReportData(RES_TYPE, RES_VALUE, mapPayload); diff --git a/test/unittest/recorder_test/recorder_server_unittest/include/recorder_server_mock.h b/test/unittest/recorder_test/recorder_server_unittest/include/recorder_server_mock.h index e6dcb1411..1fe7b53d8 100644 --- a/test/unittest/recorder_test/recorder_server_unittest/include/recorder_server_mock.h +++ b/test/unittest/recorder_test/recorder_server_unittest/include/recorder_server_mock.h @@ -147,6 +147,7 @@ public: int32_t Release(); int32_t SetFileSplitDuration(FileSplitType type, int64_t timestamp, uint32_t duration); int32_t SetParameter(int32_t sourceId, const Format &format); + int32_t TransmitQos(QOS::QosLevel level); int32_t RequesetBuffer(const std::string &recorderType, RecorderTestParam::VideoRecorderConfig &recorderConfig); void StopBuffer(const std::string &recorderType); void HDICreateESBuffer(); diff --git a/test/unittest/recorder_test/recorder_server_unittest/src/recorder_server_mock.cpp b/test/unittest/recorder_test/recorder_server_unittest/src/recorder_server_mock.cpp index 21ca3b829..0ae31399b 100644 --- a/test/unittest/recorder_test/recorder_server_unittest/src/recorder_server_mock.cpp +++ b/test/unittest/recorder_test/recorder_server_unittest/src/recorder_server_mock.cpp @@ -314,6 +314,12 @@ int32_t RecorderServerMock::SetParameter(int32_t sourceId, const Format &format) return recorder_->SetParameter(sourceId, format); } +int32_t RecorderServerMock::TransmitQos(QOS::QosLevel level) +{ + UNITTEST_CHECK_AND_RETURN_RET_LOG(recorder_ != nullptr, MSERR_INVALID_OPERATION, "recorder_ == nullptr"); + return recorder_->TransmitQos(level); +} + int32_t RecorderServerMock::RequesetBuffer(const std::string &recorderType, VideoRecorderConfig &recorderConfig) { UNITTEST_CHECK_AND_RETURN_RET_LOG(recorder_ != nullptr, MSERR_INVALID_OPERATION, "recorder_ == nullptr"); diff --git a/test/unittest/recorder_test/recorder_server_unittest/src/recorder_server_unit_test.cpp b/test/unittest/recorder_test/recorder_server_unittest/src/recorder_server_unit_test.cpp index 36313e1de..4b11886ff 100644 --- a/test/unittest/recorder_test/recorder_server_unittest/src/recorder_server_unit_test.cpp +++ b/test/unittest/recorder_test/recorder_server_unittest/src/recorder_server_unit_test.cpp @@ -861,6 +861,26 @@ HWTEST_F(RecorderServerUnitTest, recorder_configure_022, TestSize.Level2) EXPECT_EQ(MSERR_OK, recorderServer_->Release()); } + +/** + * @tc.name: recorder_configure_023 + * @tc.desc: evevate priority for avRecorder TransmitQos + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(RecorderServerUnitTest, recorder_configure_023, TestSize.Level2) +{ + EXPECT_NE(MSERR_OK, recorderServer_->TransmitQos(QOS::QosLevel::QOS_USER_INTERACTIVE)); + EXPECT_NE(MSERR_OK, recorderServer_->Prepare()); + EXPECT_NE(MSERR_OK, recorderServer_->Start()); + sleep(RECORDER_TIME); + EXPECT_NE(MSERR_OK, recorderServer_->Pause()); + EXPECT_NE(MSERR_OK, recorderServer_->Resume()); + EXPECT_NE(MSERR_OK, recorderServer_->Stop(false)); + EXPECT_EQ(MSERR_OK, recorderServer_->Reset()); + EXPECT_EQ(MSERR_OK, recorderServer_->Release()); +} + /** * @tc.name: recorder_mp3_001 * @tc.desc: record mp3 -- Gitee From d8ff8e9cc9d243b273574f4fd6dd5c9d97ccd737 Mon Sep 17 00:00:00 2001 From: zuotao Date: Mon, 4 Aug 2025 14:44:15 +0800 Subject: [PATCH 6/6] update priority Signed-off-by: zuotao --- .../recorder_server_unittest/src/recorder_server_unit_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unittest/recorder_test/recorder_server_unittest/src/recorder_server_unit_test.cpp b/test/unittest/recorder_test/recorder_server_unittest/src/recorder_server_unit_test.cpp index 4b11886ff..54e7f3344 100644 --- a/test/unittest/recorder_test/recorder_server_unittest/src/recorder_server_unit_test.cpp +++ b/test/unittest/recorder_test/recorder_server_unittest/src/recorder_server_unit_test.cpp @@ -864,7 +864,7 @@ HWTEST_F(RecorderServerUnitTest, recorder_configure_022, TestSize.Level2) /** * @tc.name: recorder_configure_023 - * @tc.desc: evevate priority for avRecorder TransmitQos + * @tc.desc: evevate priority for avRecorder TransmitQos * @tc.type: FUNC * @tc.require: */ -- Gitee