From 5ae61b69b6a75fc854f0e30b79d396777b558465 Mon Sep 17 00:00:00 2001 From: zpf Date: Thu, 28 Aug 2025 19:45:46 +0800 Subject: [PATCH 1/7] =?UTF-8?q?lpp=20pts=20=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zpf --- .../lppplayer/native_lpp_video_streamer.cpp | 12 ++++++++++ .../video_streamer_impl.cpp | 10 ++++++++ .../lpp_video_streamer/video_streamer_impl.h | 2 ++ .../inner_api/native/lpp_video_streamer.h | 2 ++ interfaces/kits/c/lowpower_video_sink.h | 14 +++++++++++ .../lpp/lpp_sync_manager/lpp_sync_manager.h | 1 + .../lpp_sync_manager_adapter.h | 2 ++ .../lpp_sync_manager/src/lpp_sync_manager.cpp | 10 ++++++++ .../src/lpp_sync_manager_adapter.cpp | 8 +++++++ .../lpp_video_streamer/hilpp_vstreamer_impl.h | 1 + .../src/hilpp_vstreamer_impl.cpp | 7 ++++++ .../include/i_lpp_video_streamer_service.h | 2 ++ .../services/engine_intf/i_lpp_sync_manager.h | 1 + .../engine_intf/i_lpp_video_streamer.h | 1 + .../client/lpp_video_streamer_client.cpp | 10 ++++++++ .../client/lpp_video_streamer_client.h | 2 ++ .../i_standard_lpp_video_streamer_service.h | 3 +++ .../ipc/lpp_video_streamer_service_proxy.cpp | 19 +++++++++++++++ .../ipc/lpp_video_streamer_service_proxy.h | 2 ++ .../ipc/lpp_video_streamer_service_stub.cpp | 23 +++++++++++++++++++ .../ipc/lpp_video_streamer_service_stub.h | 3 +++ .../server/lpp_video_streamer_server.cpp | 9 ++++++++ .../server/lpp_video_streamer_server.h | 2 ++ .../mock/i_lpp_sync_manager.h | 1 + .../mock/hilpp_vstreamer_impl.h | 1 + .../mock/lpp_sync_manager.h | 1 + .../mock/lpp_sync_manager_adapter.h | 1 + .../mock/v1_0/ilpp_sync_manager_adapter.h | 1 + .../mock/lpp_sync_manager.h | 2 +- .../mock/lpp_sync_manager_adapter.h | 1 + .../mock/lpp_sync_manager.h | 1 + 31 files changed, 154 insertions(+), 1 deletion(-) diff --git a/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp b/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp index 2147b2427..5ed1622b2 100644 --- a/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp +++ b/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp @@ -634,6 +634,7 @@ OH_AVErrCode OH_LowPowerVideoSinkCallback_SetStreamChangedListener( int32_t res = callback->SetStreamChangedListener(onStreamChanged, userData); return LppMsErrToOHAvErr(res); } + OH_AVErrCode OH_LowPowerVideoSinkCallback_SetFirstFrameDecodedListener(OH_LowPowerVideoSinkCallback *callback, OH_LowPowerVideoSink_OnFirstFrameDecoded onFirstFrameDecoded, void *userData) { @@ -643,3 +644,14 @@ OH_AVErrCode OH_LowPowerVideoSinkCallback_SetFirstFrameDecodedListener(OH_LowPow int32_t res = callback->SetFirstFrameReadyListener(onFirstFrameDecoded, userData); return LppMsErrToOHAvErr(res); } + +OH_AVErrCode OH_LowPowerVideoSink_GetLatestPts(OH_LowPowerVideoSink *streamer, int64_t *pts) +{ + MEDIA_LOGD("OH_LowPowerVideoSink_GetLatestPts"); + CHECK_AND_RETURN_RET_LOG(streamer != nullptr, AV_ERR_INVALID_VAL, "streamer is nullptr!"); + LowPowerVideoSinkObject *streamerObj = reinterpret_cast(streamer); + CHECK_AND_RETURN_RET_LOG(streamerObj != nullptr, AV_ERR_INVALID_VAL, "streamerObj is nullptr"); + CHECK_AND_RETURN_RET_LOG(streamerObj->videoStreamer_ != nullptr, AV_ERR_INVALID_VAL, "videoStreamer_ is nullptr"); + int32_t res = streamerObj->videoStreamer_->GetLatestPts(*pts); + return LppMsErrToOHAvErr(res); +} diff --git a/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp b/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp index f7adadd72..51fe34318 100644 --- a/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp +++ b/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp @@ -262,5 +262,15 @@ std::string VideoStreamerImpl::GetStreamerId() CHECK_AND_RETURN_RET_LOG(streamerService_ != nullptr, "", "player service does not exist.."); return streamerService_->GetStreamerId(); } + +int32_t VideoStreamerImpl::GetLatestPts(int64_t &pts) +{ + MEDIA_LOGI("VideoStreamerImpl GetLatestPts"); + CHECK_AND_RETURN_RET_LOG(streamerService_ != nullptr, MSERR_SERVICE_DIED, + "GetLatestPts player service does not exist.."); + int32_t ret = streamerService_->GetLatestPts(pts); + pts = (ret == MSERR_OK) ? pts : 0; + return ret; +} } // namespace Media } // namespace OHOS diff --git a/frameworks/native/lpp_video_streamer/video_streamer_impl.h b/frameworks/native/lpp_video_streamer/video_streamer_impl.h index 16015c442..1a0b1e3e9 100644 --- a/frameworks/native/lpp_video_streamer/video_streamer_impl.h +++ b/frameworks/native/lpp_video_streamer/video_streamer_impl.h @@ -76,6 +76,8 @@ public: std::string GetStreamerId() override; + int32_t GetLatestPts(int64_t &pts) override; + private: std::shared_ptr callback_; std::shared_ptr streamerService_ = nullptr; diff --git a/interfaces/inner_api/native/lpp_video_streamer.h b/interfaces/inner_api/native/lpp_video_streamer.h index d29cd78a0..34de7d154 100644 --- a/interfaces/inner_api/native/lpp_video_streamer.h +++ b/interfaces/inner_api/native/lpp_video_streamer.h @@ -103,6 +103,8 @@ public: virtual int32_t RenderFirstFrame() = 0; virtual std::string GetStreamerId() = 0; + + virtual int32_t GetLatestPts(int64_t &pts) = 0; }; class __attribute__((visibility("default"))) VideoStreamerFactory { diff --git a/interfaces/kits/c/lowpower_video_sink.h b/interfaces/kits/c/lowpower_video_sink.h index d1c11f7e3..f74db9821 100644 --- a/interfaces/kits/c/lowpower_video_sink.h +++ b/interfaces/kits/c/lowpower_video_sink.h @@ -314,6 +314,20 @@ OH_AVErrCode OH_LowPowerVideoSink_SetTargetStartFrame( const int64_t timeoutMs, void* userData); +/** + * @brief Get the latest presentation timestamp (PTS) from lowpower video sink. + * + * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance. + * @param {int64_t*} pts Pointer to store the latest PTS value (in microseconds). + * @return Returns AV_ERR_OK if the timestamp is obtained successfully; + * otherwise, returns a specific error code as defined in {@link OH_AVErrCode}: + * {@link AV_ERR_INVALID_VAL} the sink is nullptr, or sink is invalid. + * {@link AV_ERR_SERVICE_DIED} media service is died. + * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted. + * @since 21 + */ +OH_AVErrCode OH_LowPowerVideoSink_GetLatestPts(OH_LowPowerVideoSink *streamer, int64_t *pts); + /** * @brief Set playback speed for the lowpower video sink * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h index 229bbb003..52029e9a6 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h +++ b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h @@ -50,6 +50,7 @@ public: int32_t SetTunnelId(uint64_t tunnelId) override; int32_t SetAudioIsLpp(bool isLpp) override; void SetEventReceiver(std::shared_ptr eventReceiver) override; + int32_t GetLatestPts(int64_t &pts) override; private: void ResetTimeAnchor(); diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h index c602d662d..a78c947e6 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h +++ b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h @@ -56,6 +56,8 @@ public: int32_t UnbindOutputBuffers(); int32_t GetShareBuffer(int32_t &fd); int32_t SetTunnelId(uint64_t tunnelId); + int32_t GetLatestPts(int64_t &pts); + void OnError(const int32_t errorCode, const std::string &errorMsg); void OnTargetArrived(const int64_t targetPts, const bool isTimeout); void OnRenderStarted(); diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp index c6b7cdf88..392286602 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp +++ b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp @@ -263,6 +263,16 @@ int32_t LppSyncManager::SetTunnelId(uint64_t tunnelId) return MSERR_OK; } +int32_t LppSyncManager::GetLatestPts(int64_t &pts) +{ + MEDIA_LOG_I("LppSyncManager::GetLatestPts"); + FALSE_RETURN_V_NOLOG(videoIsLpp_, MSERR_UNKNOWN); + FALSE_RETURN_V_MSG_E(adapter_ != nullptr, MSERR_INVALID_OPERATION, "adapter_ is nullptr"); + auto ret = adapter_->GetLatestPts(pts); + FALSE_RETURN_V_MSG_E(ret == MSERR_OK, ret, "adapter_ GetLatestPts failed"); + return MSERR_OK; +} + int32_t LppSyncManager::SetAudioIsLpp(bool isLpp) { audioIsLpp_ = isLpp; diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp index 87b1d5615..dc5aa9195 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp +++ b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp @@ -321,6 +321,14 @@ int32_t LppSyncManagerAdapter::SetTunnelId(uint64_t tunnelId) return MSERR_OK; } +int32_t LppSyncManagerAdapter::GetLatestPts(int64_t &pts) +{ + MediaTrace trace("LppSyncManagerAdapter::GetLatestPts"); + MEDIA_LOG_I("GetLatestPts enter"); + FALSE_RETURN_V_MSG_E(syncMgrAdapter_ != nullptr, MSERR_INVALID_OPERATION, "syncMgrAdapter_ is nullptr"); + return syncMgrAdapter_->GetLatestPts(pts); +} + void LppSyncManagerAdapter::SetEventReceiver(std::shared_ptr eventReceiver) { eventReceiver_ = eventReceiver; diff --git a/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h b/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h index f39780d21..dd95907cc 100644 --- a/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h +++ b/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h @@ -55,6 +55,7 @@ public: std::string GetStreamerId() override; std::shared_ptr GetLppSyncManager() override; int32_t RenderFirstFrame() override; + int32_t GetLatestPts(int64_t &pts) override; void OnEvent(const Event &event); private: diff --git a/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp b/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp index 8b4e6c0e6..4db33be9c 100644 --- a/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp +++ b/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp @@ -130,6 +130,13 @@ int32_t HiLppVideoStreamerImpl::SetParameter(const Format ¶m) return MSERR_OK; } +int32_t HiLppVideoStreamerImpl::GetLatestPts(int64_t &pts) +{ + MEDIA_LOG_I("HiLppVideoStreamerImpl::GetLatestPts"); + FALSE_RETURN_V_MSG(vdec_ != nullptr, MSERR_INVALID_OPERATION, "vdec_ nullptr"); + return syncMgr_->GetLatestPts(pts); +} + int32_t HiLppVideoStreamerImpl::Configure(const Format ¶m) { FALSE_RETURN_V_MSG(vdec_ != nullptr, MSERR_INVALID_OPERATION, "vdec_ nullptr"); diff --git a/services/include/i_lpp_video_streamer_service.h b/services/include/i_lpp_video_streamer_service.h index ffdc2c52f..770d1470e 100644 --- a/services/include/i_lpp_video_streamer_service.h +++ b/services/include/i_lpp_video_streamer_service.h @@ -75,6 +75,8 @@ public: virtual std::string GetStreamerId() = 0; virtual int32_t RenderFirstFrame() = 0; + + virtual int32_t GetLatestPts(int64_t &pts) = 0; }; } // namespace Media } // namespace OHOS diff --git a/services/services/engine_intf/i_lpp_sync_manager.h b/services/services/engine_intf/i_lpp_sync_manager.h index 2edba8cee..38f9bf540 100644 --- a/services/services/engine_intf/i_lpp_sync_manager.h +++ b/services/services/engine_intf/i_lpp_sync_manager.h @@ -50,6 +50,7 @@ public: virtual int32_t SetTunnelId(uint64_t tunnelId) = 0; virtual int32_t SetAudioIsLpp(bool isLpp) = 0; virtual void SetEventReceiver(std::shared_ptr eventReceiver) = 0; + virtual int32_t GetLatestPts(int64_t &pts) = 0; }; } diff --git a/services/services/engine_intf/i_lpp_video_streamer.h b/services/services/engine_intf/i_lpp_video_streamer.h index 507230511..c411b1c94 100644 --- a/services/services/engine_intf/i_lpp_video_streamer.h +++ b/services/services/engine_intf/i_lpp_video_streamer.h @@ -66,6 +66,7 @@ public: virtual std::string GetStreamerId() = 0; virtual std::shared_ptr GetLppSyncManager() = 0; virtual int32_t RenderFirstFrame() = 0; + virtual int32_t GetLatestPts(int64_t &pts) = 0; }; } // namespace Media } // namespace OHOS diff --git a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp index 952fda07b..c1be4ec34 100644 --- a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp +++ b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp @@ -243,5 +243,15 @@ void LppVideoStreamerClient::MediaServerDied() "mediaserver is died, please create a new video sink instance again"); } } + +int32_t LppVideoStreamerClient::GetLatestPts(int64_t &pts) +{ + MEDIA_LOGI("LppVideoStreamerClient GetLatestPts"); + CHECK_AND_RETURN_RET_LOG(playerProxy_ != nullptr, MSERR_SERVICE_DIED, + "LppVideoStreamerClient GetLatestPts player service does not exist.."); + int32_t ret = playerProxy_->GetLatestPts(pts); + CHECK_AND_RETURN_RET_LOG(ret == MSERR_OK, ret, "LppVideoStreamerClient GetLatestPts failed."); + return MSERR_OK; +} } // namespace Media } // namespace OHOS \ No newline at end of file diff --git a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h index 7b5a6885d..325f8e4a1 100644 --- a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h +++ b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h @@ -76,6 +76,8 @@ public: int32_t RenderFirstFrame() override; + int32_t GetLatestPts(int64_t &pts) override; + void MediaServerDied(); private: diff --git a/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h b/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h index 32982afbf..c9928ef1d 100644 --- a/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h +++ b/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h @@ -80,6 +80,8 @@ public: virtual int32_t RenderFirstFrame() = 0; + virtual int32_t GetLatestPts(int64_t &pts) = 0; + /** * IPC code ID */ @@ -109,6 +111,7 @@ public: GET_STREAM_ID, SET_AUDIO_STREAMER_ID, RENDER_FIRST_FRAME, + GET_LATEST_PTS, MAX_IPC_ID, // all IPC codes should be added before MAX_IPC_ID }; diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp index c4556605e..898d65663 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp @@ -429,5 +429,24 @@ int32_t LppVideoStreamerServiceProxy::RenderFirstFrame() return reply.ReadInt32(); } +int32_t LppVideoStreamerServiceProxy::GetLatestPts(int64_t &pts) +{ + MEDIA_LOGI("LppVideoStreamerServiceProxy GetLatestPts"); + MessageParcel data; + MessageParcel reply; + MessageOption option; + + bool token = data.WriteInterfaceToken(LppVideoStreamerServiceProxy::GetDescriptor()); + CHECK_AND_RETURN_RET_LOG(token, MSERR_INVALID_OPERATION, "Failed to write descriptor!"); + + int32_t error = Remote()->SendRequest(GET_LATEST_PTS, data, reply, option); + CHECK_AND_RETURN_RET_LOG( + error == MSERR_OK, MSERR_INVALID_OPERATION, "GetLatestPts SendRequest failed, error: %{public}d", error); + int32_t ret = reply.ReadInt32(); + pts = reply.ReadInt64(); + CHECK_AND_RETURN_RET_LOG( + ret == MSERR_OK, MSERR_INVALID_OPERATION, "GetLatestPts failed, error: %{public}d", ret); + return ret; +} } // namespace Media } // namespace OHOS diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h index efc84e5a7..3ba478a87 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h @@ -74,6 +74,8 @@ public: std::string GetStreamerId() override; + int32_t GetLatestPts(int64_t &pts) override; + int32_t RenderFirstFrame() override; private: static inline BrokerDelegator delegator_; diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp index a3c2b2974..6d96233a6 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp @@ -136,6 +136,12 @@ void LppVideoStreamerServiceStub::FillPlayerFuncPart1() [this](MessageParcel &data, MessageParcel &reply) { return RenderFirstFrame(data, reply); }}; } +void LppVideoStreamerServiceStub::FillPlayerFuncPart2() +{ + playerFuncs_[GET_LATEST_PTS] = {"Player::GetLatestPts", + [this](MessageParcel &data, MessageParcel &reply) { return GetLatestPts(data, reply); }}; +} + int LppVideoStreamerServiceStub::OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { @@ -532,5 +538,22 @@ int32_t LppVideoStreamerServiceStub::RenderFirstFrame(MessageParcel &data, Messa return MSERR_OK; } +int32_t LppVideoStreamerServiceStub::GetLatestPts(int64_t &pts) +{ + MEDIA_LOGI("LppVideoStreamerServiceStub::GetLatestPts"); + CHECK_AND_RETURN_RET_LOG(lppVideoPlayerServer_ != nullptr, MSERR_INVALID_OPERATION, "player server is nullptr"); + return lppVideoPlayerServer_->GetLatestPts(pts); +} + +int32_t LppVideoStreamerServiceStub::GetLatestPts(MessageParcel &data, MessageParcel &reply) +{ + (void)data; + int64_t pts = 0; + int32_t ret = GetLatestPts(pts); + MEDIA_LOGI("LppVideoStreamerServiceStub::GetLatestPts %{public}d %{public}ld", ret, pts); + reply.WriteInt32(ret); + reply.WriteInt64(pts); + return MSERR_OK; +} } // namespace Media } // namespace OHOS diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h index eca927564..5ec967147 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h @@ -81,6 +81,8 @@ public: int32_t RenderFirstFrame() override; + int32_t GetLatestPts(int64_t &pts) override; + int32_t Init(); void SetPlayerFuncs(); void FillPlayerFuncPart1(); @@ -114,6 +116,7 @@ public: int32_t SetLppAudioStreamerId(MessageParcel &data, MessageParcel &reply); int32_t GetStreamerId(MessageParcel &data, MessageParcel &reply); int32_t RenderFirstFrame(MessageParcel &data, MessageParcel &reply); + int32_t GetLatestPts(MessageParcel &data, MessageParcel &reply); std::shared_ptr lppVideoPlayerServer_ = nullptr; std::map> playerFuncs_; diff --git a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp index 34462bbe3..0f7725305 100644 --- a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp +++ b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp @@ -287,6 +287,15 @@ int32_t LppVideoStreamerServer::SetLppVideoStreamerCallback(const std::shared_pt return MSERR_OK; } +int32_t LppVideoStreamerServer::GetLatestPts(int64_t &pts) +{ + MEDIA_LOGI("LppVideoStreamerServer GetLatestPts"); + CHECK_AND_RETURN_RET_LOG(streamerEngine_ != nullptr, MSERR_INVALID_OPERATION, "streamerEngine_ is nullptr"); + auto ret = streamerEngine_->GetLatestPts(pts); + CHECK_AND_RETURN_RET_LOG(ret == MSERR_OK, ret, "GetLatestPts Failed!"); + return ret; +} + int32_t LppVideoStreamerServer::SetLppAudioStreamerId(const std::string audioStreamId) { MEDIA_LOGI("LppVideoStreamerServer SetLppAudioStreamerId"); diff --git a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h index beec97728..0fbf7b171 100644 --- a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h +++ b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h @@ -94,6 +94,8 @@ public: int32_t RenderFirstFrame() override; + int32_t GetLatestPts(int64_t &pts) override; + void OnDataNeeded(const int32_t maxBufferSize, const int32_t maxFrameNum) override; bool OnAnchorUpdateNeeded(int64_t &anchorPts, int64_t &anchorClk) override; void OnError(const MediaServiceErrCode errCode, const std::string &errMsg) override; diff --git a/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h b/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h index 85e72ad28..d9be12241 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h @@ -49,6 +49,7 @@ public: MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp)); MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); + MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); }; } } diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h index 1b9af148f..ef4c7f54c 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h +++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h @@ -52,6 +52,7 @@ public: std::string GetStreamerId() override; std::shared_ptr GetLppSyncManager() override; int32_t RenderFirstFrame() override; + int32_t GetLatestPts(int64_t &pts) override; void OnEvent(const Event &event); private: diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h index 5cb2d3df5..dd07012bf 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h @@ -53,6 +53,7 @@ public: MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId), (override)); MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp), (override)); MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver), (override)); + MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts), (override)); }; } // namespace Media } // namespace OHOS diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h index 2736d4528..1c60df970 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h +++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h @@ -51,6 +51,7 @@ public: MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd)); MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); + MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); }; class LowPowerPlayerFactory { diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h index 9224148f3..22a35e594 100644 --- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h +++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h @@ -51,6 +51,7 @@ public: MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); MOCK_METHOD(int32_t, GetShareBuffer, (int& fd)); MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); + MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); }; } // V1_0 } // LowPowerPlayer diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h index 3f3755f5a..4084432ea 100644 --- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h @@ -49,7 +49,7 @@ public: int32_t SetTunnelId(uint64_t tunnelId); int32_t SetAudioIsLpp(bool isLpp); void SetEventReceiver(std::shared_ptr eventReceiver); - + int32_t GetLatestPts(int64_t &pts); private: void ResetTimeAnchor(); diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h index c9ea2f2e3..c8357cbb7 100644 --- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h +++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h @@ -52,6 +52,7 @@ public: MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd)); MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); + MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); }; class LowPowerPlayerFactory { diff --git a/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h index dbb510bf4..1fc7cde41 100644 --- a/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h @@ -52,6 +52,7 @@ public: MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId), (override)); MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp), (override)); MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver), (override)); + MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts), (override)); }; } // namespace Media } // namespace OHOS -- Gitee From b6b479bad84294c41f062197693c0c4c9848f5c4 Mon Sep 17 00:00:00 2001 From: zpf Date: Fri, 29 Aug 2025 09:43:04 +0000 Subject: [PATCH 2/7] =?UTF-8?q?Revert=20"lpp=20pts=20=E9=80=82=E9=85=8D"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 5ae61b69b6a75fc854f0e30b79d396777b558465. --- .../lppplayer/native_lpp_video_streamer.cpp | 12 ---------- .../video_streamer_impl.cpp | 10 -------- .../lpp_video_streamer/video_streamer_impl.h | 2 -- .../inner_api/native/lpp_video_streamer.h | 2 -- interfaces/kits/c/lowpower_video_sink.h | 14 ----------- .../lpp/lpp_sync_manager/lpp_sync_manager.h | 1 - .../lpp_sync_manager_adapter.h | 2 -- .../lpp_sync_manager/src/lpp_sync_manager.cpp | 10 -------- .../src/lpp_sync_manager_adapter.cpp | 8 ------- .../lpp_video_streamer/hilpp_vstreamer_impl.h | 1 - .../src/hilpp_vstreamer_impl.cpp | 7 ------ .../include/i_lpp_video_streamer_service.h | 2 -- .../services/engine_intf/i_lpp_sync_manager.h | 1 - .../engine_intf/i_lpp_video_streamer.h | 1 - .../client/lpp_video_streamer_client.cpp | 10 -------- .../client/lpp_video_streamer_client.h | 2 -- .../i_standard_lpp_video_streamer_service.h | 3 --- .../ipc/lpp_video_streamer_service_proxy.cpp | 19 --------------- .../ipc/lpp_video_streamer_service_proxy.h | 2 -- .../ipc/lpp_video_streamer_service_stub.cpp | 23 ------------------- .../ipc/lpp_video_streamer_service_stub.h | 3 --- .../server/lpp_video_streamer_server.cpp | 9 -------- .../server/lpp_video_streamer_server.h | 2 -- .../mock/i_lpp_sync_manager.h | 1 - .../mock/hilpp_vstreamer_impl.h | 1 - .../mock/lpp_sync_manager.h | 1 - .../mock/lpp_sync_manager_adapter.h | 1 - .../mock/v1_0/ilpp_sync_manager_adapter.h | 1 - .../mock/lpp_sync_manager.h | 2 +- .../mock/lpp_sync_manager_adapter.h | 1 - .../mock/lpp_sync_manager.h | 1 - 31 files changed, 1 insertion(+), 154 deletions(-) diff --git a/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp b/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp index 5ed1622b2..2147b2427 100644 --- a/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp +++ b/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp @@ -634,7 +634,6 @@ OH_AVErrCode OH_LowPowerVideoSinkCallback_SetStreamChangedListener( int32_t res = callback->SetStreamChangedListener(onStreamChanged, userData); return LppMsErrToOHAvErr(res); } - OH_AVErrCode OH_LowPowerVideoSinkCallback_SetFirstFrameDecodedListener(OH_LowPowerVideoSinkCallback *callback, OH_LowPowerVideoSink_OnFirstFrameDecoded onFirstFrameDecoded, void *userData) { @@ -644,14 +643,3 @@ OH_AVErrCode OH_LowPowerVideoSinkCallback_SetFirstFrameDecodedListener(OH_LowPow int32_t res = callback->SetFirstFrameReadyListener(onFirstFrameDecoded, userData); return LppMsErrToOHAvErr(res); } - -OH_AVErrCode OH_LowPowerVideoSink_GetLatestPts(OH_LowPowerVideoSink *streamer, int64_t *pts) -{ - MEDIA_LOGD("OH_LowPowerVideoSink_GetLatestPts"); - CHECK_AND_RETURN_RET_LOG(streamer != nullptr, AV_ERR_INVALID_VAL, "streamer is nullptr!"); - LowPowerVideoSinkObject *streamerObj = reinterpret_cast(streamer); - CHECK_AND_RETURN_RET_LOG(streamerObj != nullptr, AV_ERR_INVALID_VAL, "streamerObj is nullptr"); - CHECK_AND_RETURN_RET_LOG(streamerObj->videoStreamer_ != nullptr, AV_ERR_INVALID_VAL, "videoStreamer_ is nullptr"); - int32_t res = streamerObj->videoStreamer_->GetLatestPts(*pts); - return LppMsErrToOHAvErr(res); -} diff --git a/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp b/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp index 51fe34318..f7adadd72 100644 --- a/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp +++ b/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp @@ -262,15 +262,5 @@ std::string VideoStreamerImpl::GetStreamerId() CHECK_AND_RETURN_RET_LOG(streamerService_ != nullptr, "", "player service does not exist.."); return streamerService_->GetStreamerId(); } - -int32_t VideoStreamerImpl::GetLatestPts(int64_t &pts) -{ - MEDIA_LOGI("VideoStreamerImpl GetLatestPts"); - CHECK_AND_RETURN_RET_LOG(streamerService_ != nullptr, MSERR_SERVICE_DIED, - "GetLatestPts player service does not exist.."); - int32_t ret = streamerService_->GetLatestPts(pts); - pts = (ret == MSERR_OK) ? pts : 0; - return ret; -} } // namespace Media } // namespace OHOS diff --git a/frameworks/native/lpp_video_streamer/video_streamer_impl.h b/frameworks/native/lpp_video_streamer/video_streamer_impl.h index 1a0b1e3e9..16015c442 100644 --- a/frameworks/native/lpp_video_streamer/video_streamer_impl.h +++ b/frameworks/native/lpp_video_streamer/video_streamer_impl.h @@ -76,8 +76,6 @@ public: std::string GetStreamerId() override; - int32_t GetLatestPts(int64_t &pts) override; - private: std::shared_ptr callback_; std::shared_ptr streamerService_ = nullptr; diff --git a/interfaces/inner_api/native/lpp_video_streamer.h b/interfaces/inner_api/native/lpp_video_streamer.h index 34de7d154..d29cd78a0 100644 --- a/interfaces/inner_api/native/lpp_video_streamer.h +++ b/interfaces/inner_api/native/lpp_video_streamer.h @@ -103,8 +103,6 @@ public: virtual int32_t RenderFirstFrame() = 0; virtual std::string GetStreamerId() = 0; - - virtual int32_t GetLatestPts(int64_t &pts) = 0; }; class __attribute__((visibility("default"))) VideoStreamerFactory { diff --git a/interfaces/kits/c/lowpower_video_sink.h b/interfaces/kits/c/lowpower_video_sink.h index f74db9821..d1c11f7e3 100644 --- a/interfaces/kits/c/lowpower_video_sink.h +++ b/interfaces/kits/c/lowpower_video_sink.h @@ -314,20 +314,6 @@ OH_AVErrCode OH_LowPowerVideoSink_SetTargetStartFrame( const int64_t timeoutMs, void* userData); -/** - * @brief Get the latest presentation timestamp (PTS) from lowpower video sink. - * - * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance. - * @param {int64_t*} pts Pointer to store the latest PTS value (in microseconds). - * @return Returns AV_ERR_OK if the timestamp is obtained successfully; - * otherwise, returns a specific error code as defined in {@link OH_AVErrCode}: - * {@link AV_ERR_INVALID_VAL} the sink is nullptr, or sink is invalid. - * {@link AV_ERR_SERVICE_DIED} media service is died. - * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted. - * @since 21 - */ -OH_AVErrCode OH_LowPowerVideoSink_GetLatestPts(OH_LowPowerVideoSink *streamer, int64_t *pts); - /** * @brief Set playback speed for the lowpower video sink * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h index 52029e9a6..229bbb003 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h +++ b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h @@ -50,7 +50,6 @@ public: int32_t SetTunnelId(uint64_t tunnelId) override; int32_t SetAudioIsLpp(bool isLpp) override; void SetEventReceiver(std::shared_ptr eventReceiver) override; - int32_t GetLatestPts(int64_t &pts) override; private: void ResetTimeAnchor(); diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h index a78c947e6..c602d662d 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h +++ b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h @@ -56,8 +56,6 @@ public: int32_t UnbindOutputBuffers(); int32_t GetShareBuffer(int32_t &fd); int32_t SetTunnelId(uint64_t tunnelId); - int32_t GetLatestPts(int64_t &pts); - void OnError(const int32_t errorCode, const std::string &errorMsg); void OnTargetArrived(const int64_t targetPts, const bool isTimeout); void OnRenderStarted(); diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp index 392286602..c6b7cdf88 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp +++ b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp @@ -263,16 +263,6 @@ int32_t LppSyncManager::SetTunnelId(uint64_t tunnelId) return MSERR_OK; } -int32_t LppSyncManager::GetLatestPts(int64_t &pts) -{ - MEDIA_LOG_I("LppSyncManager::GetLatestPts"); - FALSE_RETURN_V_NOLOG(videoIsLpp_, MSERR_UNKNOWN); - FALSE_RETURN_V_MSG_E(adapter_ != nullptr, MSERR_INVALID_OPERATION, "adapter_ is nullptr"); - auto ret = adapter_->GetLatestPts(pts); - FALSE_RETURN_V_MSG_E(ret == MSERR_OK, ret, "adapter_ GetLatestPts failed"); - return MSERR_OK; -} - int32_t LppSyncManager::SetAudioIsLpp(bool isLpp) { audioIsLpp_ = isLpp; diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp index dc5aa9195..87b1d5615 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp +++ b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp @@ -321,14 +321,6 @@ int32_t LppSyncManagerAdapter::SetTunnelId(uint64_t tunnelId) return MSERR_OK; } -int32_t LppSyncManagerAdapter::GetLatestPts(int64_t &pts) -{ - MediaTrace trace("LppSyncManagerAdapter::GetLatestPts"); - MEDIA_LOG_I("GetLatestPts enter"); - FALSE_RETURN_V_MSG_E(syncMgrAdapter_ != nullptr, MSERR_INVALID_OPERATION, "syncMgrAdapter_ is nullptr"); - return syncMgrAdapter_->GetLatestPts(pts); -} - void LppSyncManagerAdapter::SetEventReceiver(std::shared_ptr eventReceiver) { eventReceiver_ = eventReceiver; diff --git a/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h b/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h index dd95907cc..f39780d21 100644 --- a/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h +++ b/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h @@ -55,7 +55,6 @@ public: std::string GetStreamerId() override; std::shared_ptr GetLppSyncManager() override; int32_t RenderFirstFrame() override; - int32_t GetLatestPts(int64_t &pts) override; void OnEvent(const Event &event); private: diff --git a/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp b/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp index 4db33be9c..8b4e6c0e6 100644 --- a/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp +++ b/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp @@ -130,13 +130,6 @@ int32_t HiLppVideoStreamerImpl::SetParameter(const Format ¶m) return MSERR_OK; } -int32_t HiLppVideoStreamerImpl::GetLatestPts(int64_t &pts) -{ - MEDIA_LOG_I("HiLppVideoStreamerImpl::GetLatestPts"); - FALSE_RETURN_V_MSG(vdec_ != nullptr, MSERR_INVALID_OPERATION, "vdec_ nullptr"); - return syncMgr_->GetLatestPts(pts); -} - int32_t HiLppVideoStreamerImpl::Configure(const Format ¶m) { FALSE_RETURN_V_MSG(vdec_ != nullptr, MSERR_INVALID_OPERATION, "vdec_ nullptr"); diff --git a/services/include/i_lpp_video_streamer_service.h b/services/include/i_lpp_video_streamer_service.h index 770d1470e..ffdc2c52f 100644 --- a/services/include/i_lpp_video_streamer_service.h +++ b/services/include/i_lpp_video_streamer_service.h @@ -75,8 +75,6 @@ public: virtual std::string GetStreamerId() = 0; virtual int32_t RenderFirstFrame() = 0; - - virtual int32_t GetLatestPts(int64_t &pts) = 0; }; } // namespace Media } // namespace OHOS diff --git a/services/services/engine_intf/i_lpp_sync_manager.h b/services/services/engine_intf/i_lpp_sync_manager.h index 38f9bf540..2edba8cee 100644 --- a/services/services/engine_intf/i_lpp_sync_manager.h +++ b/services/services/engine_intf/i_lpp_sync_manager.h @@ -50,7 +50,6 @@ public: virtual int32_t SetTunnelId(uint64_t tunnelId) = 0; virtual int32_t SetAudioIsLpp(bool isLpp) = 0; virtual void SetEventReceiver(std::shared_ptr eventReceiver) = 0; - virtual int32_t GetLatestPts(int64_t &pts) = 0; }; } diff --git a/services/services/engine_intf/i_lpp_video_streamer.h b/services/services/engine_intf/i_lpp_video_streamer.h index c411b1c94..507230511 100644 --- a/services/services/engine_intf/i_lpp_video_streamer.h +++ b/services/services/engine_intf/i_lpp_video_streamer.h @@ -66,7 +66,6 @@ public: virtual std::string GetStreamerId() = 0; virtual std::shared_ptr GetLppSyncManager() = 0; virtual int32_t RenderFirstFrame() = 0; - virtual int32_t GetLatestPts(int64_t &pts) = 0; }; } // namespace Media } // namespace OHOS diff --git a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp index c1be4ec34..952fda07b 100644 --- a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp +++ b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp @@ -243,15 +243,5 @@ void LppVideoStreamerClient::MediaServerDied() "mediaserver is died, please create a new video sink instance again"); } } - -int32_t LppVideoStreamerClient::GetLatestPts(int64_t &pts) -{ - MEDIA_LOGI("LppVideoStreamerClient GetLatestPts"); - CHECK_AND_RETURN_RET_LOG(playerProxy_ != nullptr, MSERR_SERVICE_DIED, - "LppVideoStreamerClient GetLatestPts player service does not exist.."); - int32_t ret = playerProxy_->GetLatestPts(pts); - CHECK_AND_RETURN_RET_LOG(ret == MSERR_OK, ret, "LppVideoStreamerClient GetLatestPts failed."); - return MSERR_OK; -} } // namespace Media } // namespace OHOS \ No newline at end of file diff --git a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h index 325f8e4a1..7b5a6885d 100644 --- a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h +++ b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h @@ -76,8 +76,6 @@ public: int32_t RenderFirstFrame() override; - int32_t GetLatestPts(int64_t &pts) override; - void MediaServerDied(); private: diff --git a/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h b/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h index c9928ef1d..32982afbf 100644 --- a/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h +++ b/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h @@ -80,8 +80,6 @@ public: virtual int32_t RenderFirstFrame() = 0; - virtual int32_t GetLatestPts(int64_t &pts) = 0; - /** * IPC code ID */ @@ -111,7 +109,6 @@ public: GET_STREAM_ID, SET_AUDIO_STREAMER_ID, RENDER_FIRST_FRAME, - GET_LATEST_PTS, MAX_IPC_ID, // all IPC codes should be added before MAX_IPC_ID }; diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp index 898d65663..c4556605e 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp @@ -429,24 +429,5 @@ int32_t LppVideoStreamerServiceProxy::RenderFirstFrame() return reply.ReadInt32(); } -int32_t LppVideoStreamerServiceProxy::GetLatestPts(int64_t &pts) -{ - MEDIA_LOGI("LppVideoStreamerServiceProxy GetLatestPts"); - MessageParcel data; - MessageParcel reply; - MessageOption option; - - bool token = data.WriteInterfaceToken(LppVideoStreamerServiceProxy::GetDescriptor()); - CHECK_AND_RETURN_RET_LOG(token, MSERR_INVALID_OPERATION, "Failed to write descriptor!"); - - int32_t error = Remote()->SendRequest(GET_LATEST_PTS, data, reply, option); - CHECK_AND_RETURN_RET_LOG( - error == MSERR_OK, MSERR_INVALID_OPERATION, "GetLatestPts SendRequest failed, error: %{public}d", error); - int32_t ret = reply.ReadInt32(); - pts = reply.ReadInt64(); - CHECK_AND_RETURN_RET_LOG( - ret == MSERR_OK, MSERR_INVALID_OPERATION, "GetLatestPts failed, error: %{public}d", ret); - return ret; -} } // namespace Media } // namespace OHOS diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h index 3ba478a87..efc84e5a7 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h @@ -74,8 +74,6 @@ public: std::string GetStreamerId() override; - int32_t GetLatestPts(int64_t &pts) override; - int32_t RenderFirstFrame() override; private: static inline BrokerDelegator delegator_; diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp index 6d96233a6..a3c2b2974 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp @@ -136,12 +136,6 @@ void LppVideoStreamerServiceStub::FillPlayerFuncPart1() [this](MessageParcel &data, MessageParcel &reply) { return RenderFirstFrame(data, reply); }}; } -void LppVideoStreamerServiceStub::FillPlayerFuncPart2() -{ - playerFuncs_[GET_LATEST_PTS] = {"Player::GetLatestPts", - [this](MessageParcel &data, MessageParcel &reply) { return GetLatestPts(data, reply); }}; -} - int LppVideoStreamerServiceStub::OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { @@ -538,22 +532,5 @@ int32_t LppVideoStreamerServiceStub::RenderFirstFrame(MessageParcel &data, Messa return MSERR_OK; } -int32_t LppVideoStreamerServiceStub::GetLatestPts(int64_t &pts) -{ - MEDIA_LOGI("LppVideoStreamerServiceStub::GetLatestPts"); - CHECK_AND_RETURN_RET_LOG(lppVideoPlayerServer_ != nullptr, MSERR_INVALID_OPERATION, "player server is nullptr"); - return lppVideoPlayerServer_->GetLatestPts(pts); -} - -int32_t LppVideoStreamerServiceStub::GetLatestPts(MessageParcel &data, MessageParcel &reply) -{ - (void)data; - int64_t pts = 0; - int32_t ret = GetLatestPts(pts); - MEDIA_LOGI("LppVideoStreamerServiceStub::GetLatestPts %{public}d %{public}ld", ret, pts); - reply.WriteInt32(ret); - reply.WriteInt64(pts); - return MSERR_OK; -} } // namespace Media } // namespace OHOS diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h index 5ec967147..eca927564 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h @@ -81,8 +81,6 @@ public: int32_t RenderFirstFrame() override; - int32_t GetLatestPts(int64_t &pts) override; - int32_t Init(); void SetPlayerFuncs(); void FillPlayerFuncPart1(); @@ -116,7 +114,6 @@ public: int32_t SetLppAudioStreamerId(MessageParcel &data, MessageParcel &reply); int32_t GetStreamerId(MessageParcel &data, MessageParcel &reply); int32_t RenderFirstFrame(MessageParcel &data, MessageParcel &reply); - int32_t GetLatestPts(MessageParcel &data, MessageParcel &reply); std::shared_ptr lppVideoPlayerServer_ = nullptr; std::map> playerFuncs_; diff --git a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp index 0f7725305..34462bbe3 100644 --- a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp +++ b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp @@ -287,15 +287,6 @@ int32_t LppVideoStreamerServer::SetLppVideoStreamerCallback(const std::shared_pt return MSERR_OK; } -int32_t LppVideoStreamerServer::GetLatestPts(int64_t &pts) -{ - MEDIA_LOGI("LppVideoStreamerServer GetLatestPts"); - CHECK_AND_RETURN_RET_LOG(streamerEngine_ != nullptr, MSERR_INVALID_OPERATION, "streamerEngine_ is nullptr"); - auto ret = streamerEngine_->GetLatestPts(pts); - CHECK_AND_RETURN_RET_LOG(ret == MSERR_OK, ret, "GetLatestPts Failed!"); - return ret; -} - int32_t LppVideoStreamerServer::SetLppAudioStreamerId(const std::string audioStreamId) { MEDIA_LOGI("LppVideoStreamerServer SetLppAudioStreamerId"); diff --git a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h index 0fbf7b171..beec97728 100644 --- a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h +++ b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h @@ -94,8 +94,6 @@ public: int32_t RenderFirstFrame() override; - int32_t GetLatestPts(int64_t &pts) override; - void OnDataNeeded(const int32_t maxBufferSize, const int32_t maxFrameNum) override; bool OnAnchorUpdateNeeded(int64_t &anchorPts, int64_t &anchorClk) override; void OnError(const MediaServiceErrCode errCode, const std::string &errMsg) override; diff --git a/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h b/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h index d9be12241..85e72ad28 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h @@ -49,7 +49,6 @@ public: MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp)); MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); - MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); }; } } diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h index ef4c7f54c..1b9af148f 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h +++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h @@ -52,7 +52,6 @@ public: std::string GetStreamerId() override; std::shared_ptr GetLppSyncManager() override; int32_t RenderFirstFrame() override; - int32_t GetLatestPts(int64_t &pts) override; void OnEvent(const Event &event); private: diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h index dd07012bf..5cb2d3df5 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h @@ -53,7 +53,6 @@ public: MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId), (override)); MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp), (override)); MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver), (override)); - MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts), (override)); }; } // namespace Media } // namespace OHOS diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h index 1c60df970..2736d4528 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h +++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h @@ -51,7 +51,6 @@ public: MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd)); MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); - MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); }; class LowPowerPlayerFactory { diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h index 22a35e594..9224148f3 100644 --- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h +++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h @@ -51,7 +51,6 @@ public: MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); MOCK_METHOD(int32_t, GetShareBuffer, (int& fd)); MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); - MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); }; } // V1_0 } // LowPowerPlayer diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h index 4084432ea..3f3755f5a 100644 --- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h @@ -49,7 +49,7 @@ public: int32_t SetTunnelId(uint64_t tunnelId); int32_t SetAudioIsLpp(bool isLpp); void SetEventReceiver(std::shared_ptr eventReceiver); - int32_t GetLatestPts(int64_t &pts); + private: void ResetTimeAnchor(); diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h index c8357cbb7..c9ea2f2e3 100644 --- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h +++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h @@ -52,7 +52,6 @@ public: MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd)); MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); - MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); }; class LowPowerPlayerFactory { diff --git a/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h index 1fc7cde41..dbb510bf4 100644 --- a/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h @@ -52,7 +52,6 @@ public: MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId), (override)); MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp), (override)); MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver), (override)); - MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts), (override)); }; } // namespace Media } // namespace OHOS -- Gitee From 1bae4488bd8ac0f44e7f1f3b2d24ffa23587138a Mon Sep 17 00:00:00 2001 From: zpf Date: Fri, 29 Aug 2025 18:04:59 +0800 Subject: [PATCH 3/7] =?UTF-8?q?pts=20=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zpf --- .../lppplayer/native_lpp_video_streamer.cpp | 12 ++ .../video_streamer_impl.cpp | 10 + .../lpp_video_streamer/video_streamer_impl.h | 2 + .../inner_api/native/lpp_video_streamer.h | 2 + interfaces/kits/c/lowpower_video_sink.h | 14 ++ .../lpp/lpp_sync_manager/lpp_sync_manager.h | 1 + .../lpp_sync_manager_adapter.h | 2 + .../lpp_sync_manager/src/lpp_sync_manager.cpp | 10 + .../src/lpp_sync_manager_adapter.cpp | 8 + .../lpp_video_streamer/hilpp_vstreamer_impl.h | 1 + .../src/hilpp_vstreamer_impl.cpp | 7 + .../include/i_lpp_video_streamer_service.h | 2 + .../services/engine_intf/i_lpp_sync_manager.h | 1 + .../engine_intf/i_lpp_video_streamer.h | 1 + .../client/lpp_video_streamer_client.cpp | 10 + .../client/lpp_video_streamer_client.h | 2 + .../i_standard_lpp_video_streamer_service.h | 3 + .../ipc/lpp_video_streamer_service_proxy.cpp | 19 ++ .../ipc/lpp_video_streamer_service_proxy.h | 2 + .../ipc/lpp_video_streamer_service_stub.cpp | 24 +++ .../ipc/lpp_video_streamer_service_stub.h | 4 + .../server/lpp_video_streamer_server.cpp | 9 + .../server/lpp_video_streamer_server.h | 2 + .../mock/i_lpp_sync_manager.h | 109 +++++------ .../mock/hilpp_vstreamer_impl.h | 173 +++++++++--------- .../mock/lpp_sync_manager.h | 117 ++++++------ .../mock/lpp_sync_manager_adapter.h | 149 +++++++-------- .../mock/v1_0/ilpp_sync_manager_adapter.h | 117 ++++++------ .../mock/lpp_sync_manager.h | 140 +++++++------- .../mock/lpp_sync_manager_adapter.h | 153 ++++++++-------- .../mock/lpp_sync_manager.h | 115 ++++++------ 31 files changed, 688 insertions(+), 533 deletions(-) diff --git a/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp b/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp index 2147b2427..5ed1622b2 100644 --- a/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp +++ b/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp @@ -634,6 +634,7 @@ OH_AVErrCode OH_LowPowerVideoSinkCallback_SetStreamChangedListener( int32_t res = callback->SetStreamChangedListener(onStreamChanged, userData); return LppMsErrToOHAvErr(res); } + OH_AVErrCode OH_LowPowerVideoSinkCallback_SetFirstFrameDecodedListener(OH_LowPowerVideoSinkCallback *callback, OH_LowPowerVideoSink_OnFirstFrameDecoded onFirstFrameDecoded, void *userData) { @@ -643,3 +644,14 @@ OH_AVErrCode OH_LowPowerVideoSinkCallback_SetFirstFrameDecodedListener(OH_LowPow int32_t res = callback->SetFirstFrameReadyListener(onFirstFrameDecoded, userData); return LppMsErrToOHAvErr(res); } + +OH_AVErrCode OH_LowPowerVideoSink_GetLatestPts(OH_LowPowerVideoSink *streamer, int64_t *pts) +{ + MEDIA_LOGD("OH_LowPowerVideoSink_GetLatestPts"); + CHECK_AND_RETURN_RET_LOG(streamer != nullptr, AV_ERR_INVALID_VAL, "streamer is nullptr!"); + LowPowerVideoSinkObject *streamerObj = reinterpret_cast(streamer); + CHECK_AND_RETURN_RET_LOG(streamerObj != nullptr, AV_ERR_INVALID_VAL, "streamerObj is nullptr"); + CHECK_AND_RETURN_RET_LOG(streamerObj->videoStreamer_ != nullptr, AV_ERR_INVALID_VAL, "videoStreamer_ is nullptr"); + int32_t res = streamerObj->videoStreamer_->GetLatestPts(*pts); + return LppMsErrToOHAvErr(res); +} diff --git a/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp b/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp index f7adadd72..414b33325 100644 --- a/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp +++ b/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp @@ -262,5 +262,15 @@ std::string VideoStreamerImpl::GetStreamerId() CHECK_AND_RETURN_RET_LOG(streamerService_ != nullptr, "", "player service does not exist.."); return streamerService_->GetStreamerId(); } + +int32_t VideoStreamerImpl::GetLatestPts(int64_t &pts) +{ + MEDIA_LOGI("VideoStreamerImpl GetLatestPts"); + CHECK_AND_RETURN_RET_LOG(streamerService_ != nullptr, MSERR_SERVICE_DIED, + "GetLatestPts player service does not exist.."); + int32_t ret = streamerService_->GetLatestPts(pts); + pts = (ret == MSERR_OK) ? pts : 0; + return ret; +} } // namespace Media } // namespace OHOS diff --git a/frameworks/native/lpp_video_streamer/video_streamer_impl.h b/frameworks/native/lpp_video_streamer/video_streamer_impl.h index 16015c442..1a0b1e3e9 100644 --- a/frameworks/native/lpp_video_streamer/video_streamer_impl.h +++ b/frameworks/native/lpp_video_streamer/video_streamer_impl.h @@ -76,6 +76,8 @@ public: std::string GetStreamerId() override; + int32_t GetLatestPts(int64_t &pts) override; + private: std::shared_ptr callback_; std::shared_ptr streamerService_ = nullptr; diff --git a/interfaces/inner_api/native/lpp_video_streamer.h b/interfaces/inner_api/native/lpp_video_streamer.h index d29cd78a0..34de7d154 100644 --- a/interfaces/inner_api/native/lpp_video_streamer.h +++ b/interfaces/inner_api/native/lpp_video_streamer.h @@ -103,6 +103,8 @@ public: virtual int32_t RenderFirstFrame() = 0; virtual std::string GetStreamerId() = 0; + + virtual int32_t GetLatestPts(int64_t &pts) = 0; }; class __attribute__((visibility("default"))) VideoStreamerFactory { diff --git a/interfaces/kits/c/lowpower_video_sink.h b/interfaces/kits/c/lowpower_video_sink.h index d1c11f7e3..f74db9821 100644 --- a/interfaces/kits/c/lowpower_video_sink.h +++ b/interfaces/kits/c/lowpower_video_sink.h @@ -314,6 +314,20 @@ OH_AVErrCode OH_LowPowerVideoSink_SetTargetStartFrame( const int64_t timeoutMs, void* userData); +/** + * @brief Get the latest presentation timestamp (PTS) from lowpower video sink. + * + * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance. + * @param {int64_t*} pts Pointer to store the latest PTS value (in microseconds). + * @return Returns AV_ERR_OK if the timestamp is obtained successfully; + * otherwise, returns a specific error code as defined in {@link OH_AVErrCode}: + * {@link AV_ERR_INVALID_VAL} the sink is nullptr, or sink is invalid. + * {@link AV_ERR_SERVICE_DIED} media service is died. + * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted. + * @since 21 + */ +OH_AVErrCode OH_LowPowerVideoSink_GetLatestPts(OH_LowPowerVideoSink *streamer, int64_t *pts); + /** * @brief Set playback speed for the lowpower video sink * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h index 229bbb003..52029e9a6 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h +++ b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h @@ -50,6 +50,7 @@ public: int32_t SetTunnelId(uint64_t tunnelId) override; int32_t SetAudioIsLpp(bool isLpp) override; void SetEventReceiver(std::shared_ptr eventReceiver) override; + int32_t GetLatestPts(int64_t &pts) override; private: void ResetTimeAnchor(); diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h index c602d662d..a78c947e6 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h +++ b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h @@ -56,6 +56,8 @@ public: int32_t UnbindOutputBuffers(); int32_t GetShareBuffer(int32_t &fd); int32_t SetTunnelId(uint64_t tunnelId); + int32_t GetLatestPts(int64_t &pts); + void OnError(const int32_t errorCode, const std::string &errorMsg); void OnTargetArrived(const int64_t targetPts, const bool isTimeout); void OnRenderStarted(); diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp index c6b7cdf88..392286602 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp +++ b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp @@ -263,6 +263,16 @@ int32_t LppSyncManager::SetTunnelId(uint64_t tunnelId) return MSERR_OK; } +int32_t LppSyncManager::GetLatestPts(int64_t &pts) +{ + MEDIA_LOG_I("LppSyncManager::GetLatestPts"); + FALSE_RETURN_V_NOLOG(videoIsLpp_, MSERR_UNKNOWN); + FALSE_RETURN_V_MSG_E(adapter_ != nullptr, MSERR_INVALID_OPERATION, "adapter_ is nullptr"); + auto ret = adapter_->GetLatestPts(pts); + FALSE_RETURN_V_MSG_E(ret == MSERR_OK, ret, "adapter_ GetLatestPts failed"); + return MSERR_OK; +} + int32_t LppSyncManager::SetAudioIsLpp(bool isLpp) { audioIsLpp_ = isLpp; diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp index 87b1d5615..dc5aa9195 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp +++ b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp @@ -321,6 +321,14 @@ int32_t LppSyncManagerAdapter::SetTunnelId(uint64_t tunnelId) return MSERR_OK; } +int32_t LppSyncManagerAdapter::GetLatestPts(int64_t &pts) +{ + MediaTrace trace("LppSyncManagerAdapter::GetLatestPts"); + MEDIA_LOG_I("GetLatestPts enter"); + FALSE_RETURN_V_MSG_E(syncMgrAdapter_ != nullptr, MSERR_INVALID_OPERATION, "syncMgrAdapter_ is nullptr"); + return syncMgrAdapter_->GetLatestPts(pts); +} + void LppSyncManagerAdapter::SetEventReceiver(std::shared_ptr eventReceiver) { eventReceiver_ = eventReceiver; diff --git a/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h b/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h index f39780d21..dd95907cc 100644 --- a/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h +++ b/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h @@ -55,6 +55,7 @@ public: std::string GetStreamerId() override; std::shared_ptr GetLppSyncManager() override; int32_t RenderFirstFrame() override; + int32_t GetLatestPts(int64_t &pts) override; void OnEvent(const Event &event); private: diff --git a/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp b/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp index 8b4e6c0e6..4db33be9c 100644 --- a/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp +++ b/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp @@ -130,6 +130,13 @@ int32_t HiLppVideoStreamerImpl::SetParameter(const Format ¶m) return MSERR_OK; } +int32_t HiLppVideoStreamerImpl::GetLatestPts(int64_t &pts) +{ + MEDIA_LOG_I("HiLppVideoStreamerImpl::GetLatestPts"); + FALSE_RETURN_V_MSG(vdec_ != nullptr, MSERR_INVALID_OPERATION, "vdec_ nullptr"); + return syncMgr_->GetLatestPts(pts); +} + int32_t HiLppVideoStreamerImpl::Configure(const Format ¶m) { FALSE_RETURN_V_MSG(vdec_ != nullptr, MSERR_INVALID_OPERATION, "vdec_ nullptr"); diff --git a/services/include/i_lpp_video_streamer_service.h b/services/include/i_lpp_video_streamer_service.h index ffdc2c52f..770d1470e 100644 --- a/services/include/i_lpp_video_streamer_service.h +++ b/services/include/i_lpp_video_streamer_service.h @@ -75,6 +75,8 @@ public: virtual std::string GetStreamerId() = 0; virtual int32_t RenderFirstFrame() = 0; + + virtual int32_t GetLatestPts(int64_t &pts) = 0; }; } // namespace Media } // namespace OHOS diff --git a/services/services/engine_intf/i_lpp_sync_manager.h b/services/services/engine_intf/i_lpp_sync_manager.h index 2edba8cee..38f9bf540 100644 --- a/services/services/engine_intf/i_lpp_sync_manager.h +++ b/services/services/engine_intf/i_lpp_sync_manager.h @@ -50,6 +50,7 @@ public: virtual int32_t SetTunnelId(uint64_t tunnelId) = 0; virtual int32_t SetAudioIsLpp(bool isLpp) = 0; virtual void SetEventReceiver(std::shared_ptr eventReceiver) = 0; + virtual int32_t GetLatestPts(int64_t &pts) = 0; }; } diff --git a/services/services/engine_intf/i_lpp_video_streamer.h b/services/services/engine_intf/i_lpp_video_streamer.h index 507230511..c411b1c94 100644 --- a/services/services/engine_intf/i_lpp_video_streamer.h +++ b/services/services/engine_intf/i_lpp_video_streamer.h @@ -66,6 +66,7 @@ public: virtual std::string GetStreamerId() = 0; virtual std::shared_ptr GetLppSyncManager() = 0; virtual int32_t RenderFirstFrame() = 0; + virtual int32_t GetLatestPts(int64_t &pts) = 0; }; } // namespace Media } // namespace OHOS diff --git a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp index 952fda07b..dae58d353 100644 --- a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp +++ b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp @@ -243,5 +243,15 @@ void LppVideoStreamerClient::MediaServerDied() "mediaserver is died, please create a new video sink instance again"); } } + +int32_t LppVideoStreamerClient::GetLatestPts(int64_t &pts) +{ + MEDIA_LOGI("LppVideoStreamerClient GetLatestPts"); + CHECK_AND_RETURN_RET_LOG(playerProxy_ != nullptr, MSERR_SERVICE_DIED, + "LppVideoStreamerClient GetLatestPts player service does not exist.."); + int32_t ret = playerProxy_->GetLatestPts(pts); + CHECK_AND_RETURN_RET_LOG(ret == MSERR_OK, ret, "LppVideoStreamerClient GetLatestPts failed."); + return MSERR_OK; +} } // namespace Media } // namespace OHOS \ No newline at end of file diff --git a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h index 7b5a6885d..325f8e4a1 100644 --- a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h +++ b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h @@ -76,6 +76,8 @@ public: int32_t RenderFirstFrame() override; + int32_t GetLatestPts(int64_t &pts) override; + void MediaServerDied(); private: diff --git a/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h b/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h index 32982afbf..c9928ef1d 100644 --- a/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h +++ b/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h @@ -80,6 +80,8 @@ public: virtual int32_t RenderFirstFrame() = 0; + virtual int32_t GetLatestPts(int64_t &pts) = 0; + /** * IPC code ID */ @@ -109,6 +111,7 @@ public: GET_STREAM_ID, SET_AUDIO_STREAMER_ID, RENDER_FIRST_FRAME, + GET_LATEST_PTS, MAX_IPC_ID, // all IPC codes should be added before MAX_IPC_ID }; diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp index c4556605e..898d65663 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp @@ -429,5 +429,24 @@ int32_t LppVideoStreamerServiceProxy::RenderFirstFrame() return reply.ReadInt32(); } +int32_t LppVideoStreamerServiceProxy::GetLatestPts(int64_t &pts) +{ + MEDIA_LOGI("LppVideoStreamerServiceProxy GetLatestPts"); + MessageParcel data; + MessageParcel reply; + MessageOption option; + + bool token = data.WriteInterfaceToken(LppVideoStreamerServiceProxy::GetDescriptor()); + CHECK_AND_RETURN_RET_LOG(token, MSERR_INVALID_OPERATION, "Failed to write descriptor!"); + + int32_t error = Remote()->SendRequest(GET_LATEST_PTS, data, reply, option); + CHECK_AND_RETURN_RET_LOG( + error == MSERR_OK, MSERR_INVALID_OPERATION, "GetLatestPts SendRequest failed, error: %{public}d", error); + int32_t ret = reply.ReadInt32(); + pts = reply.ReadInt64(); + CHECK_AND_RETURN_RET_LOG( + ret == MSERR_OK, MSERR_INVALID_OPERATION, "GetLatestPts failed, error: %{public}d", ret); + return ret; +} } // namespace Media } // namespace OHOS diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h index efc84e5a7..3ba478a87 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h @@ -74,6 +74,8 @@ public: std::string GetStreamerId() override; + int32_t GetLatestPts(int64_t &pts) override; + int32_t RenderFirstFrame() override; private: static inline BrokerDelegator delegator_; diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp index a3c2b2974..3c2caa459 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp @@ -82,6 +82,7 @@ int32_t LppVideoStreamerServiceStub::Init() void LppVideoStreamerServiceStub::SetPlayerFuncs() { FillPlayerFuncPart1(); + FillPlayerFuncPart2(); } void LppVideoStreamerServiceStub::FillPlayerFuncPart1() @@ -136,6 +137,12 @@ void LppVideoStreamerServiceStub::FillPlayerFuncPart1() [this](MessageParcel &data, MessageParcel &reply) { return RenderFirstFrame(data, reply); }}; } +void LppVideoStreamerServiceStub::FillPlayerFuncPart2() +{ + playerFuncs_[GET_LATEST_PTS] = {"Player::GetLatestPts", + [this](MessageParcel &data, MessageParcel &reply) { return GetLatestPts(data, reply); }}; +} + int LppVideoStreamerServiceStub::OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { @@ -532,5 +539,22 @@ int32_t LppVideoStreamerServiceStub::RenderFirstFrame(MessageParcel &data, Messa return MSERR_OK; } +int32_t LppVideoStreamerServiceStub::GetLatestPts(int64_t &pts) +{ + MEDIA_LOGI("LppVideoStreamerServiceStub::GetLatestPts"); + CHECK_AND_RETURN_RET_LOG(lppVideoPlayerServer_ != nullptr, MSERR_INVALID_OPERATION, "player server is nullptr"); + return lppVideoPlayerServer_->GetLatestPts(pts); +} + +int32_t LppVideoStreamerServiceStub::GetLatestPts(MessageParcel &data, MessageParcel &reply) +{ + (void)data; + int64_t pts = 0; + int32_t ret = GetLatestPts(pts); + MEDIA_LOGI("LppVideoStreamerServiceStub::GetLatestPts %{public}d %{public}ld", ret, pts); + reply.WriteInt32(ret); + reply.WriteInt64(pts); + return MSERR_OK; +} } // namespace Media } // namespace OHOS diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h index eca927564..e708a8e14 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h @@ -81,9 +81,12 @@ public: int32_t RenderFirstFrame() override; + int32_t GetLatestPts(int64_t &pts) override; + int32_t Init(); void SetPlayerFuncs(); void FillPlayerFuncPart1(); + void FillPlayerFuncPart2(); private: LppVideoStreamerServiceStub(); @@ -114,6 +117,7 @@ public: int32_t SetLppAudioStreamerId(MessageParcel &data, MessageParcel &reply); int32_t GetStreamerId(MessageParcel &data, MessageParcel &reply); int32_t RenderFirstFrame(MessageParcel &data, MessageParcel &reply); + int32_t GetLatestPts(MessageParcel &data, MessageParcel &reply); std::shared_ptr lppVideoPlayerServer_ = nullptr; std::map> playerFuncs_; diff --git a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp index 34462bbe3..0f7725305 100644 --- a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp +++ b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp @@ -287,6 +287,15 @@ int32_t LppVideoStreamerServer::SetLppVideoStreamerCallback(const std::shared_pt return MSERR_OK; } +int32_t LppVideoStreamerServer::GetLatestPts(int64_t &pts) +{ + MEDIA_LOGI("LppVideoStreamerServer GetLatestPts"); + CHECK_AND_RETURN_RET_LOG(streamerEngine_ != nullptr, MSERR_INVALID_OPERATION, "streamerEngine_ is nullptr"); + auto ret = streamerEngine_->GetLatestPts(pts); + CHECK_AND_RETURN_RET_LOG(ret == MSERR_OK, ret, "GetLatestPts Failed!"); + return ret; +} + int32_t LppVideoStreamerServer::SetLppAudioStreamerId(const std::string audioStreamId) { MEDIA_LOGI("LppVideoStreamerServer SetLppAudioStreamerId"); diff --git a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h index beec97728..0fbf7b171 100644 --- a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h +++ b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h @@ -94,6 +94,8 @@ public: int32_t RenderFirstFrame() override; + int32_t GetLatestPts(int64_t &pts) override; + void OnDataNeeded(const int32_t maxBufferSize, const int32_t maxFrameNum) override; bool OnAnchorUpdateNeeded(int64_t &anchorPts, int64_t &anchorClk) override; void OnError(const MediaServiceErrCode errCode, const std::string &errMsg) override; diff --git a/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h b/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h index 85e72ad28..0f78ba26d 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h @@ -1,55 +1,56 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef I_LPP_SYNC_MANAGER_H -#define I_LPP_SYNC_MANAGER_H -#include -#include -#include "format.h" -#include "i_lpp_video_streamer.h" -#include "pipeline/pipeline.h" - -namespace OHOS { -namespace Media { - -class ILppSyncManager : public std::enable_shared_from_this { -public: - virtual ~ILppSyncManager() = default; - MOCK_METHOD(int32_t, Init, ()); - MOCK_METHOD(int32_t, GetTimeAnchor, (int64_t &anchorPts, int64_t &anchorClock)); - MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId)); - MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId)); - MOCK_METHOD(int32_t, Prepare, ()); - MOCK_METHOD(int32_t, StartRender, ()); - MOCK_METHOD(int32_t, RenderNextFrame, ()); - MOCK_METHOD(int32_t, Pause, ()); - MOCK_METHOD(int32_t, Resume, ()); - MOCK_METHOD(int32_t, Flush, ()); - MOCK_METHOD(int32_t, Stop, ()); - MOCK_METHOD(int32_t, Reset, ()); - MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs)); - MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); - MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters)); - MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters)); - MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk)); - MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap)); - MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); - MOCK_METHOD(int32_t, GetShareBuffer, (int32_t &fd)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); - MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp)); - MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); -}; -} -} +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef I_LPP_SYNC_MANAGER_H +#define I_LPP_SYNC_MANAGER_H +#include +#include +#include "format.h" +#include "i_lpp_video_streamer.h" +#include "pipeline/pipeline.h" + +namespace OHOS { +namespace Media { + +class ILppSyncManager : public std::enable_shared_from_this { +public: + virtual ~ILppSyncManager() = default; + MOCK_METHOD(int32_t, Init, ()); + MOCK_METHOD(int32_t, GetTimeAnchor, (int64_t &anchorPts, int64_t &anchorClock)); + MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId)); + MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId)); + MOCK_METHOD(int32_t, Prepare, ()); + MOCK_METHOD(int32_t, StartRender, ()); + MOCK_METHOD(int32_t, RenderNextFrame, ()); + MOCK_METHOD(int32_t, Pause, ()); + MOCK_METHOD(int32_t, Resume, ()); + MOCK_METHOD(int32_t, Flush, ()); + MOCK_METHOD(int32_t, Stop, ()); + MOCK_METHOD(int32_t, Reset, ()); + MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs)); + MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); + MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters)); + MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters)); + MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk)); + MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap)); + MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); + MOCK_METHOD(int32_t, GetShareBuffer, (int32_t &fd)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); + MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp)); + MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); + MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); +}; +} +} #endif \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h index 1b9af148f..e43d47920 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h +++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h @@ -1,87 +1,88 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef HILPP_VSTREAMER_IMPL_H -#define HILPP_VSTREAMER_IMPL_H -#include "i_lpp_video_streamer.h" -#include "i_lpp_sync_manager.h" -#include "pipeline/pipeline.h" -#include "lpp_video_data_manager.h" -#include "lpp_vdec_adapter.h" -#include "lpp_video_callback_looper.h" -#include "video_decoder_adapter.h" -#include "i_lpp_engine_manager.h" - -namespace OHOS { -namespace Media { - -class HiLppVideoStreamerImpl : public ILppVideoStreamerEngine, - public std::enable_shared_from_this { -public: - HiLppVideoStreamerImpl(); - ~HiLppVideoStreamerImpl() override; - int32_t Init(const std::string &mime) override; - int32_t SetObs(const std::weak_ptr &obs) override; - int32_t SetParameter(const Format ¶m) override; - int32_t Configure(const Format ¶m) override; - int32_t SetVideoSurface(sptr surface) override; - int32_t Prepare() override; - int32_t StartDecode() override; - int32_t StartRender() override; - int32_t Pause() override; - int32_t Resume() override; - int32_t Flush() override; - int32_t Stop() override; - int32_t Reset() override; - int32_t SetPlaybackSpeed(const float playbackSpeed) override; - int32_t SetSyncAudioStreamer(int streamerId) override; - int32_t SetTargetStartFrame(const int64_t targetPts, const int timeoutMs) override; - int32_t ReturnFrames(sptr framePacket) override; - int32_t SetLppAudioStreamerId(std::string audioStreamerId) override; - std::string GetStreamerId() override; - std::shared_ptr GetLppSyncManager() override; - int32_t RenderFirstFrame() override; - void OnEvent(const Event &event); - -private: - void InitLppMode(); - void HandleDataNeededEvent(const Event &event); - void HandleFirstFrameReadyEvent(const Event &event); - void HandleRenderStartedEvent(const Event &event); - void HandleCompleteEvent(const Event &event); - void HandleResolutionChangeEvent(const Event &event); - void HandleTargetArrivedEvent(const Event &event); - int32_t EosPause(); - void HandleErrorEvent(const Event &event); - - bool isLpp_{false}; - std::string streamerId_{}; - int32_t channelId_{}; - int32_t shareBufferFd_{}; - sptr surface_{nullptr}; - std::shared_ptr dataMgr_{nullptr}; - std::shared_ptr vdec_{nullptr}; - std::shared_ptr syncMgr_{nullptr}; - std::shared_ptr callbackLooper_{nullptr}; - std::string audioStreamerId_{}; - std::weak_ptr audioStreamerEngine_; - std::shared_ptr eventReceiver_ {nullptr}; - - bool isChannelSetDone_ {false}; - bool isPaused_ {false}; - std::mutex pauseMutex_ {}; -}; -} // namespace Media -} // namespace OHOS +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef HILPP_VSTREAMER_IMPL_H +#define HILPP_VSTREAMER_IMPL_H +#include "i_lpp_video_streamer.h" +#include "i_lpp_sync_manager.h" +#include "pipeline/pipeline.h" +#include "lpp_video_data_manager.h" +#include "lpp_vdec_adapter.h" +#include "lpp_video_callback_looper.h" +#include "video_decoder_adapter.h" +#include "i_lpp_engine_manager.h" + +namespace OHOS { +namespace Media { + +class HiLppVideoStreamerImpl : public ILppVideoStreamerEngine, + public std::enable_shared_from_this { +public: + HiLppVideoStreamerImpl(); + ~HiLppVideoStreamerImpl() override; + int32_t Init(const std::string &mime) override; + int32_t SetObs(const std::weak_ptr &obs) override; + int32_t SetParameter(const Format ¶m) override; + int32_t Configure(const Format ¶m) override; + int32_t SetVideoSurface(sptr surface) override; + int32_t Prepare() override; + int32_t StartDecode() override; + int32_t StartRender() override; + int32_t Pause() override; + int32_t Resume() override; + int32_t Flush() override; + int32_t Stop() override; + int32_t Reset() override; + int32_t SetPlaybackSpeed(const float playbackSpeed) override; + int32_t SetSyncAudioStreamer(int streamerId) override; + int32_t SetTargetStartFrame(const int64_t targetPts, const int timeoutMs) override; + int32_t ReturnFrames(sptr framePacket) override; + int32_t SetLppAudioStreamerId(std::string audioStreamerId) override; + std::string GetStreamerId() override; + std::shared_ptr GetLppSyncManager() override; + int32_t RenderFirstFrame() override; + int32_t GetLatestPts(int64_t &pts) override; + void OnEvent(const Event &event); + +private: + void InitLppMode(); + void HandleDataNeededEvent(const Event &event); + void HandleFirstFrameReadyEvent(const Event &event); + void HandleRenderStartedEvent(const Event &event); + void HandleCompleteEvent(const Event &event); + void HandleResolutionChangeEvent(const Event &event); + void HandleTargetArrivedEvent(const Event &event); + int32_t EosPause(); + void HandleErrorEvent(const Event &event); + + bool isLpp_{false}; + std::string streamerId_{}; + int32_t channelId_{}; + int32_t shareBufferFd_{}; + sptr surface_{nullptr}; + std::shared_ptr dataMgr_{nullptr}; + std::shared_ptr vdec_{nullptr}; + std::shared_ptr syncMgr_{nullptr}; + std::shared_ptr callbackLooper_{nullptr}; + std::string audioStreamerId_{}; + std::weak_ptr audioStreamerEngine_; + std::shared_ptr eventReceiver_ {nullptr}; + + bool isChannelSetDone_ {false}; + bool isPaused_ {false}; + std::mutex pauseMutex_ {}; +}; +} // namespace Media +} // namespace OHOS #endif \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h index 5cb2d3df5..41bcde079 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h @@ -1,59 +1,60 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef LPP_SYNC_MANAGER_H -#define LPP_SYNC_MANAGER_H - -#include -#include "i_lpp_sync_manager.h" -#include "lpp_sync_manager_adapter.h" -#include "pipeline/pipeline.h" - -namespace OHOS { -namespace Media { -class LppSyncManager : public ILppSyncManager { -public: - explicit LppSyncManager(std::string videoStreamerId, bool isLpp) - { - (void)videoStreamerId; - (void)isLpp; - } - ~LppSyncManager() {}; - MOCK_METHOD(int32_t, Init, (), (override)); - MOCK_METHOD(int32_t, GetTimeAnchor, (int64_t&, int64_t&), (override)); - MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId), (override)); - MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId), (override)); - MOCK_METHOD(int32_t, Prepare, (), (override)); - MOCK_METHOD(int32_t, StartRender, (), (override)); - MOCK_METHOD(int32_t, RenderNextFrame, (), (override)); - MOCK_METHOD(int32_t, Pause, (), (override)); - MOCK_METHOD(int32_t, Resume, (), (override)); - MOCK_METHOD(int32_t, Flush, (), (override)); - MOCK_METHOD(int32_t, Stop, (), (override)); - MOCK_METHOD(int32_t, Reset, (), (override)); - MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs), (override)); - MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed), (override)); - MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters), (override)); - MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters), (override)); - MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk), (override)); - MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap), (override)); - MOCK_METHOD(int32_t, UnbindOutputBuffers, (), (override)); - MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd), (override)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId), (override)); - MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp), (override)); - MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver), (override)); -}; -} // namespace Media -} // namespace OHOS +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef LPP_SYNC_MANAGER_H +#define LPP_SYNC_MANAGER_H + +#include +#include "i_lpp_sync_manager.h" +#include "lpp_sync_manager_adapter.h" +#include "pipeline/pipeline.h" + +namespace OHOS { +namespace Media { +class LppSyncManager : public ILppSyncManager { +public: + explicit LppSyncManager(std::string videoStreamerId, bool isLpp) + { + (void)videoStreamerId; + (void)isLpp; + } + ~LppSyncManager() {}; + MOCK_METHOD(int32_t, Init, (), (override)); + MOCK_METHOD(int32_t, GetTimeAnchor, (int64_t&, int64_t&), (override)); + MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId), (override)); + MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId), (override)); + MOCK_METHOD(int32_t, Prepare, (), (override)); + MOCK_METHOD(int32_t, StartRender, (), (override)); + MOCK_METHOD(int32_t, RenderNextFrame, (), (override)); + MOCK_METHOD(int32_t, Pause, (), (override)); + MOCK_METHOD(int32_t, Resume, (), (override)); + MOCK_METHOD(int32_t, Flush, (), (override)); + MOCK_METHOD(int32_t, Stop, (), (override)); + MOCK_METHOD(int32_t, Reset, (), (override)); + MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs), (override)); + MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed), (override)); + MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters), (override)); + MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters), (override)); + MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk), (override)); + MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap), (override)); + MOCK_METHOD(int32_t, UnbindOutputBuffers, (), (override)); + MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd), (override)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId), (override)); + MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp), (override)); + MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver), (override)); + MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts), (override)); +}; +} // namespace Media +} // namespace OHOS #endif \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h index 2736d4528..e4f713430 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h +++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h @@ -1,75 +1,76 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef LPP_SYNC_MANAGER_ADAPTER_H -#define LPP_SYNC_MANAGER_ADAPTER_H - -#include -#include -#include -#include - -#include "media_core.h" -#include "player.h" -#include "surface_buffer.h" -#include "pipeline/pipeline.h" - -namespace OHOS { -namespace Media { -class LppSyncManagerAdapter : public std::enable_shared_from_this { -public: - MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId)); - MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId)); - MOCK_METHOD(int32_t, Init, ()); - MOCK_METHOD(int32_t, StartRender, ()); - MOCK_METHOD(int32_t, RenderNextFrame, ()); - MOCK_METHOD(int32_t, Pause, ()); - MOCK_METHOD(int32_t, Resume, ()); - MOCK_METHOD(int32_t, Flush, ()); - MOCK_METHOD(int32_t, Stop, ()); - MOCK_METHOD(int32_t, Reset, ()); - MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs)); - MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); - MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters)); - MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters)); - MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk)); - MOCK_METHOD(int32_t, LoadAdapter, (uint32_t& instanceId)); - MOCK_METHOD(int32_t, UnloadAdapter, (uint32_t instanceId)); - MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap)); - MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); - MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); - MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); -}; - -class LowPowerPlayerFactory { -public: - static int32_t CreateLppSyncManagerAdapter(uint32_t &instanceId, std::shared_ptr &adapter) - { - instanceId = 1; - if (adapter != nullptr) { - return 0; - } - adapter = std::make_shared(); - return 0; - } - static int32_t DestroyLppSyncManagerAdapter( - const uint32_t instanceId, std::shared_ptr adapter) - { - return 0; - } -}; -} // namespace Media -} // namespace OHOS +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef LPP_SYNC_MANAGER_ADAPTER_H +#define LPP_SYNC_MANAGER_ADAPTER_H + +#include +#include +#include +#include + +#include "media_core.h" +#include "player.h" +#include "surface_buffer.h" +#include "pipeline/pipeline.h" + +namespace OHOS { +namespace Media { +class LppSyncManagerAdapter : public std::enable_shared_from_this { +public: + MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId)); + MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId)); + MOCK_METHOD(int32_t, Init, ()); + MOCK_METHOD(int32_t, StartRender, ()); + MOCK_METHOD(int32_t, RenderNextFrame, ()); + MOCK_METHOD(int32_t, Pause, ()); + MOCK_METHOD(int32_t, Resume, ()); + MOCK_METHOD(int32_t, Flush, ()); + MOCK_METHOD(int32_t, Stop, ()); + MOCK_METHOD(int32_t, Reset, ()); + MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs)); + MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); + MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters)); + MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters)); + MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk)); + MOCK_METHOD(int32_t, LoadAdapter, (uint32_t& instanceId)); + MOCK_METHOD(int32_t, UnloadAdapter, (uint32_t instanceId)); + MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap)); + MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); + MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); + MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); + MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); +}; + +class LowPowerPlayerFactory { +public: + static int32_t CreateLppSyncManagerAdapter(uint32_t &instanceId, std::shared_ptr &adapter) + { + instanceId = 1; + if (adapter != nullptr) { + return 0; + } + adapter = std::make_shared(); + return 0; + } + static int32_t DestroyLppSyncManagerAdapter( + const uint32_t instanceId, std::shared_ptr adapter) + { + return 0; + } +}; +} // namespace Media +} // namespace OHOS #endif // LPP_SYNC_MANAGER_ADAPTER_H \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h index 9224148f3..4d467c105 100644 --- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h +++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h @@ -1,59 +1,60 @@ -/* - * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_HDI_LOW_POWER_PLAYER_V1_0_ILPPSYNCMANAGERADAPTER_H -#define OHOS_HDI_LOW_POWER_PLAYER_V1_0_ILPPSYNCMANAGERADAPTER_H - -#include -#include -#include - -#include "ilpp_sync_manager_callback.h" -#include "surface_buffer.h" -#include "../native_buffer.h" -#include "hdf_base.h" - -namespace OHOS { -namespace HDI { -namespace LowPowerPlayer { -namespace V1_0 { -using namespace OHOS::HDI::Base; -class ILppSyncManagerAdapter : public RefBase { -public: - MOCK_METHOD(int32_t, SetVideoChannelId, (uint32_t channelId)); - MOCK_METHOD(int32_t, SetAudioChannelId, (uint32_t channelId)); - MOCK_METHOD(int32_t, StartRender, ()); - MOCK_METHOD(int32_t, RenderNextFrame, ()); - MOCK_METHOD(int32_t, Pause, ()); - MOCK_METHOD(int32_t, Resume, ()); - MOCK_METHOD(int32_t, Flush, ()); - MOCK_METHOD(int32_t, Stop, ()); - MOCK_METHOD(int32_t, Reset, ()); - MOCK_METHOD(int32_t, SetTargetStartFrame, (uint64_t framePts, uint32_t timeoutMs)); - MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); - MOCK_METHOD(int32_t, RegisterCallback, (const sptr& syncCallback)); - MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameter)); - MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameter)); - MOCK_METHOD(int32_t, UpdateTimeAnchor, (int64_t anchorPts, int64_t anchorClk)); - MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& outputBuffers)); - MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); - MOCK_METHOD(int32_t, GetShareBuffer, (int& fd)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); -}; -} // V1_0 -} // LowPowerPlayer -} // HDI -} // OHOS +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_HDI_LOW_POWER_PLAYER_V1_0_ILPPSYNCMANAGERADAPTER_H +#define OHOS_HDI_LOW_POWER_PLAYER_V1_0_ILPPSYNCMANAGERADAPTER_H + +#include +#include +#include + +#include "ilpp_sync_manager_callback.h" +#include "surface_buffer.h" +#include "../native_buffer.h" +#include "hdf_base.h" + +namespace OHOS { +namespace HDI { +namespace LowPowerPlayer { +namespace V1_0 { +using namespace OHOS::HDI::Base; +class ILppSyncManagerAdapter : public RefBase { +public: + MOCK_METHOD(int32_t, SetVideoChannelId, (uint32_t channelId)); + MOCK_METHOD(int32_t, SetAudioChannelId, (uint32_t channelId)); + MOCK_METHOD(int32_t, StartRender, ()); + MOCK_METHOD(int32_t, RenderNextFrame, ()); + MOCK_METHOD(int32_t, Pause, ()); + MOCK_METHOD(int32_t, Resume, ()); + MOCK_METHOD(int32_t, Flush, ()); + MOCK_METHOD(int32_t, Stop, ()); + MOCK_METHOD(int32_t, Reset, ()); + MOCK_METHOD(int32_t, SetTargetStartFrame, (uint64_t framePts, uint32_t timeoutMs)); + MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); + MOCK_METHOD(int32_t, RegisterCallback, (const sptr& syncCallback)); + MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameter)); + MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameter)); + MOCK_METHOD(int32_t, UpdateTimeAnchor, (int64_t anchorPts, int64_t anchorClk)); + MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& outputBuffers)); + MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); + MOCK_METHOD(int32_t, GetShareBuffer, (int& fd)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); + MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); +}; +} // V1_0 +} // LowPowerPlayer +} // HDI +} // OHOS #endif // OHOS_HDI_LOW_POWER_PLAYER_V1_0_ILPPSYNCMANAGERADAPTER_H \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h index 3f3755f5a..75203ceba 100644 --- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h @@ -1,71 +1,71 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef LPP_SYNC_MANAGER_H -#define LPP_SYNC_MANAGER_H - -#include "lpp_sync_manager_adapter.h" -#include "osal/task/task.h" - -namespace OHOS { -namespace Media { - -class LppSyncManager : public std::enable_shared_from_this { -public: - explicit LppSyncManager(std::string videoStreamerId, bool isLpp); - ~LppSyncManager(); - int32_t GetTimeAnchor(int64_t &anchorPts, int64_t &anchorClock); - - int32_t SetVideoChannelId(const uint32_t channelId); - int32_t SetAudioChannelId(const uint32_t channelId); - int32_t Init(); - int32_t Prepare(); - int32_t StartRender(); - int32_t RenderNextFrame(); - int32_t Pause(); - int32_t Resume(); - int32_t Flush(); - int32_t Stop(); - int32_t Reset(); - int32_t SetTargetStartFrame(const uint64_t targetPts, uint32_t timeoutMs = 0); - int32_t SetPlaybackSpeed(float speed); - int32_t SetParameter(const std::map ¶meters); - int32_t GetParameter(std::map ¶meters); - int32_t UpdateTimeAnchor(const int64_t anchorPts, const int64_t anchorClk); - int32_t BindOutputBuffers(const std::map> &bufferMap); - int32_t UnbindOutputBuffers(); - int32_t GetShareBuffer(int32_t &fd); - int32_t SetTunnelId(uint64_t tunnelId); - int32_t SetAudioIsLpp(bool isLpp); - void SetEventReceiver(std::shared_ptr eventReceiver); - -private: - void ResetTimeAnchor(); - - uint32_t adapterId_ {0}; - std::string videoStreamerId_ {}; - std::shared_ptr adapter_ {nullptr}; - bool videoIsLpp_ {true}; - bool audioIsLpp_ {false}; - std::mutex anchorMutex_{}; - uint64_t localAnchorPts_ {0}; - uint64_t localAnchorClk_ {0}; - std::unique_ptr synctask_ {nullptr}; - std::shared_ptr eventReceiver_ {nullptr}; -}; - -} // namespace Media -} // namespace OHOS - +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef LPP_SYNC_MANAGER_H +#define LPP_SYNC_MANAGER_H + +#include "lpp_sync_manager_adapter.h" +#include "osal/task/task.h" + +namespace OHOS { +namespace Media { + +class LppSyncManager : public std::enable_shared_from_this { +public: + explicit LppSyncManager(std::string videoStreamerId, bool isLpp); + ~LppSyncManager(); + int32_t GetTimeAnchor(int64_t &anchorPts, int64_t &anchorClock); + + int32_t SetVideoChannelId(const uint32_t channelId); + int32_t SetAudioChannelId(const uint32_t channelId); + int32_t Init(); + int32_t Prepare(); + int32_t StartRender(); + int32_t RenderNextFrame(); + int32_t Pause(); + int32_t Resume(); + int32_t Flush(); + int32_t Stop(); + int32_t Reset(); + int32_t SetTargetStartFrame(const uint64_t targetPts, uint32_t timeoutMs = 0); + int32_t SetPlaybackSpeed(float speed); + int32_t SetParameter(const std::map ¶meters); + int32_t GetParameter(std::map ¶meters); + int32_t UpdateTimeAnchor(const int64_t anchorPts, const int64_t anchorClk); + int32_t BindOutputBuffers(const std::map> &bufferMap); + int32_t UnbindOutputBuffers(); + int32_t GetShareBuffer(int32_t &fd); + int32_t SetTunnelId(uint64_t tunnelId); + int32_t SetAudioIsLpp(bool isLpp); + void SetEventReceiver(std::shared_ptr eventReceiver); + int32_t GetLatestPts(int64_t &pts); +private: + void ResetTimeAnchor(); + + uint32_t adapterId_ {0}; + std::string videoStreamerId_ {}; + std::shared_ptr adapter_ {nullptr}; + bool videoIsLpp_ {true}; + bool audioIsLpp_ {false}; + std::mutex anchorMutex_{}; + uint64_t localAnchorPts_ {0}; + uint64_t localAnchorClk_ {0}; + std::unique_ptr synctask_ {nullptr}; + std::shared_ptr eventReceiver_ {nullptr}; +}; + +} // namespace Media +} // namespace OHOS + #endif \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h index c9ea2f2e3..31cfa94e7 100644 --- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h +++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h @@ -1,77 +1,78 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef LPP_SYNC_MANAGER_ADAPTER_H -#define LPP_SYNC_MANAGER_ADAPTER_H - -#include -#include -#include -#include - -#include "media_core.h" -#include "player.h" -#include "surface_buffer.h" -#include "pipeline/pipeline.h" - -namespace OHOS { -namespace Media { - -class LppSyncManagerAdapter : public std::enable_shared_from_this { -public: - MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId)); - MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId)); - MOCK_METHOD(int32_t, Init, ()); - MOCK_METHOD(int32_t, StartRender, ()); - MOCK_METHOD(int32_t, RenderNextFrame, ()); - MOCK_METHOD(int32_t, Pause, ()); - MOCK_METHOD(int32_t, Resume, ()); - MOCK_METHOD(int32_t, Flush, ()); - MOCK_METHOD(int32_t, Stop, ()); - MOCK_METHOD(int32_t, Reset, ()); - MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs)); - MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); - MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters)); - MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters)); - MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk)); - MOCK_METHOD(int32_t, LoadAdapter, (uint32_t& instanceId)); - MOCK_METHOD(int32_t, UnloadAdapter, (uint32_t instanceId)); - MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap)); - MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); - MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); - MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); -}; - -class LowPowerPlayerFactory { -public: - static int32_t CreateLppSyncManagerAdapter(uint32_t &instanceId, std::shared_ptr &adapter) - { - instanceId = 1; - if (adapter != nullptr) { - return 0; - } - adapter = std::make_shared(); - return 0; - } - static int32_t DestroyLppSyncManagerAdapter( - const uint32_t instanceId, std::shared_ptr adapter) - { - return 0; - } -}; - -} // namespace Media -} // namespace OHOS +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef LPP_SYNC_MANAGER_ADAPTER_H +#define LPP_SYNC_MANAGER_ADAPTER_H + +#include +#include +#include +#include + +#include "media_core.h" +#include "player.h" +#include "surface_buffer.h" +#include "pipeline/pipeline.h" + +namespace OHOS { +namespace Media { + +class LppSyncManagerAdapter : public std::enable_shared_from_this { +public: + MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId)); + MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId)); + MOCK_METHOD(int32_t, Init, ()); + MOCK_METHOD(int32_t, StartRender, ()); + MOCK_METHOD(int32_t, RenderNextFrame, ()); + MOCK_METHOD(int32_t, Pause, ()); + MOCK_METHOD(int32_t, Resume, ()); + MOCK_METHOD(int32_t, Flush, ()); + MOCK_METHOD(int32_t, Stop, ()); + MOCK_METHOD(int32_t, Reset, ()); + MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs)); + MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); + MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters)); + MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters)); + MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk)); + MOCK_METHOD(int32_t, LoadAdapter, (uint32_t& instanceId)); + MOCK_METHOD(int32_t, UnloadAdapter, (uint32_t instanceId)); + MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap)); + MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); + MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); + MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); + MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); +}; + +class LowPowerPlayerFactory { +public: + static int32_t CreateLppSyncManagerAdapter(uint32_t &instanceId, std::shared_ptr &adapter) + { + instanceId = 1; + if (adapter != nullptr) { + return 0; + } + adapter = std::make_shared(); + return 0; + } + static int32_t DestroyLppSyncManagerAdapter( + const uint32_t instanceId, std::shared_ptr adapter) + { + return 0; + } +}; + +} // namespace Media +} // namespace OHOS #endif // LPP_SYNC_MANAGER_ADAPTER_H \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h index dbb510bf4..496edb438 100644 --- a/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h @@ -1,58 +1,59 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef LPP_SYNC_MANAGER_H -#define LPP_SYNC_MANAGER_H - -#include -#include "i_lpp_sync_manager.h" -#include "pipeline/pipeline.h" - -namespace OHOS { -namespace Media { -class LppSyncManager : public ILppSyncManager { -public: - explicit LppSyncManager(std::string videoStreamerId, bool isLpp) - { - (void)videoStreamerId; - (void)isLpp; - } - ~LppSyncManager() {}; - MOCK_METHOD(int32_t, Init, (), (override)); - MOCK_METHOD(int32_t, GetTimeAnchor, (int64_t&, int64_t&), (override)); - MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId), (override)); - MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId), (override)); - MOCK_METHOD(int32_t, Prepare, (), (override)); - MOCK_METHOD(int32_t, StartRender, (), (override)); - MOCK_METHOD(int32_t, RenderNextFrame, (), (override)); - MOCK_METHOD(int32_t, Pause, (), (override)); - MOCK_METHOD(int32_t, Resume, (), (override)); - MOCK_METHOD(int32_t, Flush, (), (override)); - MOCK_METHOD(int32_t, Stop, (), (override)); - MOCK_METHOD(int32_t, Reset, (), (override)); - MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs), (override)); - MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed), (override)); - MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters), (override)); - MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters), (override)); - MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk), (override)); - MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap), (override)); - MOCK_METHOD(int32_t, UnbindOutputBuffers, (), (override)); - MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd), (override)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId), (override)); - MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp), (override)); - MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver), (override)); -}; -} // namespace Media -} // namespace OHOS +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef LPP_SYNC_MANAGER_H +#define LPP_SYNC_MANAGER_H + +#include +#include "i_lpp_sync_manager.h" +#include "pipeline/pipeline.h" + +namespace OHOS { +namespace Media { +class LppSyncManager : public ILppSyncManager { +public: + explicit LppSyncManager(std::string videoStreamerId, bool isLpp) + { + (void)videoStreamerId; + (void)isLpp; + } + ~LppSyncManager() {}; + MOCK_METHOD(int32_t, Init, (), (override)); + MOCK_METHOD(int32_t, GetTimeAnchor, (int64_t&, int64_t&), (override)); + MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId), (override)); + MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId), (override)); + MOCK_METHOD(int32_t, Prepare, (), (override)); + MOCK_METHOD(int32_t, StartRender, (), (override)); + MOCK_METHOD(int32_t, RenderNextFrame, (), (override)); + MOCK_METHOD(int32_t, Pause, (), (override)); + MOCK_METHOD(int32_t, Resume, (), (override)); + MOCK_METHOD(int32_t, Flush, (), (override)); + MOCK_METHOD(int32_t, Stop, (), (override)); + MOCK_METHOD(int32_t, Reset, (), (override)); + MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs), (override)); + MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed), (override)); + MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters), (override)); + MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters), (override)); + MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk), (override)); + MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap), (override)); + MOCK_METHOD(int32_t, UnbindOutputBuffers, (), (override)); + MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd), (override)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId), (override)); + MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp), (override)); + MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver), (override)); + MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts), (override)); +}; +} // namespace Media +} // namespace OHOS #endif \ No newline at end of file -- Gitee From a9a661b910e823d9705e11e0aeaccc723e78b5a5 Mon Sep 17 00:00:00 2001 From: zpf Date: Fri, 29 Aug 2025 10:11:28 +0000 Subject: [PATCH 4/7] =?UTF-8?q?Revert=20"pts=20=E9=80=82=E9=85=8D"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 1bae4488bd8ac0f44e7f1f3b2d24ffa23587138a. --- .../lppplayer/native_lpp_video_streamer.cpp | 12 -- .../video_streamer_impl.cpp | 10 - .../lpp_video_streamer/video_streamer_impl.h | 2 - .../inner_api/native/lpp_video_streamer.h | 2 - interfaces/kits/c/lowpower_video_sink.h | 14 -- .../lpp/lpp_sync_manager/lpp_sync_manager.h | 1 - .../lpp_sync_manager_adapter.h | 2 - .../lpp_sync_manager/src/lpp_sync_manager.cpp | 10 - .../src/lpp_sync_manager_adapter.cpp | 8 - .../lpp_video_streamer/hilpp_vstreamer_impl.h | 1 - .../src/hilpp_vstreamer_impl.cpp | 7 - .../include/i_lpp_video_streamer_service.h | 2 - .../services/engine_intf/i_lpp_sync_manager.h | 1 - .../engine_intf/i_lpp_video_streamer.h | 1 - .../client/lpp_video_streamer_client.cpp | 10 - .../client/lpp_video_streamer_client.h | 2 - .../i_standard_lpp_video_streamer_service.h | 3 - .../ipc/lpp_video_streamer_service_proxy.cpp | 19 -- .../ipc/lpp_video_streamer_service_proxy.h | 2 - .../ipc/lpp_video_streamer_service_stub.cpp | 24 --- .../ipc/lpp_video_streamer_service_stub.h | 4 - .../server/lpp_video_streamer_server.cpp | 9 - .../server/lpp_video_streamer_server.h | 2 - .../mock/i_lpp_sync_manager.h | 109 ++++++----- .../mock/hilpp_vstreamer_impl.h | 173 +++++++++--------- .../mock/lpp_sync_manager.h | 117 ++++++------ .../mock/lpp_sync_manager_adapter.h | 149 ++++++++------- .../mock/v1_0/ilpp_sync_manager_adapter.h | 117 ++++++------ .../mock/lpp_sync_manager.h | 140 +++++++------- .../mock/lpp_sync_manager_adapter.h | 153 ++++++++-------- .../mock/lpp_sync_manager.h | 115 ++++++------ 31 files changed, 533 insertions(+), 688 deletions(-) diff --git a/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp b/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp index 5ed1622b2..2147b2427 100644 --- a/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp +++ b/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp @@ -634,7 +634,6 @@ OH_AVErrCode OH_LowPowerVideoSinkCallback_SetStreamChangedListener( int32_t res = callback->SetStreamChangedListener(onStreamChanged, userData); return LppMsErrToOHAvErr(res); } - OH_AVErrCode OH_LowPowerVideoSinkCallback_SetFirstFrameDecodedListener(OH_LowPowerVideoSinkCallback *callback, OH_LowPowerVideoSink_OnFirstFrameDecoded onFirstFrameDecoded, void *userData) { @@ -644,14 +643,3 @@ OH_AVErrCode OH_LowPowerVideoSinkCallback_SetFirstFrameDecodedListener(OH_LowPow int32_t res = callback->SetFirstFrameReadyListener(onFirstFrameDecoded, userData); return LppMsErrToOHAvErr(res); } - -OH_AVErrCode OH_LowPowerVideoSink_GetLatestPts(OH_LowPowerVideoSink *streamer, int64_t *pts) -{ - MEDIA_LOGD("OH_LowPowerVideoSink_GetLatestPts"); - CHECK_AND_RETURN_RET_LOG(streamer != nullptr, AV_ERR_INVALID_VAL, "streamer is nullptr!"); - LowPowerVideoSinkObject *streamerObj = reinterpret_cast(streamer); - CHECK_AND_RETURN_RET_LOG(streamerObj != nullptr, AV_ERR_INVALID_VAL, "streamerObj is nullptr"); - CHECK_AND_RETURN_RET_LOG(streamerObj->videoStreamer_ != nullptr, AV_ERR_INVALID_VAL, "videoStreamer_ is nullptr"); - int32_t res = streamerObj->videoStreamer_->GetLatestPts(*pts); - return LppMsErrToOHAvErr(res); -} diff --git a/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp b/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp index 414b33325..f7adadd72 100644 --- a/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp +++ b/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp @@ -262,15 +262,5 @@ std::string VideoStreamerImpl::GetStreamerId() CHECK_AND_RETURN_RET_LOG(streamerService_ != nullptr, "", "player service does not exist.."); return streamerService_->GetStreamerId(); } - -int32_t VideoStreamerImpl::GetLatestPts(int64_t &pts) -{ - MEDIA_LOGI("VideoStreamerImpl GetLatestPts"); - CHECK_AND_RETURN_RET_LOG(streamerService_ != nullptr, MSERR_SERVICE_DIED, - "GetLatestPts player service does not exist.."); - int32_t ret = streamerService_->GetLatestPts(pts); - pts = (ret == MSERR_OK) ? pts : 0; - return ret; -} } // namespace Media } // namespace OHOS diff --git a/frameworks/native/lpp_video_streamer/video_streamer_impl.h b/frameworks/native/lpp_video_streamer/video_streamer_impl.h index 1a0b1e3e9..16015c442 100644 --- a/frameworks/native/lpp_video_streamer/video_streamer_impl.h +++ b/frameworks/native/lpp_video_streamer/video_streamer_impl.h @@ -76,8 +76,6 @@ public: std::string GetStreamerId() override; - int32_t GetLatestPts(int64_t &pts) override; - private: std::shared_ptr callback_; std::shared_ptr streamerService_ = nullptr; diff --git a/interfaces/inner_api/native/lpp_video_streamer.h b/interfaces/inner_api/native/lpp_video_streamer.h index 34de7d154..d29cd78a0 100644 --- a/interfaces/inner_api/native/lpp_video_streamer.h +++ b/interfaces/inner_api/native/lpp_video_streamer.h @@ -103,8 +103,6 @@ public: virtual int32_t RenderFirstFrame() = 0; virtual std::string GetStreamerId() = 0; - - virtual int32_t GetLatestPts(int64_t &pts) = 0; }; class __attribute__((visibility("default"))) VideoStreamerFactory { diff --git a/interfaces/kits/c/lowpower_video_sink.h b/interfaces/kits/c/lowpower_video_sink.h index f74db9821..d1c11f7e3 100644 --- a/interfaces/kits/c/lowpower_video_sink.h +++ b/interfaces/kits/c/lowpower_video_sink.h @@ -314,20 +314,6 @@ OH_AVErrCode OH_LowPowerVideoSink_SetTargetStartFrame( const int64_t timeoutMs, void* userData); -/** - * @brief Get the latest presentation timestamp (PTS) from lowpower video sink. - * - * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance. - * @param {int64_t*} pts Pointer to store the latest PTS value (in microseconds). - * @return Returns AV_ERR_OK if the timestamp is obtained successfully; - * otherwise, returns a specific error code as defined in {@link OH_AVErrCode}: - * {@link AV_ERR_INVALID_VAL} the sink is nullptr, or sink is invalid. - * {@link AV_ERR_SERVICE_DIED} media service is died. - * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted. - * @since 21 - */ -OH_AVErrCode OH_LowPowerVideoSink_GetLatestPts(OH_LowPowerVideoSink *streamer, int64_t *pts); - /** * @brief Set playback speed for the lowpower video sink * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h index 52029e9a6..229bbb003 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h +++ b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h @@ -50,7 +50,6 @@ public: int32_t SetTunnelId(uint64_t tunnelId) override; int32_t SetAudioIsLpp(bool isLpp) override; void SetEventReceiver(std::shared_ptr eventReceiver) override; - int32_t GetLatestPts(int64_t &pts) override; private: void ResetTimeAnchor(); diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h index a78c947e6..c602d662d 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h +++ b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h @@ -56,8 +56,6 @@ public: int32_t UnbindOutputBuffers(); int32_t GetShareBuffer(int32_t &fd); int32_t SetTunnelId(uint64_t tunnelId); - int32_t GetLatestPts(int64_t &pts); - void OnError(const int32_t errorCode, const std::string &errorMsg); void OnTargetArrived(const int64_t targetPts, const bool isTimeout); void OnRenderStarted(); diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp index 392286602..c6b7cdf88 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp +++ b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp @@ -263,16 +263,6 @@ int32_t LppSyncManager::SetTunnelId(uint64_t tunnelId) return MSERR_OK; } -int32_t LppSyncManager::GetLatestPts(int64_t &pts) -{ - MEDIA_LOG_I("LppSyncManager::GetLatestPts"); - FALSE_RETURN_V_NOLOG(videoIsLpp_, MSERR_UNKNOWN); - FALSE_RETURN_V_MSG_E(adapter_ != nullptr, MSERR_INVALID_OPERATION, "adapter_ is nullptr"); - auto ret = adapter_->GetLatestPts(pts); - FALSE_RETURN_V_MSG_E(ret == MSERR_OK, ret, "adapter_ GetLatestPts failed"); - return MSERR_OK; -} - int32_t LppSyncManager::SetAudioIsLpp(bool isLpp) { audioIsLpp_ = isLpp; diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp index dc5aa9195..87b1d5615 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp +++ b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp @@ -321,14 +321,6 @@ int32_t LppSyncManagerAdapter::SetTunnelId(uint64_t tunnelId) return MSERR_OK; } -int32_t LppSyncManagerAdapter::GetLatestPts(int64_t &pts) -{ - MediaTrace trace("LppSyncManagerAdapter::GetLatestPts"); - MEDIA_LOG_I("GetLatestPts enter"); - FALSE_RETURN_V_MSG_E(syncMgrAdapter_ != nullptr, MSERR_INVALID_OPERATION, "syncMgrAdapter_ is nullptr"); - return syncMgrAdapter_->GetLatestPts(pts); -} - void LppSyncManagerAdapter::SetEventReceiver(std::shared_ptr eventReceiver) { eventReceiver_ = eventReceiver; diff --git a/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h b/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h index dd95907cc..f39780d21 100644 --- a/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h +++ b/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h @@ -55,7 +55,6 @@ public: std::string GetStreamerId() override; std::shared_ptr GetLppSyncManager() override; int32_t RenderFirstFrame() override; - int32_t GetLatestPts(int64_t &pts) override; void OnEvent(const Event &event); private: diff --git a/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp b/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp index 4db33be9c..8b4e6c0e6 100644 --- a/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp +++ b/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp @@ -130,13 +130,6 @@ int32_t HiLppVideoStreamerImpl::SetParameter(const Format ¶m) return MSERR_OK; } -int32_t HiLppVideoStreamerImpl::GetLatestPts(int64_t &pts) -{ - MEDIA_LOG_I("HiLppVideoStreamerImpl::GetLatestPts"); - FALSE_RETURN_V_MSG(vdec_ != nullptr, MSERR_INVALID_OPERATION, "vdec_ nullptr"); - return syncMgr_->GetLatestPts(pts); -} - int32_t HiLppVideoStreamerImpl::Configure(const Format ¶m) { FALSE_RETURN_V_MSG(vdec_ != nullptr, MSERR_INVALID_OPERATION, "vdec_ nullptr"); diff --git a/services/include/i_lpp_video_streamer_service.h b/services/include/i_lpp_video_streamer_service.h index 770d1470e..ffdc2c52f 100644 --- a/services/include/i_lpp_video_streamer_service.h +++ b/services/include/i_lpp_video_streamer_service.h @@ -75,8 +75,6 @@ public: virtual std::string GetStreamerId() = 0; virtual int32_t RenderFirstFrame() = 0; - - virtual int32_t GetLatestPts(int64_t &pts) = 0; }; } // namespace Media } // namespace OHOS diff --git a/services/services/engine_intf/i_lpp_sync_manager.h b/services/services/engine_intf/i_lpp_sync_manager.h index 38f9bf540..2edba8cee 100644 --- a/services/services/engine_intf/i_lpp_sync_manager.h +++ b/services/services/engine_intf/i_lpp_sync_manager.h @@ -50,7 +50,6 @@ public: virtual int32_t SetTunnelId(uint64_t tunnelId) = 0; virtual int32_t SetAudioIsLpp(bool isLpp) = 0; virtual void SetEventReceiver(std::shared_ptr eventReceiver) = 0; - virtual int32_t GetLatestPts(int64_t &pts) = 0; }; } diff --git a/services/services/engine_intf/i_lpp_video_streamer.h b/services/services/engine_intf/i_lpp_video_streamer.h index c411b1c94..507230511 100644 --- a/services/services/engine_intf/i_lpp_video_streamer.h +++ b/services/services/engine_intf/i_lpp_video_streamer.h @@ -66,7 +66,6 @@ public: virtual std::string GetStreamerId() = 0; virtual std::shared_ptr GetLppSyncManager() = 0; virtual int32_t RenderFirstFrame() = 0; - virtual int32_t GetLatestPts(int64_t &pts) = 0; }; } // namespace Media } // namespace OHOS diff --git a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp index dae58d353..952fda07b 100644 --- a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp +++ b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp @@ -243,15 +243,5 @@ void LppVideoStreamerClient::MediaServerDied() "mediaserver is died, please create a new video sink instance again"); } } - -int32_t LppVideoStreamerClient::GetLatestPts(int64_t &pts) -{ - MEDIA_LOGI("LppVideoStreamerClient GetLatestPts"); - CHECK_AND_RETURN_RET_LOG(playerProxy_ != nullptr, MSERR_SERVICE_DIED, - "LppVideoStreamerClient GetLatestPts player service does not exist.."); - int32_t ret = playerProxy_->GetLatestPts(pts); - CHECK_AND_RETURN_RET_LOG(ret == MSERR_OK, ret, "LppVideoStreamerClient GetLatestPts failed."); - return MSERR_OK; -} } // namespace Media } // namespace OHOS \ No newline at end of file diff --git a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h index 325f8e4a1..7b5a6885d 100644 --- a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h +++ b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h @@ -76,8 +76,6 @@ public: int32_t RenderFirstFrame() override; - int32_t GetLatestPts(int64_t &pts) override; - void MediaServerDied(); private: diff --git a/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h b/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h index c9928ef1d..32982afbf 100644 --- a/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h +++ b/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h @@ -80,8 +80,6 @@ public: virtual int32_t RenderFirstFrame() = 0; - virtual int32_t GetLatestPts(int64_t &pts) = 0; - /** * IPC code ID */ @@ -111,7 +109,6 @@ public: GET_STREAM_ID, SET_AUDIO_STREAMER_ID, RENDER_FIRST_FRAME, - GET_LATEST_PTS, MAX_IPC_ID, // all IPC codes should be added before MAX_IPC_ID }; diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp index 898d65663..c4556605e 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp @@ -429,24 +429,5 @@ int32_t LppVideoStreamerServiceProxy::RenderFirstFrame() return reply.ReadInt32(); } -int32_t LppVideoStreamerServiceProxy::GetLatestPts(int64_t &pts) -{ - MEDIA_LOGI("LppVideoStreamerServiceProxy GetLatestPts"); - MessageParcel data; - MessageParcel reply; - MessageOption option; - - bool token = data.WriteInterfaceToken(LppVideoStreamerServiceProxy::GetDescriptor()); - CHECK_AND_RETURN_RET_LOG(token, MSERR_INVALID_OPERATION, "Failed to write descriptor!"); - - int32_t error = Remote()->SendRequest(GET_LATEST_PTS, data, reply, option); - CHECK_AND_RETURN_RET_LOG( - error == MSERR_OK, MSERR_INVALID_OPERATION, "GetLatestPts SendRequest failed, error: %{public}d", error); - int32_t ret = reply.ReadInt32(); - pts = reply.ReadInt64(); - CHECK_AND_RETURN_RET_LOG( - ret == MSERR_OK, MSERR_INVALID_OPERATION, "GetLatestPts failed, error: %{public}d", ret); - return ret; -} } // namespace Media } // namespace OHOS diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h index 3ba478a87..efc84e5a7 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h @@ -74,8 +74,6 @@ public: std::string GetStreamerId() override; - int32_t GetLatestPts(int64_t &pts) override; - int32_t RenderFirstFrame() override; private: static inline BrokerDelegator delegator_; diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp index 3c2caa459..a3c2b2974 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp @@ -82,7 +82,6 @@ int32_t LppVideoStreamerServiceStub::Init() void LppVideoStreamerServiceStub::SetPlayerFuncs() { FillPlayerFuncPart1(); - FillPlayerFuncPart2(); } void LppVideoStreamerServiceStub::FillPlayerFuncPart1() @@ -137,12 +136,6 @@ void LppVideoStreamerServiceStub::FillPlayerFuncPart1() [this](MessageParcel &data, MessageParcel &reply) { return RenderFirstFrame(data, reply); }}; } -void LppVideoStreamerServiceStub::FillPlayerFuncPart2() -{ - playerFuncs_[GET_LATEST_PTS] = {"Player::GetLatestPts", - [this](MessageParcel &data, MessageParcel &reply) { return GetLatestPts(data, reply); }}; -} - int LppVideoStreamerServiceStub::OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { @@ -539,22 +532,5 @@ int32_t LppVideoStreamerServiceStub::RenderFirstFrame(MessageParcel &data, Messa return MSERR_OK; } -int32_t LppVideoStreamerServiceStub::GetLatestPts(int64_t &pts) -{ - MEDIA_LOGI("LppVideoStreamerServiceStub::GetLatestPts"); - CHECK_AND_RETURN_RET_LOG(lppVideoPlayerServer_ != nullptr, MSERR_INVALID_OPERATION, "player server is nullptr"); - return lppVideoPlayerServer_->GetLatestPts(pts); -} - -int32_t LppVideoStreamerServiceStub::GetLatestPts(MessageParcel &data, MessageParcel &reply) -{ - (void)data; - int64_t pts = 0; - int32_t ret = GetLatestPts(pts); - MEDIA_LOGI("LppVideoStreamerServiceStub::GetLatestPts %{public}d %{public}ld", ret, pts); - reply.WriteInt32(ret); - reply.WriteInt64(pts); - return MSERR_OK; -} } // namespace Media } // namespace OHOS diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h index e708a8e14..eca927564 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h @@ -81,12 +81,9 @@ public: int32_t RenderFirstFrame() override; - int32_t GetLatestPts(int64_t &pts) override; - int32_t Init(); void SetPlayerFuncs(); void FillPlayerFuncPart1(); - void FillPlayerFuncPart2(); private: LppVideoStreamerServiceStub(); @@ -117,7 +114,6 @@ public: int32_t SetLppAudioStreamerId(MessageParcel &data, MessageParcel &reply); int32_t GetStreamerId(MessageParcel &data, MessageParcel &reply); int32_t RenderFirstFrame(MessageParcel &data, MessageParcel &reply); - int32_t GetLatestPts(MessageParcel &data, MessageParcel &reply); std::shared_ptr lppVideoPlayerServer_ = nullptr; std::map> playerFuncs_; diff --git a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp index 0f7725305..34462bbe3 100644 --- a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp +++ b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp @@ -287,15 +287,6 @@ int32_t LppVideoStreamerServer::SetLppVideoStreamerCallback(const std::shared_pt return MSERR_OK; } -int32_t LppVideoStreamerServer::GetLatestPts(int64_t &pts) -{ - MEDIA_LOGI("LppVideoStreamerServer GetLatestPts"); - CHECK_AND_RETURN_RET_LOG(streamerEngine_ != nullptr, MSERR_INVALID_OPERATION, "streamerEngine_ is nullptr"); - auto ret = streamerEngine_->GetLatestPts(pts); - CHECK_AND_RETURN_RET_LOG(ret == MSERR_OK, ret, "GetLatestPts Failed!"); - return ret; -} - int32_t LppVideoStreamerServer::SetLppAudioStreamerId(const std::string audioStreamId) { MEDIA_LOGI("LppVideoStreamerServer SetLppAudioStreamerId"); diff --git a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h index 0fbf7b171..beec97728 100644 --- a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h +++ b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h @@ -94,8 +94,6 @@ public: int32_t RenderFirstFrame() override; - int32_t GetLatestPts(int64_t &pts) override; - void OnDataNeeded(const int32_t maxBufferSize, const int32_t maxFrameNum) override; bool OnAnchorUpdateNeeded(int64_t &anchorPts, int64_t &anchorClk) override; void OnError(const MediaServiceErrCode errCode, const std::string &errMsg) override; diff --git a/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h b/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h index 0f78ba26d..85e72ad28 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h @@ -1,56 +1,55 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef I_LPP_SYNC_MANAGER_H -#define I_LPP_SYNC_MANAGER_H -#include -#include -#include "format.h" -#include "i_lpp_video_streamer.h" -#include "pipeline/pipeline.h" - -namespace OHOS { -namespace Media { - -class ILppSyncManager : public std::enable_shared_from_this { -public: - virtual ~ILppSyncManager() = default; - MOCK_METHOD(int32_t, Init, ()); - MOCK_METHOD(int32_t, GetTimeAnchor, (int64_t &anchorPts, int64_t &anchorClock)); - MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId)); - MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId)); - MOCK_METHOD(int32_t, Prepare, ()); - MOCK_METHOD(int32_t, StartRender, ()); - MOCK_METHOD(int32_t, RenderNextFrame, ()); - MOCK_METHOD(int32_t, Pause, ()); - MOCK_METHOD(int32_t, Resume, ()); - MOCK_METHOD(int32_t, Flush, ()); - MOCK_METHOD(int32_t, Stop, ()); - MOCK_METHOD(int32_t, Reset, ()); - MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs)); - MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); - MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters)); - MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters)); - MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk)); - MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap)); - MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); - MOCK_METHOD(int32_t, GetShareBuffer, (int32_t &fd)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); - MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp)); - MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); - MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); -}; -} -} +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef I_LPP_SYNC_MANAGER_H +#define I_LPP_SYNC_MANAGER_H +#include +#include +#include "format.h" +#include "i_lpp_video_streamer.h" +#include "pipeline/pipeline.h" + +namespace OHOS { +namespace Media { + +class ILppSyncManager : public std::enable_shared_from_this { +public: + virtual ~ILppSyncManager() = default; + MOCK_METHOD(int32_t, Init, ()); + MOCK_METHOD(int32_t, GetTimeAnchor, (int64_t &anchorPts, int64_t &anchorClock)); + MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId)); + MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId)); + MOCK_METHOD(int32_t, Prepare, ()); + MOCK_METHOD(int32_t, StartRender, ()); + MOCK_METHOD(int32_t, RenderNextFrame, ()); + MOCK_METHOD(int32_t, Pause, ()); + MOCK_METHOD(int32_t, Resume, ()); + MOCK_METHOD(int32_t, Flush, ()); + MOCK_METHOD(int32_t, Stop, ()); + MOCK_METHOD(int32_t, Reset, ()); + MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs)); + MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); + MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters)); + MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters)); + MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk)); + MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap)); + MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); + MOCK_METHOD(int32_t, GetShareBuffer, (int32_t &fd)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); + MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp)); + MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); +}; +} +} #endif \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h index e43d47920..1b9af148f 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h +++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h @@ -1,88 +1,87 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef HILPP_VSTREAMER_IMPL_H -#define HILPP_VSTREAMER_IMPL_H -#include "i_lpp_video_streamer.h" -#include "i_lpp_sync_manager.h" -#include "pipeline/pipeline.h" -#include "lpp_video_data_manager.h" -#include "lpp_vdec_adapter.h" -#include "lpp_video_callback_looper.h" -#include "video_decoder_adapter.h" -#include "i_lpp_engine_manager.h" - -namespace OHOS { -namespace Media { - -class HiLppVideoStreamerImpl : public ILppVideoStreamerEngine, - public std::enable_shared_from_this { -public: - HiLppVideoStreamerImpl(); - ~HiLppVideoStreamerImpl() override; - int32_t Init(const std::string &mime) override; - int32_t SetObs(const std::weak_ptr &obs) override; - int32_t SetParameter(const Format ¶m) override; - int32_t Configure(const Format ¶m) override; - int32_t SetVideoSurface(sptr surface) override; - int32_t Prepare() override; - int32_t StartDecode() override; - int32_t StartRender() override; - int32_t Pause() override; - int32_t Resume() override; - int32_t Flush() override; - int32_t Stop() override; - int32_t Reset() override; - int32_t SetPlaybackSpeed(const float playbackSpeed) override; - int32_t SetSyncAudioStreamer(int streamerId) override; - int32_t SetTargetStartFrame(const int64_t targetPts, const int timeoutMs) override; - int32_t ReturnFrames(sptr framePacket) override; - int32_t SetLppAudioStreamerId(std::string audioStreamerId) override; - std::string GetStreamerId() override; - std::shared_ptr GetLppSyncManager() override; - int32_t RenderFirstFrame() override; - int32_t GetLatestPts(int64_t &pts) override; - void OnEvent(const Event &event); - -private: - void InitLppMode(); - void HandleDataNeededEvent(const Event &event); - void HandleFirstFrameReadyEvent(const Event &event); - void HandleRenderStartedEvent(const Event &event); - void HandleCompleteEvent(const Event &event); - void HandleResolutionChangeEvent(const Event &event); - void HandleTargetArrivedEvent(const Event &event); - int32_t EosPause(); - void HandleErrorEvent(const Event &event); - - bool isLpp_{false}; - std::string streamerId_{}; - int32_t channelId_{}; - int32_t shareBufferFd_{}; - sptr surface_{nullptr}; - std::shared_ptr dataMgr_{nullptr}; - std::shared_ptr vdec_{nullptr}; - std::shared_ptr syncMgr_{nullptr}; - std::shared_ptr callbackLooper_{nullptr}; - std::string audioStreamerId_{}; - std::weak_ptr audioStreamerEngine_; - std::shared_ptr eventReceiver_ {nullptr}; - - bool isChannelSetDone_ {false}; - bool isPaused_ {false}; - std::mutex pauseMutex_ {}; -}; -} // namespace Media -} // namespace OHOS +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef HILPP_VSTREAMER_IMPL_H +#define HILPP_VSTREAMER_IMPL_H +#include "i_lpp_video_streamer.h" +#include "i_lpp_sync_manager.h" +#include "pipeline/pipeline.h" +#include "lpp_video_data_manager.h" +#include "lpp_vdec_adapter.h" +#include "lpp_video_callback_looper.h" +#include "video_decoder_adapter.h" +#include "i_lpp_engine_manager.h" + +namespace OHOS { +namespace Media { + +class HiLppVideoStreamerImpl : public ILppVideoStreamerEngine, + public std::enable_shared_from_this { +public: + HiLppVideoStreamerImpl(); + ~HiLppVideoStreamerImpl() override; + int32_t Init(const std::string &mime) override; + int32_t SetObs(const std::weak_ptr &obs) override; + int32_t SetParameter(const Format ¶m) override; + int32_t Configure(const Format ¶m) override; + int32_t SetVideoSurface(sptr surface) override; + int32_t Prepare() override; + int32_t StartDecode() override; + int32_t StartRender() override; + int32_t Pause() override; + int32_t Resume() override; + int32_t Flush() override; + int32_t Stop() override; + int32_t Reset() override; + int32_t SetPlaybackSpeed(const float playbackSpeed) override; + int32_t SetSyncAudioStreamer(int streamerId) override; + int32_t SetTargetStartFrame(const int64_t targetPts, const int timeoutMs) override; + int32_t ReturnFrames(sptr framePacket) override; + int32_t SetLppAudioStreamerId(std::string audioStreamerId) override; + std::string GetStreamerId() override; + std::shared_ptr GetLppSyncManager() override; + int32_t RenderFirstFrame() override; + void OnEvent(const Event &event); + +private: + void InitLppMode(); + void HandleDataNeededEvent(const Event &event); + void HandleFirstFrameReadyEvent(const Event &event); + void HandleRenderStartedEvent(const Event &event); + void HandleCompleteEvent(const Event &event); + void HandleResolutionChangeEvent(const Event &event); + void HandleTargetArrivedEvent(const Event &event); + int32_t EosPause(); + void HandleErrorEvent(const Event &event); + + bool isLpp_{false}; + std::string streamerId_{}; + int32_t channelId_{}; + int32_t shareBufferFd_{}; + sptr surface_{nullptr}; + std::shared_ptr dataMgr_{nullptr}; + std::shared_ptr vdec_{nullptr}; + std::shared_ptr syncMgr_{nullptr}; + std::shared_ptr callbackLooper_{nullptr}; + std::string audioStreamerId_{}; + std::weak_ptr audioStreamerEngine_; + std::shared_ptr eventReceiver_ {nullptr}; + + bool isChannelSetDone_ {false}; + bool isPaused_ {false}; + std::mutex pauseMutex_ {}; +}; +} // namespace Media +} // namespace OHOS #endif \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h index 41bcde079..5cb2d3df5 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h @@ -1,60 +1,59 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef LPP_SYNC_MANAGER_H -#define LPP_SYNC_MANAGER_H - -#include -#include "i_lpp_sync_manager.h" -#include "lpp_sync_manager_adapter.h" -#include "pipeline/pipeline.h" - -namespace OHOS { -namespace Media { -class LppSyncManager : public ILppSyncManager { -public: - explicit LppSyncManager(std::string videoStreamerId, bool isLpp) - { - (void)videoStreamerId; - (void)isLpp; - } - ~LppSyncManager() {}; - MOCK_METHOD(int32_t, Init, (), (override)); - MOCK_METHOD(int32_t, GetTimeAnchor, (int64_t&, int64_t&), (override)); - MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId), (override)); - MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId), (override)); - MOCK_METHOD(int32_t, Prepare, (), (override)); - MOCK_METHOD(int32_t, StartRender, (), (override)); - MOCK_METHOD(int32_t, RenderNextFrame, (), (override)); - MOCK_METHOD(int32_t, Pause, (), (override)); - MOCK_METHOD(int32_t, Resume, (), (override)); - MOCK_METHOD(int32_t, Flush, (), (override)); - MOCK_METHOD(int32_t, Stop, (), (override)); - MOCK_METHOD(int32_t, Reset, (), (override)); - MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs), (override)); - MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed), (override)); - MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters), (override)); - MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters), (override)); - MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk), (override)); - MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap), (override)); - MOCK_METHOD(int32_t, UnbindOutputBuffers, (), (override)); - MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd), (override)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId), (override)); - MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp), (override)); - MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver), (override)); - MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts), (override)); -}; -} // namespace Media -} // namespace OHOS +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef LPP_SYNC_MANAGER_H +#define LPP_SYNC_MANAGER_H + +#include +#include "i_lpp_sync_manager.h" +#include "lpp_sync_manager_adapter.h" +#include "pipeline/pipeline.h" + +namespace OHOS { +namespace Media { +class LppSyncManager : public ILppSyncManager { +public: + explicit LppSyncManager(std::string videoStreamerId, bool isLpp) + { + (void)videoStreamerId; + (void)isLpp; + } + ~LppSyncManager() {}; + MOCK_METHOD(int32_t, Init, (), (override)); + MOCK_METHOD(int32_t, GetTimeAnchor, (int64_t&, int64_t&), (override)); + MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId), (override)); + MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId), (override)); + MOCK_METHOD(int32_t, Prepare, (), (override)); + MOCK_METHOD(int32_t, StartRender, (), (override)); + MOCK_METHOD(int32_t, RenderNextFrame, (), (override)); + MOCK_METHOD(int32_t, Pause, (), (override)); + MOCK_METHOD(int32_t, Resume, (), (override)); + MOCK_METHOD(int32_t, Flush, (), (override)); + MOCK_METHOD(int32_t, Stop, (), (override)); + MOCK_METHOD(int32_t, Reset, (), (override)); + MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs), (override)); + MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed), (override)); + MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters), (override)); + MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters), (override)); + MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk), (override)); + MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap), (override)); + MOCK_METHOD(int32_t, UnbindOutputBuffers, (), (override)); + MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd), (override)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId), (override)); + MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp), (override)); + MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver), (override)); +}; +} // namespace Media +} // namespace OHOS #endif \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h index e4f713430..2736d4528 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h +++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h @@ -1,76 +1,75 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef LPP_SYNC_MANAGER_ADAPTER_H -#define LPP_SYNC_MANAGER_ADAPTER_H - -#include -#include -#include -#include - -#include "media_core.h" -#include "player.h" -#include "surface_buffer.h" -#include "pipeline/pipeline.h" - -namespace OHOS { -namespace Media { -class LppSyncManagerAdapter : public std::enable_shared_from_this { -public: - MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId)); - MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId)); - MOCK_METHOD(int32_t, Init, ()); - MOCK_METHOD(int32_t, StartRender, ()); - MOCK_METHOD(int32_t, RenderNextFrame, ()); - MOCK_METHOD(int32_t, Pause, ()); - MOCK_METHOD(int32_t, Resume, ()); - MOCK_METHOD(int32_t, Flush, ()); - MOCK_METHOD(int32_t, Stop, ()); - MOCK_METHOD(int32_t, Reset, ()); - MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs)); - MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); - MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters)); - MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters)); - MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk)); - MOCK_METHOD(int32_t, LoadAdapter, (uint32_t& instanceId)); - MOCK_METHOD(int32_t, UnloadAdapter, (uint32_t instanceId)); - MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap)); - MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); - MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); - MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); - MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); -}; - -class LowPowerPlayerFactory { -public: - static int32_t CreateLppSyncManagerAdapter(uint32_t &instanceId, std::shared_ptr &adapter) - { - instanceId = 1; - if (adapter != nullptr) { - return 0; - } - adapter = std::make_shared(); - return 0; - } - static int32_t DestroyLppSyncManagerAdapter( - const uint32_t instanceId, std::shared_ptr adapter) - { - return 0; - } -}; -} // namespace Media -} // namespace OHOS +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef LPP_SYNC_MANAGER_ADAPTER_H +#define LPP_SYNC_MANAGER_ADAPTER_H + +#include +#include +#include +#include + +#include "media_core.h" +#include "player.h" +#include "surface_buffer.h" +#include "pipeline/pipeline.h" + +namespace OHOS { +namespace Media { +class LppSyncManagerAdapter : public std::enable_shared_from_this { +public: + MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId)); + MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId)); + MOCK_METHOD(int32_t, Init, ()); + MOCK_METHOD(int32_t, StartRender, ()); + MOCK_METHOD(int32_t, RenderNextFrame, ()); + MOCK_METHOD(int32_t, Pause, ()); + MOCK_METHOD(int32_t, Resume, ()); + MOCK_METHOD(int32_t, Flush, ()); + MOCK_METHOD(int32_t, Stop, ()); + MOCK_METHOD(int32_t, Reset, ()); + MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs)); + MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); + MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters)); + MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters)); + MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk)); + MOCK_METHOD(int32_t, LoadAdapter, (uint32_t& instanceId)); + MOCK_METHOD(int32_t, UnloadAdapter, (uint32_t instanceId)); + MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap)); + MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); + MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); + MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); +}; + +class LowPowerPlayerFactory { +public: + static int32_t CreateLppSyncManagerAdapter(uint32_t &instanceId, std::shared_ptr &adapter) + { + instanceId = 1; + if (adapter != nullptr) { + return 0; + } + adapter = std::make_shared(); + return 0; + } + static int32_t DestroyLppSyncManagerAdapter( + const uint32_t instanceId, std::shared_ptr adapter) + { + return 0; + } +}; +} // namespace Media +} // namespace OHOS #endif // LPP_SYNC_MANAGER_ADAPTER_H \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h index 4d467c105..9224148f3 100644 --- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h +++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h @@ -1,60 +1,59 @@ -/* - * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_HDI_LOW_POWER_PLAYER_V1_0_ILPPSYNCMANAGERADAPTER_H -#define OHOS_HDI_LOW_POWER_PLAYER_V1_0_ILPPSYNCMANAGERADAPTER_H - -#include -#include -#include - -#include "ilpp_sync_manager_callback.h" -#include "surface_buffer.h" -#include "../native_buffer.h" -#include "hdf_base.h" - -namespace OHOS { -namespace HDI { -namespace LowPowerPlayer { -namespace V1_0 { -using namespace OHOS::HDI::Base; -class ILppSyncManagerAdapter : public RefBase { -public: - MOCK_METHOD(int32_t, SetVideoChannelId, (uint32_t channelId)); - MOCK_METHOD(int32_t, SetAudioChannelId, (uint32_t channelId)); - MOCK_METHOD(int32_t, StartRender, ()); - MOCK_METHOD(int32_t, RenderNextFrame, ()); - MOCK_METHOD(int32_t, Pause, ()); - MOCK_METHOD(int32_t, Resume, ()); - MOCK_METHOD(int32_t, Flush, ()); - MOCK_METHOD(int32_t, Stop, ()); - MOCK_METHOD(int32_t, Reset, ()); - MOCK_METHOD(int32_t, SetTargetStartFrame, (uint64_t framePts, uint32_t timeoutMs)); - MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); - MOCK_METHOD(int32_t, RegisterCallback, (const sptr& syncCallback)); - MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameter)); - MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameter)); - MOCK_METHOD(int32_t, UpdateTimeAnchor, (int64_t anchorPts, int64_t anchorClk)); - MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& outputBuffers)); - MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); - MOCK_METHOD(int32_t, GetShareBuffer, (int& fd)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); - MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); -}; -} // V1_0 -} // LowPowerPlayer -} // HDI -} // OHOS +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_HDI_LOW_POWER_PLAYER_V1_0_ILPPSYNCMANAGERADAPTER_H +#define OHOS_HDI_LOW_POWER_PLAYER_V1_0_ILPPSYNCMANAGERADAPTER_H + +#include +#include +#include + +#include "ilpp_sync_manager_callback.h" +#include "surface_buffer.h" +#include "../native_buffer.h" +#include "hdf_base.h" + +namespace OHOS { +namespace HDI { +namespace LowPowerPlayer { +namespace V1_0 { +using namespace OHOS::HDI::Base; +class ILppSyncManagerAdapter : public RefBase { +public: + MOCK_METHOD(int32_t, SetVideoChannelId, (uint32_t channelId)); + MOCK_METHOD(int32_t, SetAudioChannelId, (uint32_t channelId)); + MOCK_METHOD(int32_t, StartRender, ()); + MOCK_METHOD(int32_t, RenderNextFrame, ()); + MOCK_METHOD(int32_t, Pause, ()); + MOCK_METHOD(int32_t, Resume, ()); + MOCK_METHOD(int32_t, Flush, ()); + MOCK_METHOD(int32_t, Stop, ()); + MOCK_METHOD(int32_t, Reset, ()); + MOCK_METHOD(int32_t, SetTargetStartFrame, (uint64_t framePts, uint32_t timeoutMs)); + MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); + MOCK_METHOD(int32_t, RegisterCallback, (const sptr& syncCallback)); + MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameter)); + MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameter)); + MOCK_METHOD(int32_t, UpdateTimeAnchor, (int64_t anchorPts, int64_t anchorClk)); + MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& outputBuffers)); + MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); + MOCK_METHOD(int32_t, GetShareBuffer, (int& fd)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); +}; +} // V1_0 +} // LowPowerPlayer +} // HDI +} // OHOS #endif // OHOS_HDI_LOW_POWER_PLAYER_V1_0_ILPPSYNCMANAGERADAPTER_H \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h index 75203ceba..3f3755f5a 100644 --- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h @@ -1,71 +1,71 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef LPP_SYNC_MANAGER_H -#define LPP_SYNC_MANAGER_H - -#include "lpp_sync_manager_adapter.h" -#include "osal/task/task.h" - -namespace OHOS { -namespace Media { - -class LppSyncManager : public std::enable_shared_from_this { -public: - explicit LppSyncManager(std::string videoStreamerId, bool isLpp); - ~LppSyncManager(); - int32_t GetTimeAnchor(int64_t &anchorPts, int64_t &anchorClock); - - int32_t SetVideoChannelId(const uint32_t channelId); - int32_t SetAudioChannelId(const uint32_t channelId); - int32_t Init(); - int32_t Prepare(); - int32_t StartRender(); - int32_t RenderNextFrame(); - int32_t Pause(); - int32_t Resume(); - int32_t Flush(); - int32_t Stop(); - int32_t Reset(); - int32_t SetTargetStartFrame(const uint64_t targetPts, uint32_t timeoutMs = 0); - int32_t SetPlaybackSpeed(float speed); - int32_t SetParameter(const std::map ¶meters); - int32_t GetParameter(std::map ¶meters); - int32_t UpdateTimeAnchor(const int64_t anchorPts, const int64_t anchorClk); - int32_t BindOutputBuffers(const std::map> &bufferMap); - int32_t UnbindOutputBuffers(); - int32_t GetShareBuffer(int32_t &fd); - int32_t SetTunnelId(uint64_t tunnelId); - int32_t SetAudioIsLpp(bool isLpp); - void SetEventReceiver(std::shared_ptr eventReceiver); - int32_t GetLatestPts(int64_t &pts); -private: - void ResetTimeAnchor(); - - uint32_t adapterId_ {0}; - std::string videoStreamerId_ {}; - std::shared_ptr adapter_ {nullptr}; - bool videoIsLpp_ {true}; - bool audioIsLpp_ {false}; - std::mutex anchorMutex_{}; - uint64_t localAnchorPts_ {0}; - uint64_t localAnchorClk_ {0}; - std::unique_ptr synctask_ {nullptr}; - std::shared_ptr eventReceiver_ {nullptr}; -}; - -} // namespace Media -} // namespace OHOS - +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef LPP_SYNC_MANAGER_H +#define LPP_SYNC_MANAGER_H + +#include "lpp_sync_manager_adapter.h" +#include "osal/task/task.h" + +namespace OHOS { +namespace Media { + +class LppSyncManager : public std::enable_shared_from_this { +public: + explicit LppSyncManager(std::string videoStreamerId, bool isLpp); + ~LppSyncManager(); + int32_t GetTimeAnchor(int64_t &anchorPts, int64_t &anchorClock); + + int32_t SetVideoChannelId(const uint32_t channelId); + int32_t SetAudioChannelId(const uint32_t channelId); + int32_t Init(); + int32_t Prepare(); + int32_t StartRender(); + int32_t RenderNextFrame(); + int32_t Pause(); + int32_t Resume(); + int32_t Flush(); + int32_t Stop(); + int32_t Reset(); + int32_t SetTargetStartFrame(const uint64_t targetPts, uint32_t timeoutMs = 0); + int32_t SetPlaybackSpeed(float speed); + int32_t SetParameter(const std::map ¶meters); + int32_t GetParameter(std::map ¶meters); + int32_t UpdateTimeAnchor(const int64_t anchorPts, const int64_t anchorClk); + int32_t BindOutputBuffers(const std::map> &bufferMap); + int32_t UnbindOutputBuffers(); + int32_t GetShareBuffer(int32_t &fd); + int32_t SetTunnelId(uint64_t tunnelId); + int32_t SetAudioIsLpp(bool isLpp); + void SetEventReceiver(std::shared_ptr eventReceiver); + +private: + void ResetTimeAnchor(); + + uint32_t adapterId_ {0}; + std::string videoStreamerId_ {}; + std::shared_ptr adapter_ {nullptr}; + bool videoIsLpp_ {true}; + bool audioIsLpp_ {false}; + std::mutex anchorMutex_{}; + uint64_t localAnchorPts_ {0}; + uint64_t localAnchorClk_ {0}; + std::unique_ptr synctask_ {nullptr}; + std::shared_ptr eventReceiver_ {nullptr}; +}; + +} // namespace Media +} // namespace OHOS + #endif \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h index 31cfa94e7..c9ea2f2e3 100644 --- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h +++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h @@ -1,78 +1,77 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef LPP_SYNC_MANAGER_ADAPTER_H -#define LPP_SYNC_MANAGER_ADAPTER_H - -#include -#include -#include -#include - -#include "media_core.h" -#include "player.h" -#include "surface_buffer.h" -#include "pipeline/pipeline.h" - -namespace OHOS { -namespace Media { - -class LppSyncManagerAdapter : public std::enable_shared_from_this { -public: - MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId)); - MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId)); - MOCK_METHOD(int32_t, Init, ()); - MOCK_METHOD(int32_t, StartRender, ()); - MOCK_METHOD(int32_t, RenderNextFrame, ()); - MOCK_METHOD(int32_t, Pause, ()); - MOCK_METHOD(int32_t, Resume, ()); - MOCK_METHOD(int32_t, Flush, ()); - MOCK_METHOD(int32_t, Stop, ()); - MOCK_METHOD(int32_t, Reset, ()); - MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs)); - MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); - MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters)); - MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters)); - MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk)); - MOCK_METHOD(int32_t, LoadAdapter, (uint32_t& instanceId)); - MOCK_METHOD(int32_t, UnloadAdapter, (uint32_t instanceId)); - MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap)); - MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); - MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); - MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); - MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); -}; - -class LowPowerPlayerFactory { -public: - static int32_t CreateLppSyncManagerAdapter(uint32_t &instanceId, std::shared_ptr &adapter) - { - instanceId = 1; - if (adapter != nullptr) { - return 0; - } - adapter = std::make_shared(); - return 0; - } - static int32_t DestroyLppSyncManagerAdapter( - const uint32_t instanceId, std::shared_ptr adapter) - { - return 0; - } -}; - -} // namespace Media -} // namespace OHOS +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef LPP_SYNC_MANAGER_ADAPTER_H +#define LPP_SYNC_MANAGER_ADAPTER_H + +#include +#include +#include +#include + +#include "media_core.h" +#include "player.h" +#include "surface_buffer.h" +#include "pipeline/pipeline.h" + +namespace OHOS { +namespace Media { + +class LppSyncManagerAdapter : public std::enable_shared_from_this { +public: + MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId)); + MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId)); + MOCK_METHOD(int32_t, Init, ()); + MOCK_METHOD(int32_t, StartRender, ()); + MOCK_METHOD(int32_t, RenderNextFrame, ()); + MOCK_METHOD(int32_t, Pause, ()); + MOCK_METHOD(int32_t, Resume, ()); + MOCK_METHOD(int32_t, Flush, ()); + MOCK_METHOD(int32_t, Stop, ()); + MOCK_METHOD(int32_t, Reset, ()); + MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs)); + MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); + MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters)); + MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters)); + MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk)); + MOCK_METHOD(int32_t, LoadAdapter, (uint32_t& instanceId)); + MOCK_METHOD(int32_t, UnloadAdapter, (uint32_t instanceId)); + MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap)); + MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); + MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); + MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); +}; + +class LowPowerPlayerFactory { +public: + static int32_t CreateLppSyncManagerAdapter(uint32_t &instanceId, std::shared_ptr &adapter) + { + instanceId = 1; + if (adapter != nullptr) { + return 0; + } + adapter = std::make_shared(); + return 0; + } + static int32_t DestroyLppSyncManagerAdapter( + const uint32_t instanceId, std::shared_ptr adapter) + { + return 0; + } +}; + +} // namespace Media +} // namespace OHOS #endif // LPP_SYNC_MANAGER_ADAPTER_H \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h index 496edb438..dbb510bf4 100644 --- a/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h @@ -1,59 +1,58 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef LPP_SYNC_MANAGER_H -#define LPP_SYNC_MANAGER_H - -#include -#include "i_lpp_sync_manager.h" -#include "pipeline/pipeline.h" - -namespace OHOS { -namespace Media { -class LppSyncManager : public ILppSyncManager { -public: - explicit LppSyncManager(std::string videoStreamerId, bool isLpp) - { - (void)videoStreamerId; - (void)isLpp; - } - ~LppSyncManager() {}; - MOCK_METHOD(int32_t, Init, (), (override)); - MOCK_METHOD(int32_t, GetTimeAnchor, (int64_t&, int64_t&), (override)); - MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId), (override)); - MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId), (override)); - MOCK_METHOD(int32_t, Prepare, (), (override)); - MOCK_METHOD(int32_t, StartRender, (), (override)); - MOCK_METHOD(int32_t, RenderNextFrame, (), (override)); - MOCK_METHOD(int32_t, Pause, (), (override)); - MOCK_METHOD(int32_t, Resume, (), (override)); - MOCK_METHOD(int32_t, Flush, (), (override)); - MOCK_METHOD(int32_t, Stop, (), (override)); - MOCK_METHOD(int32_t, Reset, (), (override)); - MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs), (override)); - MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed), (override)); - MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters), (override)); - MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters), (override)); - MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk), (override)); - MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap), (override)); - MOCK_METHOD(int32_t, UnbindOutputBuffers, (), (override)); - MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd), (override)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId), (override)); - MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp), (override)); - MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver), (override)); - MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts), (override)); -}; -} // namespace Media -} // namespace OHOS +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef LPP_SYNC_MANAGER_H +#define LPP_SYNC_MANAGER_H + +#include +#include "i_lpp_sync_manager.h" +#include "pipeline/pipeline.h" + +namespace OHOS { +namespace Media { +class LppSyncManager : public ILppSyncManager { +public: + explicit LppSyncManager(std::string videoStreamerId, bool isLpp) + { + (void)videoStreamerId; + (void)isLpp; + } + ~LppSyncManager() {}; + MOCK_METHOD(int32_t, Init, (), (override)); + MOCK_METHOD(int32_t, GetTimeAnchor, (int64_t&, int64_t&), (override)); + MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId), (override)); + MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId), (override)); + MOCK_METHOD(int32_t, Prepare, (), (override)); + MOCK_METHOD(int32_t, StartRender, (), (override)); + MOCK_METHOD(int32_t, RenderNextFrame, (), (override)); + MOCK_METHOD(int32_t, Pause, (), (override)); + MOCK_METHOD(int32_t, Resume, (), (override)); + MOCK_METHOD(int32_t, Flush, (), (override)); + MOCK_METHOD(int32_t, Stop, (), (override)); + MOCK_METHOD(int32_t, Reset, (), (override)); + MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs), (override)); + MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed), (override)); + MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters), (override)); + MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters), (override)); + MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk), (override)); + MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap), (override)); + MOCK_METHOD(int32_t, UnbindOutputBuffers, (), (override)); + MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd), (override)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId), (override)); + MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp), (override)); + MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver), (override)); +}; +} // namespace Media +} // namespace OHOS #endif \ No newline at end of file -- Gitee From f23158a3828e4854a9ae65e240af2e52b8c04097 Mon Sep 17 00:00:00 2001 From: zpf Date: Fri, 29 Aug 2025 19:38:11 +0800 Subject: [PATCH 5/7] fdfs Signed-off-by: zpf --- ddd.txt | 574 ++++++++++++++++++ .../lppplayer/native_lpp_video_streamer.cpp | 12 + .../video_streamer_impl.cpp | 10 + .../lpp_video_streamer/video_streamer_impl.h | 2 + .../inner_api/native/lpp_video_streamer.h | 2 + interfaces/kits/c/lowpower_video_sink.h | 14 + .../lpp/lpp_sync_manager/lpp_sync_manager.h | 1 + .../lpp_sync_manager_adapter.h | 2 + .../lpp_sync_manager/src/lpp_sync_manager.cpp | 10 + .../src/lpp_sync_manager_adapter.cpp | 8 + .../lpp_video_streamer/hilpp_vstreamer_impl.h | 1 + .../src/hilpp_vstreamer_impl.cpp | 7 + .../include/i_lpp_video_streamer_service.h | 2 + .../services/engine_intf/i_lpp_sync_manager.h | 1 + .../engine_intf/i_lpp_video_streamer.h | 1 + .../client/lpp_video_streamer_client.cpp | 10 + .../client/lpp_video_streamer_client.h | 2 + .../i_standard_lpp_video_streamer_service.h | 3 + .../ipc/lpp_video_streamer_service_proxy.cpp | 19 + .../ipc/lpp_video_streamer_service_proxy.h | 2 + .../ipc/lpp_video_streamer_service_stub.cpp | 24 + .../ipc/lpp_video_streamer_service_stub.h | 4 + .../server/lpp_video_streamer_server.cpp | 9 + .../server/lpp_video_streamer_server.h | 2 + .../corpus/H264_AAC.mp4 | 4 +- .../corpus/H264_MP3.mp4 | 4 +- .../corpus/H265_AAC.mp4 | 4 +- .../corpus/HDR.mp4 | 4 +- .../corpus/MPEG4_MP3.mp4 | 4 +- .../corpus/SDR.mp4 | 4 +- .../transcoderstub_fuzzer/corpus/HDR.mp4 | 4 +- .../transcoderstub_fuzzer/corpus/SDR.mp4 | 4 +- .../mock/i_lpp_sync_manager.h | 109 ++-- .../mock/hilpp_vstreamer_impl.h | 173 +++--- .../mock/lpp_sync_manager.h | 117 ++-- .../mock/lpp_sync_manager_adapter.h | 149 ++--- .../mock/v1_0/ilpp_sync_manager_adapter.h | 117 ++-- .../mock/lpp_sync_manager.h | 140 ++--- .../mock/lpp_sync_manager_adapter.h | 153 ++--- .../mock/lpp_sync_manager.h | 115 ++-- 40 files changed, 1286 insertions(+), 541 deletions(-) create mode 100644 ddd.txt diff --git a/ddd.txt b/ddd.txt new file mode 100644 index 000000000..d89690a4e --- /dev/null +++ b/ddd.txt @@ -0,0 +1,574 @@ +From 33b8f932d957909ccce2c668cc1bbf0a65fd9c07 Mon Sep 17 00:00:00 2001 +From: z00654174 +Date: Thu, 28 Aug 2025 09:55:56 +0800 +Subject: [PATCH] TicketNo:DTS2022071803909 Description: pts Team:OTHERS + Feature or Bugfix:Bugfix Binary Source:NA PrivateCode(Yes/No):No + +Change-Id: Ic56a08bf0e57af135fe5d42d8c021fdd0250cf41 +--- + .../lppplayer/native_lpp_video_streamer.cpp | 12 ++++++++++ + .../video_streamer_impl.cpp | 10 ++++++++ + .../lpp_video_streamer/video_streamer_impl.h | 2 ++ + .../inner_api/native/lpp_video_streamer.h | 2 ++ + interfaces/kits/c/lowpower_video_sink.h | 14 +++++++++++ + .../lpp/lpp_sync_manager/lpp_sync_manager.h | 1 + + .../lpp_sync_manager_adapter.h | 2 ++ + .../lpp_sync_manager/src/lpp_sync_manager.cpp | 10 ++++++++ + .../src/lpp_sync_manager_adapter.cpp | 8 +++++++ + .../lpp_video_streamer/hilpp_vstreamer_impl.h | 1 + + .../src/hilpp_vstreamer_impl.cpp | 7 ++++++ + .../include/i_lpp_video_streamer_service.h | 2 ++ + .../services/engine_intf/i_lpp_sync_manager.h | 1 + + .../engine_intf/i_lpp_video_streamer.h | 1 + + .../client/lpp_video_streamer_client.cpp | 10 ++++++++ + .../client/lpp_video_streamer_client.h | 2 ++ + .../i_standard_lpp_video_streamer_service.h | 3 +++ + .../ipc/lpp_video_streamer_service_proxy.cpp | 19 +++++++++++++++ + .../ipc/lpp_video_streamer_service_proxy.h | 2 ++ + .../ipc/lpp_video_streamer_service_stub.cpp | 24 +++++++++++++++++++ + .../ipc/lpp_video_streamer_service_stub.h | 4 ++++ + .../server/lpp_video_streamer_server.cpp | 9 +++++++ + .../server/lpp_video_streamer_server.h | 2 ++ + .../mock/i_lpp_sync_manager.h | 1 + + .../mock/hilpp_vstreamer_impl.h | 1 + + .../mock/lpp_sync_manager.h | 1 + + .../mock/lpp_sync_manager_adapter.h | 1 + + .../mock/v1_0/ilpp_sync_manager_adapter.h | 1 + + .../mock/lpp_sync_manager.h | 2 +- + .../mock/lpp_sync_manager_adapter.h | 1 + + .../mock/lpp_sync_manager.h | 1 + + 31 files changed, 156 insertions(+), 1 deletion(-) + +diff --git a/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp b/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp +index 2147b2427..5ed1622b2 100644 +--- a/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp ++++ b/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp +@@ -634,6 +634,7 @@ OH_AVErrCode OH_LowPowerVideoSinkCallback_SetStreamChangedListener( + int32_t res = callback->SetStreamChangedListener(onStreamChanged, userData); + return LppMsErrToOHAvErr(res); + } ++ + OH_AVErrCode OH_LowPowerVideoSinkCallback_SetFirstFrameDecodedListener(OH_LowPowerVideoSinkCallback *callback, + OH_LowPowerVideoSink_OnFirstFrameDecoded onFirstFrameDecoded, void *userData) + { +@@ -643,3 +644,14 @@ OH_AVErrCode OH_LowPowerVideoSinkCallback_SetFirstFrameDecodedListener(OH_LowPow + int32_t res = callback->SetFirstFrameReadyListener(onFirstFrameDecoded, userData); + return LppMsErrToOHAvErr(res); + } ++ ++OH_AVErrCode OH_LowPowerVideoSink_GetLatestPts(OH_LowPowerVideoSink *streamer, int64_t *pts) ++{ ++ MEDIA_LOGD("OH_LowPowerVideoSink_GetLatestPts"); ++ CHECK_AND_RETURN_RET_LOG(streamer != nullptr, AV_ERR_INVALID_VAL, "streamer is nullptr!"); ++ LowPowerVideoSinkObject *streamerObj = reinterpret_cast(streamer); ++ CHECK_AND_RETURN_RET_LOG(streamerObj != nullptr, AV_ERR_INVALID_VAL, "streamerObj is nullptr"); ++ CHECK_AND_RETURN_RET_LOG(streamerObj->videoStreamer_ != nullptr, AV_ERR_INVALID_VAL, "videoStreamer_ is nullptr"); ++ int32_t res = streamerObj->videoStreamer_->GetLatestPts(*pts); ++ return LppMsErrToOHAvErr(res); ++} +diff --git a/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp b/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp +index f7adadd72..414b33325 100644 +--- a/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp ++++ b/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp +@@ -262,5 +262,15 @@ std::string VideoStreamerImpl::GetStreamerId() + CHECK_AND_RETURN_RET_LOG(streamerService_ != nullptr, "", "player service does not exist.."); + return streamerService_->GetStreamerId(); + } ++ ++int32_t VideoStreamerImpl::GetLatestPts(int64_t &pts) ++{ ++ MEDIA_LOGI("VideoStreamerImpl GetLatestPts"); ++ CHECK_AND_RETURN_RET_LOG(streamerService_ != nullptr, MSERR_SERVICE_DIED, ++ "GetLatestPts player service does not exist.."); ++ int32_t ret = streamerService_->GetLatestPts(pts); ++ pts = (ret == MSERR_OK) ? pts : 0; ++ return ret; ++} + } // namespace Media + } // namespace OHOS +diff --git a/frameworks/native/lpp_video_streamer/video_streamer_impl.h b/frameworks/native/lpp_video_streamer/video_streamer_impl.h +index 16015c442..1a0b1e3e9 100644 +--- a/frameworks/native/lpp_video_streamer/video_streamer_impl.h ++++ b/frameworks/native/lpp_video_streamer/video_streamer_impl.h +@@ -76,6 +76,8 @@ public: + + std::string GetStreamerId() override; + ++ int32_t GetLatestPts(int64_t &pts) override; ++ + private: + std::shared_ptr callback_; + std::shared_ptr streamerService_ = nullptr; +diff --git a/interfaces/inner_api/native/lpp_video_streamer.h b/interfaces/inner_api/native/lpp_video_streamer.h +index d29cd78a0..34de7d154 100644 +--- a/interfaces/inner_api/native/lpp_video_streamer.h ++++ b/interfaces/inner_api/native/lpp_video_streamer.h +@@ -103,6 +103,8 @@ public: + virtual int32_t RenderFirstFrame() = 0; + + virtual std::string GetStreamerId() = 0; ++ ++ virtual int32_t GetLatestPts(int64_t &pts) = 0; + }; + + class __attribute__((visibility("default"))) VideoStreamerFactory { +diff --git a/interfaces/kits/c/lowpower_video_sink.h b/interfaces/kits/c/lowpower_video_sink.h +index d1c11f7e3..f74db9821 100644 +--- a/interfaces/kits/c/lowpower_video_sink.h ++++ b/interfaces/kits/c/lowpower_video_sink.h +@@ -314,6 +314,20 @@ OH_AVErrCode OH_LowPowerVideoSink_SetTargetStartFrame( + const int64_t timeoutMs, + void* userData); + ++/** ++ * @brief Get the latest presentation timestamp (PTS) from lowpower video sink. ++ * ++ * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance. ++ * @param {int64_t*} pts Pointer to store the latest PTS value (in microseconds). ++ * @return Returns AV_ERR_OK if the timestamp is obtained successfully; ++ * otherwise, returns a specific error code as defined in {@link OH_AVErrCode}: ++ * {@link AV_ERR_INVALID_VAL} the sink is nullptr, or sink is invalid. ++ * {@link AV_ERR_SERVICE_DIED} media service is died. ++ * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted. ++ * @since 21 ++ */ ++OH_AVErrCode OH_LowPowerVideoSink_GetLatestPts(OH_LowPowerVideoSink *streamer, int64_t *pts); ++ + /** + * @brief Set playback speed for the lowpower video sink + * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance +diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h +index 229bbb003..52029e9a6 100644 +--- a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h ++++ b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h +@@ -50,6 +50,7 @@ public: + int32_t SetTunnelId(uint64_t tunnelId) override; + int32_t SetAudioIsLpp(bool isLpp) override; + void SetEventReceiver(std::shared_ptr eventReceiver) override; ++ int32_t GetLatestPts(int64_t &pts) override; + + private: + void ResetTimeAnchor(); +diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h +index c602d662d..a78c947e6 100644 +--- a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h ++++ b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h +@@ -56,6 +56,8 @@ public: + int32_t UnbindOutputBuffers(); + int32_t GetShareBuffer(int32_t &fd); + int32_t SetTunnelId(uint64_t tunnelId); ++ int32_t GetLatestPts(int64_t &pts); ++ + void OnError(const int32_t errorCode, const std::string &errorMsg); + void OnTargetArrived(const int64_t targetPts, const bool isTimeout); + void OnRenderStarted(); +diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp +index c6b7cdf88..392286602 100644 +--- a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp ++++ b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp +@@ -263,6 +263,16 @@ int32_t LppSyncManager::SetTunnelId(uint64_t tunnelId) + return MSERR_OK; + } + ++int32_t LppSyncManager::GetLatestPts(int64_t &pts) ++{ ++ MEDIA_LOG_I("LppSyncManager::GetLatestPts"); ++ FALSE_RETURN_V_NOLOG(videoIsLpp_, MSERR_UNKNOWN); ++ FALSE_RETURN_V_MSG_E(adapter_ != nullptr, MSERR_INVALID_OPERATION, "adapter_ is nullptr"); ++ auto ret = adapter_->GetLatestPts(pts); ++ FALSE_RETURN_V_MSG_E(ret == MSERR_OK, ret, "adapter_ GetLatestPts failed"); ++ return MSERR_OK; ++} ++ + int32_t LppSyncManager::SetAudioIsLpp(bool isLpp) + { + audioIsLpp_ = isLpp; +diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp +index 87b1d5615..dc5aa9195 100644 +--- a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp ++++ b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp +@@ -321,6 +321,14 @@ int32_t LppSyncManagerAdapter::SetTunnelId(uint64_t tunnelId) + return MSERR_OK; + } + ++int32_t LppSyncManagerAdapter::GetLatestPts(int64_t &pts) ++{ ++ MediaTrace trace("LppSyncManagerAdapter::GetLatestPts"); ++ MEDIA_LOG_I("GetLatestPts enter"); ++ FALSE_RETURN_V_MSG_E(syncMgrAdapter_ != nullptr, MSERR_INVALID_OPERATION, "syncMgrAdapter_ is nullptr"); ++ return syncMgrAdapter_->GetLatestPts(pts); ++} ++ + void LppSyncManagerAdapter::SetEventReceiver(std::shared_ptr eventReceiver) + { + eventReceiver_ = eventReceiver; +diff --git a/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h b/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h +index f39780d21..dd95907cc 100644 +--- a/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h ++++ b/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h +@@ -55,6 +55,7 @@ public: + std::string GetStreamerId() override; + std::shared_ptr GetLppSyncManager() override; + int32_t RenderFirstFrame() override; ++ int32_t GetLatestPts(int64_t &pts) override; + void OnEvent(const Event &event); + + private: +diff --git a/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp b/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp +index 782c14678..3de63dc00 100644 +--- a/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp ++++ b/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp +@@ -130,6 +130,13 @@ int32_t HiLppVideoStreamerImpl::SetParameter(const Format ¶m) + return MSERR_OK; + } + ++int32_t HiLppVideoStreamerImpl::GetLatestPts(int64_t &pts) ++{ ++ MEDIA_LOG_I("HiLppVideoStreamerImpl::GetLatestPts"); ++ FALSE_RETURN_V_MSG(vdec_ != nullptr, MSERR_INVALID_OPERATION, "vdec_ nullptr"); ++ return syncMgr_->GetLatestPts(pts); ++} ++ + int32_t HiLppVideoStreamerImpl::Configure(const Format ¶m) + { + FALSE_RETURN_V_MSG(vdec_ != nullptr, MSERR_INVALID_OPERATION, "vdec_ nullptr"); +diff --git a/services/include/i_lpp_video_streamer_service.h b/services/include/i_lpp_video_streamer_service.h +index ffdc2c52f..770d1470e 100644 +--- a/services/include/i_lpp_video_streamer_service.h ++++ b/services/include/i_lpp_video_streamer_service.h +@@ -75,6 +75,8 @@ public: + virtual std::string GetStreamerId() = 0; + + virtual int32_t RenderFirstFrame() = 0; ++ ++ virtual int32_t GetLatestPts(int64_t &pts) = 0; + }; + } // namespace Media + } // namespace OHOS +diff --git a/services/services/engine_intf/i_lpp_sync_manager.h b/services/services/engine_intf/i_lpp_sync_manager.h +index 2edba8cee..38f9bf540 100644 +--- a/services/services/engine_intf/i_lpp_sync_manager.h ++++ b/services/services/engine_intf/i_lpp_sync_manager.h +@@ -50,6 +50,7 @@ public: + virtual int32_t SetTunnelId(uint64_t tunnelId) = 0; + virtual int32_t SetAudioIsLpp(bool isLpp) = 0; + virtual void SetEventReceiver(std::shared_ptr eventReceiver) = 0; ++ virtual int32_t GetLatestPts(int64_t &pts) = 0; + }; + + } +diff --git a/services/services/engine_intf/i_lpp_video_streamer.h b/services/services/engine_intf/i_lpp_video_streamer.h +index 507230511..c411b1c94 100644 +--- a/services/services/engine_intf/i_lpp_video_streamer.h ++++ b/services/services/engine_intf/i_lpp_video_streamer.h +@@ -66,6 +66,7 @@ public: + virtual std::string GetStreamerId() = 0; + virtual std::shared_ptr GetLppSyncManager() = 0; + virtual int32_t RenderFirstFrame() = 0; ++ virtual int32_t GetLatestPts(int64_t &pts) = 0; + }; + } // namespace Media + } // namespace OHOS +diff --git a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp +index 952fda07b..dae58d353 100644 +--- a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp ++++ b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp +@@ -243,5 +243,15 @@ void LppVideoStreamerClient::MediaServerDied() + "mediaserver is died, please create a new video sink instance again"); + } + } ++ ++int32_t LppVideoStreamerClient::GetLatestPts(int64_t &pts) ++{ ++ MEDIA_LOGI("LppVideoStreamerClient GetLatestPts"); ++ CHECK_AND_RETURN_RET_LOG(playerProxy_ != nullptr, MSERR_SERVICE_DIED, ++ "LppVideoStreamerClient GetLatestPts player service does not exist.."); ++ int32_t ret = playerProxy_->GetLatestPts(pts); ++ CHECK_AND_RETURN_RET_LOG(ret == MSERR_OK, ret, "LppVideoStreamerClient GetLatestPts failed."); ++ return MSERR_OK; ++} + } // namespace Media + } // namespace OHOS +\ No newline at end of file +diff --git a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h +index 7b5a6885d..325f8e4a1 100644 +--- a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h ++++ b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h +@@ -76,6 +76,8 @@ public: + + int32_t RenderFirstFrame() override; + ++ int32_t GetLatestPts(int64_t &pts) override; ++ + void MediaServerDied(); + + private: +diff --git a/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h b/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h +index 32982afbf..c9928ef1d 100644 +--- a/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h ++++ b/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h +@@ -80,6 +80,8 @@ public: + + virtual int32_t RenderFirstFrame() = 0; + ++ virtual int32_t GetLatestPts(int64_t &pts) = 0; ++ + /** + * IPC code ID + */ +@@ -109,6 +111,7 @@ public: + GET_STREAM_ID, + SET_AUDIO_STREAMER_ID, + RENDER_FIRST_FRAME, ++ GET_LATEST_PTS, + MAX_IPC_ID, // all IPC codes should be added before MAX_IPC_ID + }; + +diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp +index c4556605e..898d65663 100644 +--- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp ++++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp +@@ -429,5 +429,24 @@ int32_t LppVideoStreamerServiceProxy::RenderFirstFrame() + return reply.ReadInt32(); + } + ++int32_t LppVideoStreamerServiceProxy::GetLatestPts(int64_t &pts) ++{ ++ MEDIA_LOGI("LppVideoStreamerServiceProxy GetLatestPts"); ++ MessageParcel data; ++ MessageParcel reply; ++ MessageOption option; ++ ++ bool token = data.WriteInterfaceToken(LppVideoStreamerServiceProxy::GetDescriptor()); ++ CHECK_AND_RETURN_RET_LOG(token, MSERR_INVALID_OPERATION, "Failed to write descriptor!"); ++ ++ int32_t error = Remote()->SendRequest(GET_LATEST_PTS, data, reply, option); ++ CHECK_AND_RETURN_RET_LOG( ++ error == MSERR_OK, MSERR_INVALID_OPERATION, "GetLatestPts SendRequest failed, error: %{public}d", error); ++ int32_t ret = reply.ReadInt32(); ++ pts = reply.ReadInt64(); ++ CHECK_AND_RETURN_RET_LOG( ++ ret == MSERR_OK, MSERR_INVALID_OPERATION, "GetLatestPts failed, error: %{public}d", ret); ++ return ret; ++} + } // namespace Media + } // namespace OHOS +diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h +index efc84e5a7..3ba478a87 100755 +--- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h ++++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h +@@ -74,6 +74,8 @@ public: + + std::string GetStreamerId() override; + ++ int32_t GetLatestPts(int64_t &pts) override; ++ + int32_t RenderFirstFrame() override; + private: + static inline BrokerDelegator delegator_; +diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp +index a3c2b2974..3c2caa459 100755 +--- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp ++++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp +@@ -82,6 +82,7 @@ int32_t LppVideoStreamerServiceStub::Init() + void LppVideoStreamerServiceStub::SetPlayerFuncs() + { + FillPlayerFuncPart1(); ++ FillPlayerFuncPart2(); + } + + void LppVideoStreamerServiceStub::FillPlayerFuncPart1() +@@ -136,6 +137,12 @@ void LppVideoStreamerServiceStub::FillPlayerFuncPart1() + [this](MessageParcel &data, MessageParcel &reply) { return RenderFirstFrame(data, reply); }}; + } + ++void LppVideoStreamerServiceStub::FillPlayerFuncPart2() ++{ ++ playerFuncs_[GET_LATEST_PTS] = {"Player::GetLatestPts", ++ [this](MessageParcel &data, MessageParcel &reply) { return GetLatestPts(data, reply); }}; ++} ++ + int LppVideoStreamerServiceStub::OnRemoteRequest( + uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) + { +@@ -532,5 +539,22 @@ int32_t LppVideoStreamerServiceStub::RenderFirstFrame(MessageParcel &data, Messa + return MSERR_OK; + } + ++int32_t LppVideoStreamerServiceStub::GetLatestPts(int64_t &pts) ++{ ++ MEDIA_LOGI("LppVideoStreamerServiceStub::GetLatestPts"); ++ CHECK_AND_RETURN_RET_LOG(lppVideoPlayerServer_ != nullptr, MSERR_INVALID_OPERATION, "player server is nullptr"); ++ return lppVideoPlayerServer_->GetLatestPts(pts); ++} ++ ++int32_t LppVideoStreamerServiceStub::GetLatestPts(MessageParcel &data, MessageParcel &reply) ++{ ++ (void)data; ++ int64_t pts = 0; ++ int32_t ret = GetLatestPts(pts); ++ MEDIA_LOGI("LppVideoStreamerServiceStub::GetLatestPts %{public}d %{public}ld", ret, pts); ++ reply.WriteInt32(ret); ++ reply.WriteInt64(pts); ++ return MSERR_OK; ++} + } // namespace Media + } // namespace OHOS +diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h +index eca927564..e708a8e14 100755 +--- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h ++++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h +@@ -81,9 +81,12 @@ public: + + int32_t RenderFirstFrame() override; + ++ int32_t GetLatestPts(int64_t &pts) override; ++ + int32_t Init(); + void SetPlayerFuncs(); + void FillPlayerFuncPart1(); ++ void FillPlayerFuncPart2(); + + private: + LppVideoStreamerServiceStub(); +@@ -114,6 +117,7 @@ public: + int32_t SetLppAudioStreamerId(MessageParcel &data, MessageParcel &reply); + int32_t GetStreamerId(MessageParcel &data, MessageParcel &reply); + int32_t RenderFirstFrame(MessageParcel &data, MessageParcel &reply); ++ int32_t GetLatestPts(MessageParcel &data, MessageParcel &reply); + + std::shared_ptr lppVideoPlayerServer_ = nullptr; + std::map> playerFuncs_; +diff --git a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp +index aed5713f7..d1e3a1b1b 100644 +--- a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp ++++ b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp +@@ -287,6 +287,15 @@ int32_t LppVideoStreamerServer::SetLppVideoStreamerCallback(const std::shared_pt + return MSERR_OK; + } + ++int32_t LppVideoStreamerServer::GetLatestPts(int64_t &pts) ++{ ++ MEDIA_LOGI("LppVideoStreamerServer GetLatestPts"); ++ CHECK_AND_RETURN_RET_LOG(streamerEngine_ != nullptr, MSERR_INVALID_OPERATION, "streamerEngine_ is nullptr"); ++ auto ret = streamerEngine_->GetLatestPts(pts); ++ CHECK_AND_RETURN_RET_LOG(ret == MSERR_OK, ret, "GetLatestPts Failed!"); ++ return ret; ++} ++ + int32_t LppVideoStreamerServer::SetLppAudioStreamerId(const std::string audioStreamId) + { + MEDIA_LOGI("LppVideoStreamerServer SetLppAudioStreamerId"); +diff --git a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h +index beec97728..0fbf7b171 100644 +--- a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h ++++ b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h +@@ -94,6 +94,8 @@ public: + + int32_t RenderFirstFrame() override; + ++ int32_t GetLatestPts(int64_t &pts) override; ++ + void OnDataNeeded(const int32_t maxBufferSize, const int32_t maxFrameNum) override; + bool OnAnchorUpdateNeeded(int64_t &anchorPts, int64_t &anchorClk) override; + void OnError(const MediaServiceErrCode errCode, const std::string &errMsg) override; +diff --git a/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h b/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h +index 25e1a4f3a..be06f4c77 100644 +--- a/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h ++++ b/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h +@@ -49,6 +49,7 @@ public: + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); + MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp)); + MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); ++ MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); + }; + } + } +diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h +index 59dd5614a..22cb8bee1 100644 +--- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h ++++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h +@@ -52,6 +52,7 @@ public: + std::string GetStreamerId() override; + std::shared_ptr GetLppSyncManager() override; + int32_t RenderFirstFrame() override; ++ int32_t GetLatestPts(int64_t &pts) override; + void OnEvent(const Event &event); + + private: +diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h +index 73382ddfc..759e78384 100644 +--- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h ++++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h +@@ -53,6 +53,7 @@ public: + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId), (override)); + MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp), (override)); + MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver), (override)); ++ MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts), (override)); + }; + } // namespace Media + } // namespace OHOS +diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h +index ffeb753ab..22c25138f 100644 +--- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h ++++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h +@@ -51,6 +51,7 @@ public: + MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); + MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); ++ MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); + }; + + class LowPowerPlayerFactory { +diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h +index b522cb9dd..9c6e41ca8 100644 +--- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h ++++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h +@@ -51,6 +51,7 @@ public: + MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); + MOCK_METHOD(int32_t, GetShareBuffer, (int& fd)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); ++ MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); + }; + } // V1_0 + } // LowPowerPlayer +diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h +index 2bb991ea2..ef1f08996 100644 +--- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h ++++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h +@@ -49,7 +49,7 @@ public: + int32_t SetTunnelId(uint64_t tunnelId); + int32_t SetAudioIsLpp(bool isLpp); + void SetEventReceiver(std::shared_ptr eventReceiver); +- ++ int32_t GetLatestPts(int64_t &pts); + private: + void ResetTimeAnchor(); + +diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h +index 8c9532f45..341b27ab2 100644 +--- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h ++++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h +@@ -52,6 +52,7 @@ public: + MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); + MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); ++ MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); + }; + + class LowPowerPlayerFactory { +diff --git a/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h +index f7b3c55f1..6f4f09db0 100644 +--- a/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h ++++ b/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h +@@ -52,6 +52,7 @@ public: + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId), (override)); + MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp), (override)); + MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver), (override)); ++ MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts), (override)); + }; + } // namespace Media + } // namespace OHOS +-- +2.45.2.huawei.10 + diff --git a/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp b/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp index 2147b2427..5ed1622b2 100644 --- a/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp +++ b/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp @@ -634,6 +634,7 @@ OH_AVErrCode OH_LowPowerVideoSinkCallback_SetStreamChangedListener( int32_t res = callback->SetStreamChangedListener(onStreamChanged, userData); return LppMsErrToOHAvErr(res); } + OH_AVErrCode OH_LowPowerVideoSinkCallback_SetFirstFrameDecodedListener(OH_LowPowerVideoSinkCallback *callback, OH_LowPowerVideoSink_OnFirstFrameDecoded onFirstFrameDecoded, void *userData) { @@ -643,3 +644,14 @@ OH_AVErrCode OH_LowPowerVideoSinkCallback_SetFirstFrameDecodedListener(OH_LowPow int32_t res = callback->SetFirstFrameReadyListener(onFirstFrameDecoded, userData); return LppMsErrToOHAvErr(res); } + +OH_AVErrCode OH_LowPowerVideoSink_GetLatestPts(OH_LowPowerVideoSink *streamer, int64_t *pts) +{ + MEDIA_LOGD("OH_LowPowerVideoSink_GetLatestPts"); + CHECK_AND_RETURN_RET_LOG(streamer != nullptr, AV_ERR_INVALID_VAL, "streamer is nullptr!"); + LowPowerVideoSinkObject *streamerObj = reinterpret_cast(streamer); + CHECK_AND_RETURN_RET_LOG(streamerObj != nullptr, AV_ERR_INVALID_VAL, "streamerObj is nullptr"); + CHECK_AND_RETURN_RET_LOG(streamerObj->videoStreamer_ != nullptr, AV_ERR_INVALID_VAL, "videoStreamer_ is nullptr"); + int32_t res = streamerObj->videoStreamer_->GetLatestPts(*pts); + return LppMsErrToOHAvErr(res); +} diff --git a/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp b/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp index f7adadd72..414b33325 100644 --- a/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp +++ b/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp @@ -262,5 +262,15 @@ std::string VideoStreamerImpl::GetStreamerId() CHECK_AND_RETURN_RET_LOG(streamerService_ != nullptr, "", "player service does not exist.."); return streamerService_->GetStreamerId(); } + +int32_t VideoStreamerImpl::GetLatestPts(int64_t &pts) +{ + MEDIA_LOGI("VideoStreamerImpl GetLatestPts"); + CHECK_AND_RETURN_RET_LOG(streamerService_ != nullptr, MSERR_SERVICE_DIED, + "GetLatestPts player service does not exist.."); + int32_t ret = streamerService_->GetLatestPts(pts); + pts = (ret == MSERR_OK) ? pts : 0; + return ret; +} } // namespace Media } // namespace OHOS diff --git a/frameworks/native/lpp_video_streamer/video_streamer_impl.h b/frameworks/native/lpp_video_streamer/video_streamer_impl.h index 16015c442..1a0b1e3e9 100644 --- a/frameworks/native/lpp_video_streamer/video_streamer_impl.h +++ b/frameworks/native/lpp_video_streamer/video_streamer_impl.h @@ -76,6 +76,8 @@ public: std::string GetStreamerId() override; + int32_t GetLatestPts(int64_t &pts) override; + private: std::shared_ptr callback_; std::shared_ptr streamerService_ = nullptr; diff --git a/interfaces/inner_api/native/lpp_video_streamer.h b/interfaces/inner_api/native/lpp_video_streamer.h index d29cd78a0..34de7d154 100644 --- a/interfaces/inner_api/native/lpp_video_streamer.h +++ b/interfaces/inner_api/native/lpp_video_streamer.h @@ -103,6 +103,8 @@ public: virtual int32_t RenderFirstFrame() = 0; virtual std::string GetStreamerId() = 0; + + virtual int32_t GetLatestPts(int64_t &pts) = 0; }; class __attribute__((visibility("default"))) VideoStreamerFactory { diff --git a/interfaces/kits/c/lowpower_video_sink.h b/interfaces/kits/c/lowpower_video_sink.h index d1c11f7e3..f74db9821 100644 --- a/interfaces/kits/c/lowpower_video_sink.h +++ b/interfaces/kits/c/lowpower_video_sink.h @@ -314,6 +314,20 @@ OH_AVErrCode OH_LowPowerVideoSink_SetTargetStartFrame( const int64_t timeoutMs, void* userData); +/** + * @brief Get the latest presentation timestamp (PTS) from lowpower video sink. + * + * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance. + * @param {int64_t*} pts Pointer to store the latest PTS value (in microseconds). + * @return Returns AV_ERR_OK if the timestamp is obtained successfully; + * otherwise, returns a specific error code as defined in {@link OH_AVErrCode}: + * {@link AV_ERR_INVALID_VAL} the sink is nullptr, or sink is invalid. + * {@link AV_ERR_SERVICE_DIED} media service is died. + * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted. + * @since 21 + */ +OH_AVErrCode OH_LowPowerVideoSink_GetLatestPts(OH_LowPowerVideoSink *streamer, int64_t *pts); + /** * @brief Set playback speed for the lowpower video sink * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h index 229bbb003..52029e9a6 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h +++ b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h @@ -50,6 +50,7 @@ public: int32_t SetTunnelId(uint64_t tunnelId) override; int32_t SetAudioIsLpp(bool isLpp) override; void SetEventReceiver(std::shared_ptr eventReceiver) override; + int32_t GetLatestPts(int64_t &pts) override; private: void ResetTimeAnchor(); diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h index c602d662d..a78c947e6 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h +++ b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h @@ -56,6 +56,8 @@ public: int32_t UnbindOutputBuffers(); int32_t GetShareBuffer(int32_t &fd); int32_t SetTunnelId(uint64_t tunnelId); + int32_t GetLatestPts(int64_t &pts); + void OnError(const int32_t errorCode, const std::string &errorMsg); void OnTargetArrived(const int64_t targetPts, const bool isTimeout); void OnRenderStarted(); diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp index c6b7cdf88..392286602 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp +++ b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp @@ -263,6 +263,16 @@ int32_t LppSyncManager::SetTunnelId(uint64_t tunnelId) return MSERR_OK; } +int32_t LppSyncManager::GetLatestPts(int64_t &pts) +{ + MEDIA_LOG_I("LppSyncManager::GetLatestPts"); + FALSE_RETURN_V_NOLOG(videoIsLpp_, MSERR_UNKNOWN); + FALSE_RETURN_V_MSG_E(adapter_ != nullptr, MSERR_INVALID_OPERATION, "adapter_ is nullptr"); + auto ret = adapter_->GetLatestPts(pts); + FALSE_RETURN_V_MSG_E(ret == MSERR_OK, ret, "adapter_ GetLatestPts failed"); + return MSERR_OK; +} + int32_t LppSyncManager::SetAudioIsLpp(bool isLpp) { audioIsLpp_ = isLpp; diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp index 87b1d5615..dc5aa9195 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp +++ b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp @@ -321,6 +321,14 @@ int32_t LppSyncManagerAdapter::SetTunnelId(uint64_t tunnelId) return MSERR_OK; } +int32_t LppSyncManagerAdapter::GetLatestPts(int64_t &pts) +{ + MediaTrace trace("LppSyncManagerAdapter::GetLatestPts"); + MEDIA_LOG_I("GetLatestPts enter"); + FALSE_RETURN_V_MSG_E(syncMgrAdapter_ != nullptr, MSERR_INVALID_OPERATION, "syncMgrAdapter_ is nullptr"); + return syncMgrAdapter_->GetLatestPts(pts); +} + void LppSyncManagerAdapter::SetEventReceiver(std::shared_ptr eventReceiver) { eventReceiver_ = eventReceiver; diff --git a/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h b/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h index f39780d21..dd95907cc 100644 --- a/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h +++ b/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h @@ -55,6 +55,7 @@ public: std::string GetStreamerId() override; std::shared_ptr GetLppSyncManager() override; int32_t RenderFirstFrame() override; + int32_t GetLatestPts(int64_t &pts) override; void OnEvent(const Event &event); private: diff --git a/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp b/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp index 8b4e6c0e6..4db33be9c 100644 --- a/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp +++ b/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp @@ -130,6 +130,13 @@ int32_t HiLppVideoStreamerImpl::SetParameter(const Format ¶m) return MSERR_OK; } +int32_t HiLppVideoStreamerImpl::GetLatestPts(int64_t &pts) +{ + MEDIA_LOG_I("HiLppVideoStreamerImpl::GetLatestPts"); + FALSE_RETURN_V_MSG(vdec_ != nullptr, MSERR_INVALID_OPERATION, "vdec_ nullptr"); + return syncMgr_->GetLatestPts(pts); +} + int32_t HiLppVideoStreamerImpl::Configure(const Format ¶m) { FALSE_RETURN_V_MSG(vdec_ != nullptr, MSERR_INVALID_OPERATION, "vdec_ nullptr"); diff --git a/services/include/i_lpp_video_streamer_service.h b/services/include/i_lpp_video_streamer_service.h index ffdc2c52f..770d1470e 100644 --- a/services/include/i_lpp_video_streamer_service.h +++ b/services/include/i_lpp_video_streamer_service.h @@ -75,6 +75,8 @@ public: virtual std::string GetStreamerId() = 0; virtual int32_t RenderFirstFrame() = 0; + + virtual int32_t GetLatestPts(int64_t &pts) = 0; }; } // namespace Media } // namespace OHOS diff --git a/services/services/engine_intf/i_lpp_sync_manager.h b/services/services/engine_intf/i_lpp_sync_manager.h index 2edba8cee..38f9bf540 100644 --- a/services/services/engine_intf/i_lpp_sync_manager.h +++ b/services/services/engine_intf/i_lpp_sync_manager.h @@ -50,6 +50,7 @@ public: virtual int32_t SetTunnelId(uint64_t tunnelId) = 0; virtual int32_t SetAudioIsLpp(bool isLpp) = 0; virtual void SetEventReceiver(std::shared_ptr eventReceiver) = 0; + virtual int32_t GetLatestPts(int64_t &pts) = 0; }; } diff --git a/services/services/engine_intf/i_lpp_video_streamer.h b/services/services/engine_intf/i_lpp_video_streamer.h index 507230511..c411b1c94 100644 --- a/services/services/engine_intf/i_lpp_video_streamer.h +++ b/services/services/engine_intf/i_lpp_video_streamer.h @@ -66,6 +66,7 @@ public: virtual std::string GetStreamerId() = 0; virtual std::shared_ptr GetLppSyncManager() = 0; virtual int32_t RenderFirstFrame() = 0; + virtual int32_t GetLatestPts(int64_t &pts) = 0; }; } // namespace Media } // namespace OHOS diff --git a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp index 952fda07b..dae58d353 100644 --- a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp +++ b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp @@ -243,5 +243,15 @@ void LppVideoStreamerClient::MediaServerDied() "mediaserver is died, please create a new video sink instance again"); } } + +int32_t LppVideoStreamerClient::GetLatestPts(int64_t &pts) +{ + MEDIA_LOGI("LppVideoStreamerClient GetLatestPts"); + CHECK_AND_RETURN_RET_LOG(playerProxy_ != nullptr, MSERR_SERVICE_DIED, + "LppVideoStreamerClient GetLatestPts player service does not exist.."); + int32_t ret = playerProxy_->GetLatestPts(pts); + CHECK_AND_RETURN_RET_LOG(ret == MSERR_OK, ret, "LppVideoStreamerClient GetLatestPts failed."); + return MSERR_OK; +} } // namespace Media } // namespace OHOS \ No newline at end of file diff --git a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h index 7b5a6885d..325f8e4a1 100644 --- a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h +++ b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h @@ -76,6 +76,8 @@ public: int32_t RenderFirstFrame() override; + int32_t GetLatestPts(int64_t &pts) override; + void MediaServerDied(); private: diff --git a/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h b/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h index 32982afbf..c9928ef1d 100644 --- a/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h +++ b/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h @@ -80,6 +80,8 @@ public: virtual int32_t RenderFirstFrame() = 0; + virtual int32_t GetLatestPts(int64_t &pts) = 0; + /** * IPC code ID */ @@ -109,6 +111,7 @@ public: GET_STREAM_ID, SET_AUDIO_STREAMER_ID, RENDER_FIRST_FRAME, + GET_LATEST_PTS, MAX_IPC_ID, // all IPC codes should be added before MAX_IPC_ID }; diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp index c4556605e..898d65663 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp @@ -429,5 +429,24 @@ int32_t LppVideoStreamerServiceProxy::RenderFirstFrame() return reply.ReadInt32(); } +int32_t LppVideoStreamerServiceProxy::GetLatestPts(int64_t &pts) +{ + MEDIA_LOGI("LppVideoStreamerServiceProxy GetLatestPts"); + MessageParcel data; + MessageParcel reply; + MessageOption option; + + bool token = data.WriteInterfaceToken(LppVideoStreamerServiceProxy::GetDescriptor()); + CHECK_AND_RETURN_RET_LOG(token, MSERR_INVALID_OPERATION, "Failed to write descriptor!"); + + int32_t error = Remote()->SendRequest(GET_LATEST_PTS, data, reply, option); + CHECK_AND_RETURN_RET_LOG( + error == MSERR_OK, MSERR_INVALID_OPERATION, "GetLatestPts SendRequest failed, error: %{public}d", error); + int32_t ret = reply.ReadInt32(); + pts = reply.ReadInt64(); + CHECK_AND_RETURN_RET_LOG( + ret == MSERR_OK, MSERR_INVALID_OPERATION, "GetLatestPts failed, error: %{public}d", ret); + return ret; +} } // namespace Media } // namespace OHOS diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h index efc84e5a7..3ba478a87 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h @@ -74,6 +74,8 @@ public: std::string GetStreamerId() override; + int32_t GetLatestPts(int64_t &pts) override; + int32_t RenderFirstFrame() override; private: static inline BrokerDelegator delegator_; diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp index a3c2b2974..3c2caa459 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp @@ -82,6 +82,7 @@ int32_t LppVideoStreamerServiceStub::Init() void LppVideoStreamerServiceStub::SetPlayerFuncs() { FillPlayerFuncPart1(); + FillPlayerFuncPart2(); } void LppVideoStreamerServiceStub::FillPlayerFuncPart1() @@ -136,6 +137,12 @@ void LppVideoStreamerServiceStub::FillPlayerFuncPart1() [this](MessageParcel &data, MessageParcel &reply) { return RenderFirstFrame(data, reply); }}; } +void LppVideoStreamerServiceStub::FillPlayerFuncPart2() +{ + playerFuncs_[GET_LATEST_PTS] = {"Player::GetLatestPts", + [this](MessageParcel &data, MessageParcel &reply) { return GetLatestPts(data, reply); }}; +} + int LppVideoStreamerServiceStub::OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { @@ -532,5 +539,22 @@ int32_t LppVideoStreamerServiceStub::RenderFirstFrame(MessageParcel &data, Messa return MSERR_OK; } +int32_t LppVideoStreamerServiceStub::GetLatestPts(int64_t &pts) +{ + MEDIA_LOGI("LppVideoStreamerServiceStub::GetLatestPts"); + CHECK_AND_RETURN_RET_LOG(lppVideoPlayerServer_ != nullptr, MSERR_INVALID_OPERATION, "player server is nullptr"); + return lppVideoPlayerServer_->GetLatestPts(pts); +} + +int32_t LppVideoStreamerServiceStub::GetLatestPts(MessageParcel &data, MessageParcel &reply) +{ + (void)data; + int64_t pts = 0; + int32_t ret = GetLatestPts(pts); + MEDIA_LOGI("LppVideoStreamerServiceStub::GetLatestPts %{public}d %{public}ld", ret, pts); + reply.WriteInt32(ret); + reply.WriteInt64(pts); + return MSERR_OK; +} } // namespace Media } // namespace OHOS diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h index eca927564..e708a8e14 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h @@ -81,9 +81,12 @@ public: int32_t RenderFirstFrame() override; + int32_t GetLatestPts(int64_t &pts) override; + int32_t Init(); void SetPlayerFuncs(); void FillPlayerFuncPart1(); + void FillPlayerFuncPart2(); private: LppVideoStreamerServiceStub(); @@ -114,6 +117,7 @@ public: int32_t SetLppAudioStreamerId(MessageParcel &data, MessageParcel &reply); int32_t GetStreamerId(MessageParcel &data, MessageParcel &reply); int32_t RenderFirstFrame(MessageParcel &data, MessageParcel &reply); + int32_t GetLatestPts(MessageParcel &data, MessageParcel &reply); std::shared_ptr lppVideoPlayerServer_ = nullptr; std::map> playerFuncs_; diff --git a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp index 34462bbe3..0f7725305 100644 --- a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp +++ b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp @@ -287,6 +287,15 @@ int32_t LppVideoStreamerServer::SetLppVideoStreamerCallback(const std::shared_pt return MSERR_OK; } +int32_t LppVideoStreamerServer::GetLatestPts(int64_t &pts) +{ + MEDIA_LOGI("LppVideoStreamerServer GetLatestPts"); + CHECK_AND_RETURN_RET_LOG(streamerEngine_ != nullptr, MSERR_INVALID_OPERATION, "streamerEngine_ is nullptr"); + auto ret = streamerEngine_->GetLatestPts(pts); + CHECK_AND_RETURN_RET_LOG(ret == MSERR_OK, ret, "GetLatestPts Failed!"); + return ret; +} + int32_t LppVideoStreamerServer::SetLppAudioStreamerId(const std::string audioStreamId) { MEDIA_LOGI("LppVideoStreamerServer SetLppAudioStreamerId"); diff --git a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h index beec97728..0fbf7b171 100644 --- a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h +++ b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h @@ -94,6 +94,8 @@ public: int32_t RenderFirstFrame() override; + int32_t GetLatestPts(int64_t &pts) override; + void OnDataNeeded(const int32_t maxBufferSize, const int32_t maxFrameNum) override; bool OnAnchorUpdateNeeded(int64_t &anchorPts, int64_t &anchorClk) override; void OnError(const MediaServiceErrCode errCode, const std::string &errMsg) override; diff --git a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H264_AAC.mp4 b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H264_AAC.mp4 index 8018a7ddb..e26cfd93d 120000 --- a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H264_AAC.mp4 +++ b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H264_AAC.mp4 @@ -1 +1,3 @@ -../../../../unittest/resources/test_videofile/H264_AAC.mp4 \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:0015f820f9b7d097e7aa7ceff00b487705fc56796a296b6856f13626d8181d5e +size 58 diff --git a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H264_MP3.mp4 b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H264_MP3.mp4 index c6f57c87a..917bfdf83 120000 --- a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H264_MP3.mp4 +++ b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H264_MP3.mp4 @@ -1 +1,3 @@ -../../../../unittest/resources/test_videofile/H264_MP3.mp4 \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:0e2ced1eadff8becbef63fcc3ef17027ababa64e629c48060f88f98e3601c927 +size 58 diff --git a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H265_AAC.mp4 b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H265_AAC.mp4 index 261e00984..8b1c251c3 120000 --- a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H265_AAC.mp4 +++ b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H265_AAC.mp4 @@ -1 +1,3 @@ -../../../../unittest/resources/test_videofile/H265_AAC.mp4 \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:8481eddd29472dcac39184fcda7f0624dd900fd2de64eb5eda24b792d13d54c5 +size 58 diff --git a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/HDR.mp4 b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/HDR.mp4 index 4e63b1b38..5759a5113 120000 --- a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/HDR.mp4 +++ b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/HDR.mp4 @@ -1 +1,3 @@ -../../../../unittest/resources/test_videofile/HDR.mp4 \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:34d977493439d8292e03ffaf04dac4ef33348ab85fd8d0abf97a82654c7087bb +size 53 diff --git a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/MPEG4_MP3.mp4 b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/MPEG4_MP3.mp4 index ec0db91cc..653bc0f33 120000 --- a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/MPEG4_MP3.mp4 +++ b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/MPEG4_MP3.mp4 @@ -1 +1,3 @@ -../../../../unittest/resources/test_videofile/MPEG4_MP3.mp4 \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:7007548cb1f9b6ed00bde327e096de364dcdd17bef3a65fd2675d2efa830143c +size 59 diff --git a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/SDR.mp4 b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/SDR.mp4 index 87bcce8e0..ea2507691 120000 --- a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/SDR.mp4 +++ b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/SDR.mp4 @@ -1 +1,3 @@ -../../../../unittest/resources/test_videofile/SDR.mp4 \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:5cd42264cd19387fcb8a93478d1033f3087a6c732191b0253a6429ac000d053f +size 53 diff --git a/test/fuzztest/transcoder_fuzztest/transcoderstub_fuzzer/corpus/HDR.mp4 b/test/fuzztest/transcoder_fuzztest/transcoderstub_fuzzer/corpus/HDR.mp4 index 4e63b1b38..5759a5113 120000 --- a/test/fuzztest/transcoder_fuzztest/transcoderstub_fuzzer/corpus/HDR.mp4 +++ b/test/fuzztest/transcoder_fuzztest/transcoderstub_fuzzer/corpus/HDR.mp4 @@ -1 +1,3 @@ -../../../../unittest/resources/test_videofile/HDR.mp4 \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:34d977493439d8292e03ffaf04dac4ef33348ab85fd8d0abf97a82654c7087bb +size 53 diff --git a/test/fuzztest/transcoder_fuzztest/transcoderstub_fuzzer/corpus/SDR.mp4 b/test/fuzztest/transcoder_fuzztest/transcoderstub_fuzzer/corpus/SDR.mp4 index 87bcce8e0..ea2507691 120000 --- a/test/fuzztest/transcoder_fuzztest/transcoderstub_fuzzer/corpus/SDR.mp4 +++ b/test/fuzztest/transcoder_fuzztest/transcoderstub_fuzzer/corpus/SDR.mp4 @@ -1 +1,3 @@ -../../../../unittest/resources/test_videofile/SDR.mp4 \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:5cd42264cd19387fcb8a93478d1033f3087a6c732191b0253a6429ac000d053f +size 53 diff --git a/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h b/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h index 85e72ad28..0f78ba26d 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h @@ -1,55 +1,56 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef I_LPP_SYNC_MANAGER_H -#define I_LPP_SYNC_MANAGER_H -#include -#include -#include "format.h" -#include "i_lpp_video_streamer.h" -#include "pipeline/pipeline.h" - -namespace OHOS { -namespace Media { - -class ILppSyncManager : public std::enable_shared_from_this { -public: - virtual ~ILppSyncManager() = default; - MOCK_METHOD(int32_t, Init, ()); - MOCK_METHOD(int32_t, GetTimeAnchor, (int64_t &anchorPts, int64_t &anchorClock)); - MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId)); - MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId)); - MOCK_METHOD(int32_t, Prepare, ()); - MOCK_METHOD(int32_t, StartRender, ()); - MOCK_METHOD(int32_t, RenderNextFrame, ()); - MOCK_METHOD(int32_t, Pause, ()); - MOCK_METHOD(int32_t, Resume, ()); - MOCK_METHOD(int32_t, Flush, ()); - MOCK_METHOD(int32_t, Stop, ()); - MOCK_METHOD(int32_t, Reset, ()); - MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs)); - MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); - MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters)); - MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters)); - MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk)); - MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap)); - MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); - MOCK_METHOD(int32_t, GetShareBuffer, (int32_t &fd)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); - MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp)); - MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); -}; -} -} +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef I_LPP_SYNC_MANAGER_H +#define I_LPP_SYNC_MANAGER_H +#include +#include +#include "format.h" +#include "i_lpp_video_streamer.h" +#include "pipeline/pipeline.h" + +namespace OHOS { +namespace Media { + +class ILppSyncManager : public std::enable_shared_from_this { +public: + virtual ~ILppSyncManager() = default; + MOCK_METHOD(int32_t, Init, ()); + MOCK_METHOD(int32_t, GetTimeAnchor, (int64_t &anchorPts, int64_t &anchorClock)); + MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId)); + MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId)); + MOCK_METHOD(int32_t, Prepare, ()); + MOCK_METHOD(int32_t, StartRender, ()); + MOCK_METHOD(int32_t, RenderNextFrame, ()); + MOCK_METHOD(int32_t, Pause, ()); + MOCK_METHOD(int32_t, Resume, ()); + MOCK_METHOD(int32_t, Flush, ()); + MOCK_METHOD(int32_t, Stop, ()); + MOCK_METHOD(int32_t, Reset, ()); + MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs)); + MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); + MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters)); + MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters)); + MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk)); + MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap)); + MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); + MOCK_METHOD(int32_t, GetShareBuffer, (int32_t &fd)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); + MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp)); + MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); + MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); +}; +} +} #endif \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h index 1b9af148f..e43d47920 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h +++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h @@ -1,87 +1,88 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef HILPP_VSTREAMER_IMPL_H -#define HILPP_VSTREAMER_IMPL_H -#include "i_lpp_video_streamer.h" -#include "i_lpp_sync_manager.h" -#include "pipeline/pipeline.h" -#include "lpp_video_data_manager.h" -#include "lpp_vdec_adapter.h" -#include "lpp_video_callback_looper.h" -#include "video_decoder_adapter.h" -#include "i_lpp_engine_manager.h" - -namespace OHOS { -namespace Media { - -class HiLppVideoStreamerImpl : public ILppVideoStreamerEngine, - public std::enable_shared_from_this { -public: - HiLppVideoStreamerImpl(); - ~HiLppVideoStreamerImpl() override; - int32_t Init(const std::string &mime) override; - int32_t SetObs(const std::weak_ptr &obs) override; - int32_t SetParameter(const Format ¶m) override; - int32_t Configure(const Format ¶m) override; - int32_t SetVideoSurface(sptr surface) override; - int32_t Prepare() override; - int32_t StartDecode() override; - int32_t StartRender() override; - int32_t Pause() override; - int32_t Resume() override; - int32_t Flush() override; - int32_t Stop() override; - int32_t Reset() override; - int32_t SetPlaybackSpeed(const float playbackSpeed) override; - int32_t SetSyncAudioStreamer(int streamerId) override; - int32_t SetTargetStartFrame(const int64_t targetPts, const int timeoutMs) override; - int32_t ReturnFrames(sptr framePacket) override; - int32_t SetLppAudioStreamerId(std::string audioStreamerId) override; - std::string GetStreamerId() override; - std::shared_ptr GetLppSyncManager() override; - int32_t RenderFirstFrame() override; - void OnEvent(const Event &event); - -private: - void InitLppMode(); - void HandleDataNeededEvent(const Event &event); - void HandleFirstFrameReadyEvent(const Event &event); - void HandleRenderStartedEvent(const Event &event); - void HandleCompleteEvent(const Event &event); - void HandleResolutionChangeEvent(const Event &event); - void HandleTargetArrivedEvent(const Event &event); - int32_t EosPause(); - void HandleErrorEvent(const Event &event); - - bool isLpp_{false}; - std::string streamerId_{}; - int32_t channelId_{}; - int32_t shareBufferFd_{}; - sptr surface_{nullptr}; - std::shared_ptr dataMgr_{nullptr}; - std::shared_ptr vdec_{nullptr}; - std::shared_ptr syncMgr_{nullptr}; - std::shared_ptr callbackLooper_{nullptr}; - std::string audioStreamerId_{}; - std::weak_ptr audioStreamerEngine_; - std::shared_ptr eventReceiver_ {nullptr}; - - bool isChannelSetDone_ {false}; - bool isPaused_ {false}; - std::mutex pauseMutex_ {}; -}; -} // namespace Media -} // namespace OHOS +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef HILPP_VSTREAMER_IMPL_H +#define HILPP_VSTREAMER_IMPL_H +#include "i_lpp_video_streamer.h" +#include "i_lpp_sync_manager.h" +#include "pipeline/pipeline.h" +#include "lpp_video_data_manager.h" +#include "lpp_vdec_adapter.h" +#include "lpp_video_callback_looper.h" +#include "video_decoder_adapter.h" +#include "i_lpp_engine_manager.h" + +namespace OHOS { +namespace Media { + +class HiLppVideoStreamerImpl : public ILppVideoStreamerEngine, + public std::enable_shared_from_this { +public: + HiLppVideoStreamerImpl(); + ~HiLppVideoStreamerImpl() override; + int32_t Init(const std::string &mime) override; + int32_t SetObs(const std::weak_ptr &obs) override; + int32_t SetParameter(const Format ¶m) override; + int32_t Configure(const Format ¶m) override; + int32_t SetVideoSurface(sptr surface) override; + int32_t Prepare() override; + int32_t StartDecode() override; + int32_t StartRender() override; + int32_t Pause() override; + int32_t Resume() override; + int32_t Flush() override; + int32_t Stop() override; + int32_t Reset() override; + int32_t SetPlaybackSpeed(const float playbackSpeed) override; + int32_t SetSyncAudioStreamer(int streamerId) override; + int32_t SetTargetStartFrame(const int64_t targetPts, const int timeoutMs) override; + int32_t ReturnFrames(sptr framePacket) override; + int32_t SetLppAudioStreamerId(std::string audioStreamerId) override; + std::string GetStreamerId() override; + std::shared_ptr GetLppSyncManager() override; + int32_t RenderFirstFrame() override; + int32_t GetLatestPts(int64_t &pts) override; + void OnEvent(const Event &event); + +private: + void InitLppMode(); + void HandleDataNeededEvent(const Event &event); + void HandleFirstFrameReadyEvent(const Event &event); + void HandleRenderStartedEvent(const Event &event); + void HandleCompleteEvent(const Event &event); + void HandleResolutionChangeEvent(const Event &event); + void HandleTargetArrivedEvent(const Event &event); + int32_t EosPause(); + void HandleErrorEvent(const Event &event); + + bool isLpp_{false}; + std::string streamerId_{}; + int32_t channelId_{}; + int32_t shareBufferFd_{}; + sptr surface_{nullptr}; + std::shared_ptr dataMgr_{nullptr}; + std::shared_ptr vdec_{nullptr}; + std::shared_ptr syncMgr_{nullptr}; + std::shared_ptr callbackLooper_{nullptr}; + std::string audioStreamerId_{}; + std::weak_ptr audioStreamerEngine_; + std::shared_ptr eventReceiver_ {nullptr}; + + bool isChannelSetDone_ {false}; + bool isPaused_ {false}; + std::mutex pauseMutex_ {}; +}; +} // namespace Media +} // namespace OHOS #endif \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h index 5cb2d3df5..41bcde079 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h @@ -1,59 +1,60 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef LPP_SYNC_MANAGER_H -#define LPP_SYNC_MANAGER_H - -#include -#include "i_lpp_sync_manager.h" -#include "lpp_sync_manager_adapter.h" -#include "pipeline/pipeline.h" - -namespace OHOS { -namespace Media { -class LppSyncManager : public ILppSyncManager { -public: - explicit LppSyncManager(std::string videoStreamerId, bool isLpp) - { - (void)videoStreamerId; - (void)isLpp; - } - ~LppSyncManager() {}; - MOCK_METHOD(int32_t, Init, (), (override)); - MOCK_METHOD(int32_t, GetTimeAnchor, (int64_t&, int64_t&), (override)); - MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId), (override)); - MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId), (override)); - MOCK_METHOD(int32_t, Prepare, (), (override)); - MOCK_METHOD(int32_t, StartRender, (), (override)); - MOCK_METHOD(int32_t, RenderNextFrame, (), (override)); - MOCK_METHOD(int32_t, Pause, (), (override)); - MOCK_METHOD(int32_t, Resume, (), (override)); - MOCK_METHOD(int32_t, Flush, (), (override)); - MOCK_METHOD(int32_t, Stop, (), (override)); - MOCK_METHOD(int32_t, Reset, (), (override)); - MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs), (override)); - MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed), (override)); - MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters), (override)); - MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters), (override)); - MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk), (override)); - MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap), (override)); - MOCK_METHOD(int32_t, UnbindOutputBuffers, (), (override)); - MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd), (override)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId), (override)); - MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp), (override)); - MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver), (override)); -}; -} // namespace Media -} // namespace OHOS +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef LPP_SYNC_MANAGER_H +#define LPP_SYNC_MANAGER_H + +#include +#include "i_lpp_sync_manager.h" +#include "lpp_sync_manager_adapter.h" +#include "pipeline/pipeline.h" + +namespace OHOS { +namespace Media { +class LppSyncManager : public ILppSyncManager { +public: + explicit LppSyncManager(std::string videoStreamerId, bool isLpp) + { + (void)videoStreamerId; + (void)isLpp; + } + ~LppSyncManager() {}; + MOCK_METHOD(int32_t, Init, (), (override)); + MOCK_METHOD(int32_t, GetTimeAnchor, (int64_t&, int64_t&), (override)); + MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId), (override)); + MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId), (override)); + MOCK_METHOD(int32_t, Prepare, (), (override)); + MOCK_METHOD(int32_t, StartRender, (), (override)); + MOCK_METHOD(int32_t, RenderNextFrame, (), (override)); + MOCK_METHOD(int32_t, Pause, (), (override)); + MOCK_METHOD(int32_t, Resume, (), (override)); + MOCK_METHOD(int32_t, Flush, (), (override)); + MOCK_METHOD(int32_t, Stop, (), (override)); + MOCK_METHOD(int32_t, Reset, (), (override)); + MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs), (override)); + MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed), (override)); + MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters), (override)); + MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters), (override)); + MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk), (override)); + MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap), (override)); + MOCK_METHOD(int32_t, UnbindOutputBuffers, (), (override)); + MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd), (override)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId), (override)); + MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp), (override)); + MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver), (override)); + MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts), (override)); +}; +} // namespace Media +} // namespace OHOS #endif \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h index 2736d4528..e4f713430 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h +++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h @@ -1,75 +1,76 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef LPP_SYNC_MANAGER_ADAPTER_H -#define LPP_SYNC_MANAGER_ADAPTER_H - -#include -#include -#include -#include - -#include "media_core.h" -#include "player.h" -#include "surface_buffer.h" -#include "pipeline/pipeline.h" - -namespace OHOS { -namespace Media { -class LppSyncManagerAdapter : public std::enable_shared_from_this { -public: - MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId)); - MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId)); - MOCK_METHOD(int32_t, Init, ()); - MOCK_METHOD(int32_t, StartRender, ()); - MOCK_METHOD(int32_t, RenderNextFrame, ()); - MOCK_METHOD(int32_t, Pause, ()); - MOCK_METHOD(int32_t, Resume, ()); - MOCK_METHOD(int32_t, Flush, ()); - MOCK_METHOD(int32_t, Stop, ()); - MOCK_METHOD(int32_t, Reset, ()); - MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs)); - MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); - MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters)); - MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters)); - MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk)); - MOCK_METHOD(int32_t, LoadAdapter, (uint32_t& instanceId)); - MOCK_METHOD(int32_t, UnloadAdapter, (uint32_t instanceId)); - MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap)); - MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); - MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); - MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); -}; - -class LowPowerPlayerFactory { -public: - static int32_t CreateLppSyncManagerAdapter(uint32_t &instanceId, std::shared_ptr &adapter) - { - instanceId = 1; - if (adapter != nullptr) { - return 0; - } - adapter = std::make_shared(); - return 0; - } - static int32_t DestroyLppSyncManagerAdapter( - const uint32_t instanceId, std::shared_ptr adapter) - { - return 0; - } -}; -} // namespace Media -} // namespace OHOS +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef LPP_SYNC_MANAGER_ADAPTER_H +#define LPP_SYNC_MANAGER_ADAPTER_H + +#include +#include +#include +#include + +#include "media_core.h" +#include "player.h" +#include "surface_buffer.h" +#include "pipeline/pipeline.h" + +namespace OHOS { +namespace Media { +class LppSyncManagerAdapter : public std::enable_shared_from_this { +public: + MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId)); + MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId)); + MOCK_METHOD(int32_t, Init, ()); + MOCK_METHOD(int32_t, StartRender, ()); + MOCK_METHOD(int32_t, RenderNextFrame, ()); + MOCK_METHOD(int32_t, Pause, ()); + MOCK_METHOD(int32_t, Resume, ()); + MOCK_METHOD(int32_t, Flush, ()); + MOCK_METHOD(int32_t, Stop, ()); + MOCK_METHOD(int32_t, Reset, ()); + MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs)); + MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); + MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters)); + MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters)); + MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk)); + MOCK_METHOD(int32_t, LoadAdapter, (uint32_t& instanceId)); + MOCK_METHOD(int32_t, UnloadAdapter, (uint32_t instanceId)); + MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap)); + MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); + MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); + MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); + MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); +}; + +class LowPowerPlayerFactory { +public: + static int32_t CreateLppSyncManagerAdapter(uint32_t &instanceId, std::shared_ptr &adapter) + { + instanceId = 1; + if (adapter != nullptr) { + return 0; + } + adapter = std::make_shared(); + return 0; + } + static int32_t DestroyLppSyncManagerAdapter( + const uint32_t instanceId, std::shared_ptr adapter) + { + return 0; + } +}; +} // namespace Media +} // namespace OHOS #endif // LPP_SYNC_MANAGER_ADAPTER_H \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h index 9224148f3..4d467c105 100644 --- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h +++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h @@ -1,59 +1,60 @@ -/* - * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_HDI_LOW_POWER_PLAYER_V1_0_ILPPSYNCMANAGERADAPTER_H -#define OHOS_HDI_LOW_POWER_PLAYER_V1_0_ILPPSYNCMANAGERADAPTER_H - -#include -#include -#include - -#include "ilpp_sync_manager_callback.h" -#include "surface_buffer.h" -#include "../native_buffer.h" -#include "hdf_base.h" - -namespace OHOS { -namespace HDI { -namespace LowPowerPlayer { -namespace V1_0 { -using namespace OHOS::HDI::Base; -class ILppSyncManagerAdapter : public RefBase { -public: - MOCK_METHOD(int32_t, SetVideoChannelId, (uint32_t channelId)); - MOCK_METHOD(int32_t, SetAudioChannelId, (uint32_t channelId)); - MOCK_METHOD(int32_t, StartRender, ()); - MOCK_METHOD(int32_t, RenderNextFrame, ()); - MOCK_METHOD(int32_t, Pause, ()); - MOCK_METHOD(int32_t, Resume, ()); - MOCK_METHOD(int32_t, Flush, ()); - MOCK_METHOD(int32_t, Stop, ()); - MOCK_METHOD(int32_t, Reset, ()); - MOCK_METHOD(int32_t, SetTargetStartFrame, (uint64_t framePts, uint32_t timeoutMs)); - MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); - MOCK_METHOD(int32_t, RegisterCallback, (const sptr& syncCallback)); - MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameter)); - MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameter)); - MOCK_METHOD(int32_t, UpdateTimeAnchor, (int64_t anchorPts, int64_t anchorClk)); - MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& outputBuffers)); - MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); - MOCK_METHOD(int32_t, GetShareBuffer, (int& fd)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); -}; -} // V1_0 -} // LowPowerPlayer -} // HDI -} // OHOS +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_HDI_LOW_POWER_PLAYER_V1_0_ILPPSYNCMANAGERADAPTER_H +#define OHOS_HDI_LOW_POWER_PLAYER_V1_0_ILPPSYNCMANAGERADAPTER_H + +#include +#include +#include + +#include "ilpp_sync_manager_callback.h" +#include "surface_buffer.h" +#include "../native_buffer.h" +#include "hdf_base.h" + +namespace OHOS { +namespace HDI { +namespace LowPowerPlayer { +namespace V1_0 { +using namespace OHOS::HDI::Base; +class ILppSyncManagerAdapter : public RefBase { +public: + MOCK_METHOD(int32_t, SetVideoChannelId, (uint32_t channelId)); + MOCK_METHOD(int32_t, SetAudioChannelId, (uint32_t channelId)); + MOCK_METHOD(int32_t, StartRender, ()); + MOCK_METHOD(int32_t, RenderNextFrame, ()); + MOCK_METHOD(int32_t, Pause, ()); + MOCK_METHOD(int32_t, Resume, ()); + MOCK_METHOD(int32_t, Flush, ()); + MOCK_METHOD(int32_t, Stop, ()); + MOCK_METHOD(int32_t, Reset, ()); + MOCK_METHOD(int32_t, SetTargetStartFrame, (uint64_t framePts, uint32_t timeoutMs)); + MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); + MOCK_METHOD(int32_t, RegisterCallback, (const sptr& syncCallback)); + MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameter)); + MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameter)); + MOCK_METHOD(int32_t, UpdateTimeAnchor, (int64_t anchorPts, int64_t anchorClk)); + MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& outputBuffers)); + MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); + MOCK_METHOD(int32_t, GetShareBuffer, (int& fd)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); + MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); +}; +} // V1_0 +} // LowPowerPlayer +} // HDI +} // OHOS #endif // OHOS_HDI_LOW_POWER_PLAYER_V1_0_ILPPSYNCMANAGERADAPTER_H \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h index 3f3755f5a..75203ceba 100644 --- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h @@ -1,71 +1,71 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef LPP_SYNC_MANAGER_H -#define LPP_SYNC_MANAGER_H - -#include "lpp_sync_manager_adapter.h" -#include "osal/task/task.h" - -namespace OHOS { -namespace Media { - -class LppSyncManager : public std::enable_shared_from_this { -public: - explicit LppSyncManager(std::string videoStreamerId, bool isLpp); - ~LppSyncManager(); - int32_t GetTimeAnchor(int64_t &anchorPts, int64_t &anchorClock); - - int32_t SetVideoChannelId(const uint32_t channelId); - int32_t SetAudioChannelId(const uint32_t channelId); - int32_t Init(); - int32_t Prepare(); - int32_t StartRender(); - int32_t RenderNextFrame(); - int32_t Pause(); - int32_t Resume(); - int32_t Flush(); - int32_t Stop(); - int32_t Reset(); - int32_t SetTargetStartFrame(const uint64_t targetPts, uint32_t timeoutMs = 0); - int32_t SetPlaybackSpeed(float speed); - int32_t SetParameter(const std::map ¶meters); - int32_t GetParameter(std::map ¶meters); - int32_t UpdateTimeAnchor(const int64_t anchorPts, const int64_t anchorClk); - int32_t BindOutputBuffers(const std::map> &bufferMap); - int32_t UnbindOutputBuffers(); - int32_t GetShareBuffer(int32_t &fd); - int32_t SetTunnelId(uint64_t tunnelId); - int32_t SetAudioIsLpp(bool isLpp); - void SetEventReceiver(std::shared_ptr eventReceiver); - -private: - void ResetTimeAnchor(); - - uint32_t adapterId_ {0}; - std::string videoStreamerId_ {}; - std::shared_ptr adapter_ {nullptr}; - bool videoIsLpp_ {true}; - bool audioIsLpp_ {false}; - std::mutex anchorMutex_{}; - uint64_t localAnchorPts_ {0}; - uint64_t localAnchorClk_ {0}; - std::unique_ptr synctask_ {nullptr}; - std::shared_ptr eventReceiver_ {nullptr}; -}; - -} // namespace Media -} // namespace OHOS - +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef LPP_SYNC_MANAGER_H +#define LPP_SYNC_MANAGER_H + +#include "lpp_sync_manager_adapter.h" +#include "osal/task/task.h" + +namespace OHOS { +namespace Media { + +class LppSyncManager : public std::enable_shared_from_this { +public: + explicit LppSyncManager(std::string videoStreamerId, bool isLpp); + ~LppSyncManager(); + int32_t GetTimeAnchor(int64_t &anchorPts, int64_t &anchorClock); + + int32_t SetVideoChannelId(const uint32_t channelId); + int32_t SetAudioChannelId(const uint32_t channelId); + int32_t Init(); + int32_t Prepare(); + int32_t StartRender(); + int32_t RenderNextFrame(); + int32_t Pause(); + int32_t Resume(); + int32_t Flush(); + int32_t Stop(); + int32_t Reset(); + int32_t SetTargetStartFrame(const uint64_t targetPts, uint32_t timeoutMs = 0); + int32_t SetPlaybackSpeed(float speed); + int32_t SetParameter(const std::map ¶meters); + int32_t GetParameter(std::map ¶meters); + int32_t UpdateTimeAnchor(const int64_t anchorPts, const int64_t anchorClk); + int32_t BindOutputBuffers(const std::map> &bufferMap); + int32_t UnbindOutputBuffers(); + int32_t GetShareBuffer(int32_t &fd); + int32_t SetTunnelId(uint64_t tunnelId); + int32_t SetAudioIsLpp(bool isLpp); + void SetEventReceiver(std::shared_ptr eventReceiver); + int32_t GetLatestPts(int64_t &pts); +private: + void ResetTimeAnchor(); + + uint32_t adapterId_ {0}; + std::string videoStreamerId_ {}; + std::shared_ptr adapter_ {nullptr}; + bool videoIsLpp_ {true}; + bool audioIsLpp_ {false}; + std::mutex anchorMutex_{}; + uint64_t localAnchorPts_ {0}; + uint64_t localAnchorClk_ {0}; + std::unique_ptr synctask_ {nullptr}; + std::shared_ptr eventReceiver_ {nullptr}; +}; + +} // namespace Media +} // namespace OHOS + #endif \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h index c9ea2f2e3..31cfa94e7 100644 --- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h +++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h @@ -1,77 +1,78 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef LPP_SYNC_MANAGER_ADAPTER_H -#define LPP_SYNC_MANAGER_ADAPTER_H - -#include -#include -#include -#include - -#include "media_core.h" -#include "player.h" -#include "surface_buffer.h" -#include "pipeline/pipeline.h" - -namespace OHOS { -namespace Media { - -class LppSyncManagerAdapter : public std::enable_shared_from_this { -public: - MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId)); - MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId)); - MOCK_METHOD(int32_t, Init, ()); - MOCK_METHOD(int32_t, StartRender, ()); - MOCK_METHOD(int32_t, RenderNextFrame, ()); - MOCK_METHOD(int32_t, Pause, ()); - MOCK_METHOD(int32_t, Resume, ()); - MOCK_METHOD(int32_t, Flush, ()); - MOCK_METHOD(int32_t, Stop, ()); - MOCK_METHOD(int32_t, Reset, ()); - MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs)); - MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); - MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters)); - MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters)); - MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk)); - MOCK_METHOD(int32_t, LoadAdapter, (uint32_t& instanceId)); - MOCK_METHOD(int32_t, UnloadAdapter, (uint32_t instanceId)); - MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap)); - MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); - MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); - MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); -}; - -class LowPowerPlayerFactory { -public: - static int32_t CreateLppSyncManagerAdapter(uint32_t &instanceId, std::shared_ptr &adapter) - { - instanceId = 1; - if (adapter != nullptr) { - return 0; - } - adapter = std::make_shared(); - return 0; - } - static int32_t DestroyLppSyncManagerAdapter( - const uint32_t instanceId, std::shared_ptr adapter) - { - return 0; - } -}; - -} // namespace Media -} // namespace OHOS +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef LPP_SYNC_MANAGER_ADAPTER_H +#define LPP_SYNC_MANAGER_ADAPTER_H + +#include +#include +#include +#include + +#include "media_core.h" +#include "player.h" +#include "surface_buffer.h" +#include "pipeline/pipeline.h" + +namespace OHOS { +namespace Media { + +class LppSyncManagerAdapter : public std::enable_shared_from_this { +public: + MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId)); + MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId)); + MOCK_METHOD(int32_t, Init, ()); + MOCK_METHOD(int32_t, StartRender, ()); + MOCK_METHOD(int32_t, RenderNextFrame, ()); + MOCK_METHOD(int32_t, Pause, ()); + MOCK_METHOD(int32_t, Resume, ()); + MOCK_METHOD(int32_t, Flush, ()); + MOCK_METHOD(int32_t, Stop, ()); + MOCK_METHOD(int32_t, Reset, ()); + MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs)); + MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); + MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters)); + MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters)); + MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk)); + MOCK_METHOD(int32_t, LoadAdapter, (uint32_t& instanceId)); + MOCK_METHOD(int32_t, UnloadAdapter, (uint32_t instanceId)); + MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap)); + MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); + MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); + MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); + MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); +}; + +class LowPowerPlayerFactory { +public: + static int32_t CreateLppSyncManagerAdapter(uint32_t &instanceId, std::shared_ptr &adapter) + { + instanceId = 1; + if (adapter != nullptr) { + return 0; + } + adapter = std::make_shared(); + return 0; + } + static int32_t DestroyLppSyncManagerAdapter( + const uint32_t instanceId, std::shared_ptr adapter) + { + return 0; + } +}; + +} // namespace Media +} // namespace OHOS #endif // LPP_SYNC_MANAGER_ADAPTER_H \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h index dbb510bf4..496edb438 100644 --- a/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h @@ -1,58 +1,59 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef LPP_SYNC_MANAGER_H -#define LPP_SYNC_MANAGER_H - -#include -#include "i_lpp_sync_manager.h" -#include "pipeline/pipeline.h" - -namespace OHOS { -namespace Media { -class LppSyncManager : public ILppSyncManager { -public: - explicit LppSyncManager(std::string videoStreamerId, bool isLpp) - { - (void)videoStreamerId; - (void)isLpp; - } - ~LppSyncManager() {}; - MOCK_METHOD(int32_t, Init, (), (override)); - MOCK_METHOD(int32_t, GetTimeAnchor, (int64_t&, int64_t&), (override)); - MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId), (override)); - MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId), (override)); - MOCK_METHOD(int32_t, Prepare, (), (override)); - MOCK_METHOD(int32_t, StartRender, (), (override)); - MOCK_METHOD(int32_t, RenderNextFrame, (), (override)); - MOCK_METHOD(int32_t, Pause, (), (override)); - MOCK_METHOD(int32_t, Resume, (), (override)); - MOCK_METHOD(int32_t, Flush, (), (override)); - MOCK_METHOD(int32_t, Stop, (), (override)); - MOCK_METHOD(int32_t, Reset, (), (override)); - MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs), (override)); - MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed), (override)); - MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters), (override)); - MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters), (override)); - MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk), (override)); - MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap), (override)); - MOCK_METHOD(int32_t, UnbindOutputBuffers, (), (override)); - MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd), (override)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId), (override)); - MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp), (override)); - MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver), (override)); -}; -} // namespace Media -} // namespace OHOS +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef LPP_SYNC_MANAGER_H +#define LPP_SYNC_MANAGER_H + +#include +#include "i_lpp_sync_manager.h" +#include "pipeline/pipeline.h" + +namespace OHOS { +namespace Media { +class LppSyncManager : public ILppSyncManager { +public: + explicit LppSyncManager(std::string videoStreamerId, bool isLpp) + { + (void)videoStreamerId; + (void)isLpp; + } + ~LppSyncManager() {}; + MOCK_METHOD(int32_t, Init, (), (override)); + MOCK_METHOD(int32_t, GetTimeAnchor, (int64_t&, int64_t&), (override)); + MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId), (override)); + MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId), (override)); + MOCK_METHOD(int32_t, Prepare, (), (override)); + MOCK_METHOD(int32_t, StartRender, (), (override)); + MOCK_METHOD(int32_t, RenderNextFrame, (), (override)); + MOCK_METHOD(int32_t, Pause, (), (override)); + MOCK_METHOD(int32_t, Resume, (), (override)); + MOCK_METHOD(int32_t, Flush, (), (override)); + MOCK_METHOD(int32_t, Stop, (), (override)); + MOCK_METHOD(int32_t, Reset, (), (override)); + MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs), (override)); + MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed), (override)); + MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters), (override)); + MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters), (override)); + MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk), (override)); + MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap), (override)); + MOCK_METHOD(int32_t, UnbindOutputBuffers, (), (override)); + MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd), (override)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId), (override)); + MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp), (override)); + MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver), (override)); + MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts), (override)); +}; +} // namespace Media +} // namespace OHOS #endif \ No newline at end of file -- Gitee From 06cdedc3743650eb9ec59450ab288b144eda238c Mon Sep 17 00:00:00 2001 From: zpf Date: Fri, 29 Aug 2025 11:44:15 +0000 Subject: [PATCH 6/7] Revert "fdfs" This reverts commit f23158a3828e4854a9ae65e240af2e52b8c04097. --- ddd.txt | 574 ------------------ .../lppplayer/native_lpp_video_streamer.cpp | 12 - .../video_streamer_impl.cpp | 10 - .../lpp_video_streamer/video_streamer_impl.h | 2 - .../inner_api/native/lpp_video_streamer.h | 2 - interfaces/kits/c/lowpower_video_sink.h | 14 - .../lpp/lpp_sync_manager/lpp_sync_manager.h | 1 - .../lpp_sync_manager_adapter.h | 2 - .../lpp_sync_manager/src/lpp_sync_manager.cpp | 10 - .../src/lpp_sync_manager_adapter.cpp | 8 - .../lpp_video_streamer/hilpp_vstreamer_impl.h | 1 - .../src/hilpp_vstreamer_impl.cpp | 7 - .../include/i_lpp_video_streamer_service.h | 2 - .../services/engine_intf/i_lpp_sync_manager.h | 1 - .../engine_intf/i_lpp_video_streamer.h | 1 - .../client/lpp_video_streamer_client.cpp | 10 - .../client/lpp_video_streamer_client.h | 2 - .../i_standard_lpp_video_streamer_service.h | 3 - .../ipc/lpp_video_streamer_service_proxy.cpp | 19 - .../ipc/lpp_video_streamer_service_proxy.h | 2 - .../ipc/lpp_video_streamer_service_stub.cpp | 24 - .../ipc/lpp_video_streamer_service_stub.h | 4 - .../server/lpp_video_streamer_server.cpp | 9 - .../server/lpp_video_streamer_server.h | 2 - .../corpus/H264_AAC.mp4 | 4 +- .../corpus/H264_MP3.mp4 | 4 +- .../corpus/H265_AAC.mp4 | 4 +- .../corpus/HDR.mp4 | 4 +- .../corpus/MPEG4_MP3.mp4 | 4 +- .../corpus/SDR.mp4 | 4 +- .../transcoderstub_fuzzer/corpus/HDR.mp4 | 4 +- .../transcoderstub_fuzzer/corpus/SDR.mp4 | 4 +- .../mock/i_lpp_sync_manager.h | 109 ++-- .../mock/hilpp_vstreamer_impl.h | 173 +++--- .../mock/lpp_sync_manager.h | 117 ++-- .../mock/lpp_sync_manager_adapter.h | 149 +++-- .../mock/v1_0/ilpp_sync_manager_adapter.h | 117 ++-- .../mock/lpp_sync_manager.h | 140 ++--- .../mock/lpp_sync_manager_adapter.h | 153 +++-- .../mock/lpp_sync_manager.h | 115 ++-- 40 files changed, 541 insertions(+), 1286 deletions(-) delete mode 100644 ddd.txt diff --git a/ddd.txt b/ddd.txt deleted file mode 100644 index d89690a4e..000000000 --- a/ddd.txt +++ /dev/null @@ -1,574 +0,0 @@ -From 33b8f932d957909ccce2c668cc1bbf0a65fd9c07 Mon Sep 17 00:00:00 2001 -From: z00654174 -Date: Thu, 28 Aug 2025 09:55:56 +0800 -Subject: [PATCH] TicketNo:DTS2022071803909 Description: pts Team:OTHERS - Feature or Bugfix:Bugfix Binary Source:NA PrivateCode(Yes/No):No - -Change-Id: Ic56a08bf0e57af135fe5d42d8c021fdd0250cf41 ---- - .../lppplayer/native_lpp_video_streamer.cpp | 12 ++++++++++ - .../video_streamer_impl.cpp | 10 ++++++++ - .../lpp_video_streamer/video_streamer_impl.h | 2 ++ - .../inner_api/native/lpp_video_streamer.h | 2 ++ - interfaces/kits/c/lowpower_video_sink.h | 14 +++++++++++ - .../lpp/lpp_sync_manager/lpp_sync_manager.h | 1 + - .../lpp_sync_manager_adapter.h | 2 ++ - .../lpp_sync_manager/src/lpp_sync_manager.cpp | 10 ++++++++ - .../src/lpp_sync_manager_adapter.cpp | 8 +++++++ - .../lpp_video_streamer/hilpp_vstreamer_impl.h | 1 + - .../src/hilpp_vstreamer_impl.cpp | 7 ++++++ - .../include/i_lpp_video_streamer_service.h | 2 ++ - .../services/engine_intf/i_lpp_sync_manager.h | 1 + - .../engine_intf/i_lpp_video_streamer.h | 1 + - .../client/lpp_video_streamer_client.cpp | 10 ++++++++ - .../client/lpp_video_streamer_client.h | 2 ++ - .../i_standard_lpp_video_streamer_service.h | 3 +++ - .../ipc/lpp_video_streamer_service_proxy.cpp | 19 +++++++++++++++ - .../ipc/lpp_video_streamer_service_proxy.h | 2 ++ - .../ipc/lpp_video_streamer_service_stub.cpp | 24 +++++++++++++++++++ - .../ipc/lpp_video_streamer_service_stub.h | 4 ++++ - .../server/lpp_video_streamer_server.cpp | 9 +++++++ - .../server/lpp_video_streamer_server.h | 2 ++ - .../mock/i_lpp_sync_manager.h | 1 + - .../mock/hilpp_vstreamer_impl.h | 1 + - .../mock/lpp_sync_manager.h | 1 + - .../mock/lpp_sync_manager_adapter.h | 1 + - .../mock/v1_0/ilpp_sync_manager_adapter.h | 1 + - .../mock/lpp_sync_manager.h | 2 +- - .../mock/lpp_sync_manager_adapter.h | 1 + - .../mock/lpp_sync_manager.h | 1 + - 31 files changed, 156 insertions(+), 1 deletion(-) - -diff --git a/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp b/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp -index 2147b2427..5ed1622b2 100644 ---- a/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp -+++ b/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp -@@ -634,6 +634,7 @@ OH_AVErrCode OH_LowPowerVideoSinkCallback_SetStreamChangedListener( - int32_t res = callback->SetStreamChangedListener(onStreamChanged, userData); - return LppMsErrToOHAvErr(res); - } -+ - OH_AVErrCode OH_LowPowerVideoSinkCallback_SetFirstFrameDecodedListener(OH_LowPowerVideoSinkCallback *callback, - OH_LowPowerVideoSink_OnFirstFrameDecoded onFirstFrameDecoded, void *userData) - { -@@ -643,3 +644,14 @@ OH_AVErrCode OH_LowPowerVideoSinkCallback_SetFirstFrameDecodedListener(OH_LowPow - int32_t res = callback->SetFirstFrameReadyListener(onFirstFrameDecoded, userData); - return LppMsErrToOHAvErr(res); - } -+ -+OH_AVErrCode OH_LowPowerVideoSink_GetLatestPts(OH_LowPowerVideoSink *streamer, int64_t *pts) -+{ -+ MEDIA_LOGD("OH_LowPowerVideoSink_GetLatestPts"); -+ CHECK_AND_RETURN_RET_LOG(streamer != nullptr, AV_ERR_INVALID_VAL, "streamer is nullptr!"); -+ LowPowerVideoSinkObject *streamerObj = reinterpret_cast(streamer); -+ CHECK_AND_RETURN_RET_LOG(streamerObj != nullptr, AV_ERR_INVALID_VAL, "streamerObj is nullptr"); -+ CHECK_AND_RETURN_RET_LOG(streamerObj->videoStreamer_ != nullptr, AV_ERR_INVALID_VAL, "videoStreamer_ is nullptr"); -+ int32_t res = streamerObj->videoStreamer_->GetLatestPts(*pts); -+ return LppMsErrToOHAvErr(res); -+} -diff --git a/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp b/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp -index f7adadd72..414b33325 100644 ---- a/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp -+++ b/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp -@@ -262,5 +262,15 @@ std::string VideoStreamerImpl::GetStreamerId() - CHECK_AND_RETURN_RET_LOG(streamerService_ != nullptr, "", "player service does not exist.."); - return streamerService_->GetStreamerId(); - } -+ -+int32_t VideoStreamerImpl::GetLatestPts(int64_t &pts) -+{ -+ MEDIA_LOGI("VideoStreamerImpl GetLatestPts"); -+ CHECK_AND_RETURN_RET_LOG(streamerService_ != nullptr, MSERR_SERVICE_DIED, -+ "GetLatestPts player service does not exist.."); -+ int32_t ret = streamerService_->GetLatestPts(pts); -+ pts = (ret == MSERR_OK) ? pts : 0; -+ return ret; -+} - } // namespace Media - } // namespace OHOS -diff --git a/frameworks/native/lpp_video_streamer/video_streamer_impl.h b/frameworks/native/lpp_video_streamer/video_streamer_impl.h -index 16015c442..1a0b1e3e9 100644 ---- a/frameworks/native/lpp_video_streamer/video_streamer_impl.h -+++ b/frameworks/native/lpp_video_streamer/video_streamer_impl.h -@@ -76,6 +76,8 @@ public: - - std::string GetStreamerId() override; - -+ int32_t GetLatestPts(int64_t &pts) override; -+ - private: - std::shared_ptr callback_; - std::shared_ptr streamerService_ = nullptr; -diff --git a/interfaces/inner_api/native/lpp_video_streamer.h b/interfaces/inner_api/native/lpp_video_streamer.h -index d29cd78a0..34de7d154 100644 ---- a/interfaces/inner_api/native/lpp_video_streamer.h -+++ b/interfaces/inner_api/native/lpp_video_streamer.h -@@ -103,6 +103,8 @@ public: - virtual int32_t RenderFirstFrame() = 0; - - virtual std::string GetStreamerId() = 0; -+ -+ virtual int32_t GetLatestPts(int64_t &pts) = 0; - }; - - class __attribute__((visibility("default"))) VideoStreamerFactory { -diff --git a/interfaces/kits/c/lowpower_video_sink.h b/interfaces/kits/c/lowpower_video_sink.h -index d1c11f7e3..f74db9821 100644 ---- a/interfaces/kits/c/lowpower_video_sink.h -+++ b/interfaces/kits/c/lowpower_video_sink.h -@@ -314,6 +314,20 @@ OH_AVErrCode OH_LowPowerVideoSink_SetTargetStartFrame( - const int64_t timeoutMs, - void* userData); - -+/** -+ * @brief Get the latest presentation timestamp (PTS) from lowpower video sink. -+ * -+ * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance. -+ * @param {int64_t*} pts Pointer to store the latest PTS value (in microseconds). -+ * @return Returns AV_ERR_OK if the timestamp is obtained successfully; -+ * otherwise, returns a specific error code as defined in {@link OH_AVErrCode}: -+ * {@link AV_ERR_INVALID_VAL} the sink is nullptr, or sink is invalid. -+ * {@link AV_ERR_SERVICE_DIED} media service is died. -+ * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted. -+ * @since 21 -+ */ -+OH_AVErrCode OH_LowPowerVideoSink_GetLatestPts(OH_LowPowerVideoSink *streamer, int64_t *pts); -+ - /** - * @brief Set playback speed for the lowpower video sink - * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance -diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h -index 229bbb003..52029e9a6 100644 ---- a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h -+++ b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h -@@ -50,6 +50,7 @@ public: - int32_t SetTunnelId(uint64_t tunnelId) override; - int32_t SetAudioIsLpp(bool isLpp) override; - void SetEventReceiver(std::shared_ptr eventReceiver) override; -+ int32_t GetLatestPts(int64_t &pts) override; - - private: - void ResetTimeAnchor(); -diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h -index c602d662d..a78c947e6 100644 ---- a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h -+++ b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h -@@ -56,6 +56,8 @@ public: - int32_t UnbindOutputBuffers(); - int32_t GetShareBuffer(int32_t &fd); - int32_t SetTunnelId(uint64_t tunnelId); -+ int32_t GetLatestPts(int64_t &pts); -+ - void OnError(const int32_t errorCode, const std::string &errorMsg); - void OnTargetArrived(const int64_t targetPts, const bool isTimeout); - void OnRenderStarted(); -diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp -index c6b7cdf88..392286602 100644 ---- a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp -+++ b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp -@@ -263,6 +263,16 @@ int32_t LppSyncManager::SetTunnelId(uint64_t tunnelId) - return MSERR_OK; - } - -+int32_t LppSyncManager::GetLatestPts(int64_t &pts) -+{ -+ MEDIA_LOG_I("LppSyncManager::GetLatestPts"); -+ FALSE_RETURN_V_NOLOG(videoIsLpp_, MSERR_UNKNOWN); -+ FALSE_RETURN_V_MSG_E(adapter_ != nullptr, MSERR_INVALID_OPERATION, "adapter_ is nullptr"); -+ auto ret = adapter_->GetLatestPts(pts); -+ FALSE_RETURN_V_MSG_E(ret == MSERR_OK, ret, "adapter_ GetLatestPts failed"); -+ return MSERR_OK; -+} -+ - int32_t LppSyncManager::SetAudioIsLpp(bool isLpp) - { - audioIsLpp_ = isLpp; -diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp -index 87b1d5615..dc5aa9195 100644 ---- a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp -+++ b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp -@@ -321,6 +321,14 @@ int32_t LppSyncManagerAdapter::SetTunnelId(uint64_t tunnelId) - return MSERR_OK; - } - -+int32_t LppSyncManagerAdapter::GetLatestPts(int64_t &pts) -+{ -+ MediaTrace trace("LppSyncManagerAdapter::GetLatestPts"); -+ MEDIA_LOG_I("GetLatestPts enter"); -+ FALSE_RETURN_V_MSG_E(syncMgrAdapter_ != nullptr, MSERR_INVALID_OPERATION, "syncMgrAdapter_ is nullptr"); -+ return syncMgrAdapter_->GetLatestPts(pts); -+} -+ - void LppSyncManagerAdapter::SetEventReceiver(std::shared_ptr eventReceiver) - { - eventReceiver_ = eventReceiver; -diff --git a/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h b/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h -index f39780d21..dd95907cc 100644 ---- a/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h -+++ b/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h -@@ -55,6 +55,7 @@ public: - std::string GetStreamerId() override; - std::shared_ptr GetLppSyncManager() override; - int32_t RenderFirstFrame() override; -+ int32_t GetLatestPts(int64_t &pts) override; - void OnEvent(const Event &event); - - private: -diff --git a/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp b/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp -index 782c14678..3de63dc00 100644 ---- a/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp -+++ b/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp -@@ -130,6 +130,13 @@ int32_t HiLppVideoStreamerImpl::SetParameter(const Format ¶m) - return MSERR_OK; - } - -+int32_t HiLppVideoStreamerImpl::GetLatestPts(int64_t &pts) -+{ -+ MEDIA_LOG_I("HiLppVideoStreamerImpl::GetLatestPts"); -+ FALSE_RETURN_V_MSG(vdec_ != nullptr, MSERR_INVALID_OPERATION, "vdec_ nullptr"); -+ return syncMgr_->GetLatestPts(pts); -+} -+ - int32_t HiLppVideoStreamerImpl::Configure(const Format ¶m) - { - FALSE_RETURN_V_MSG(vdec_ != nullptr, MSERR_INVALID_OPERATION, "vdec_ nullptr"); -diff --git a/services/include/i_lpp_video_streamer_service.h b/services/include/i_lpp_video_streamer_service.h -index ffdc2c52f..770d1470e 100644 ---- a/services/include/i_lpp_video_streamer_service.h -+++ b/services/include/i_lpp_video_streamer_service.h -@@ -75,6 +75,8 @@ public: - virtual std::string GetStreamerId() = 0; - - virtual int32_t RenderFirstFrame() = 0; -+ -+ virtual int32_t GetLatestPts(int64_t &pts) = 0; - }; - } // namespace Media - } // namespace OHOS -diff --git a/services/services/engine_intf/i_lpp_sync_manager.h b/services/services/engine_intf/i_lpp_sync_manager.h -index 2edba8cee..38f9bf540 100644 ---- a/services/services/engine_intf/i_lpp_sync_manager.h -+++ b/services/services/engine_intf/i_lpp_sync_manager.h -@@ -50,6 +50,7 @@ public: - virtual int32_t SetTunnelId(uint64_t tunnelId) = 0; - virtual int32_t SetAudioIsLpp(bool isLpp) = 0; - virtual void SetEventReceiver(std::shared_ptr eventReceiver) = 0; -+ virtual int32_t GetLatestPts(int64_t &pts) = 0; - }; - - } -diff --git a/services/services/engine_intf/i_lpp_video_streamer.h b/services/services/engine_intf/i_lpp_video_streamer.h -index 507230511..c411b1c94 100644 ---- a/services/services/engine_intf/i_lpp_video_streamer.h -+++ b/services/services/engine_intf/i_lpp_video_streamer.h -@@ -66,6 +66,7 @@ public: - virtual std::string GetStreamerId() = 0; - virtual std::shared_ptr GetLppSyncManager() = 0; - virtual int32_t RenderFirstFrame() = 0; -+ virtual int32_t GetLatestPts(int64_t &pts) = 0; - }; - } // namespace Media - } // namespace OHOS -diff --git a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp -index 952fda07b..dae58d353 100644 ---- a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp -+++ b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp -@@ -243,5 +243,15 @@ void LppVideoStreamerClient::MediaServerDied() - "mediaserver is died, please create a new video sink instance again"); - } - } -+ -+int32_t LppVideoStreamerClient::GetLatestPts(int64_t &pts) -+{ -+ MEDIA_LOGI("LppVideoStreamerClient GetLatestPts"); -+ CHECK_AND_RETURN_RET_LOG(playerProxy_ != nullptr, MSERR_SERVICE_DIED, -+ "LppVideoStreamerClient GetLatestPts player service does not exist.."); -+ int32_t ret = playerProxy_->GetLatestPts(pts); -+ CHECK_AND_RETURN_RET_LOG(ret == MSERR_OK, ret, "LppVideoStreamerClient GetLatestPts failed."); -+ return MSERR_OK; -+} - } // namespace Media - } // namespace OHOS -\ No newline at end of file -diff --git a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h -index 7b5a6885d..325f8e4a1 100644 ---- a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h -+++ b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h -@@ -76,6 +76,8 @@ public: - - int32_t RenderFirstFrame() override; - -+ int32_t GetLatestPts(int64_t &pts) override; -+ - void MediaServerDied(); - - private: -diff --git a/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h b/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h -index 32982afbf..c9928ef1d 100644 ---- a/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h -+++ b/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h -@@ -80,6 +80,8 @@ public: - - virtual int32_t RenderFirstFrame() = 0; - -+ virtual int32_t GetLatestPts(int64_t &pts) = 0; -+ - /** - * IPC code ID - */ -@@ -109,6 +111,7 @@ public: - GET_STREAM_ID, - SET_AUDIO_STREAMER_ID, - RENDER_FIRST_FRAME, -+ GET_LATEST_PTS, - MAX_IPC_ID, // all IPC codes should be added before MAX_IPC_ID - }; - -diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp -index c4556605e..898d65663 100644 ---- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp -+++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp -@@ -429,5 +429,24 @@ int32_t LppVideoStreamerServiceProxy::RenderFirstFrame() - return reply.ReadInt32(); - } - -+int32_t LppVideoStreamerServiceProxy::GetLatestPts(int64_t &pts) -+{ -+ MEDIA_LOGI("LppVideoStreamerServiceProxy GetLatestPts"); -+ MessageParcel data; -+ MessageParcel reply; -+ MessageOption option; -+ -+ bool token = data.WriteInterfaceToken(LppVideoStreamerServiceProxy::GetDescriptor()); -+ CHECK_AND_RETURN_RET_LOG(token, MSERR_INVALID_OPERATION, "Failed to write descriptor!"); -+ -+ int32_t error = Remote()->SendRequest(GET_LATEST_PTS, data, reply, option); -+ CHECK_AND_RETURN_RET_LOG( -+ error == MSERR_OK, MSERR_INVALID_OPERATION, "GetLatestPts SendRequest failed, error: %{public}d", error); -+ int32_t ret = reply.ReadInt32(); -+ pts = reply.ReadInt64(); -+ CHECK_AND_RETURN_RET_LOG( -+ ret == MSERR_OK, MSERR_INVALID_OPERATION, "GetLatestPts failed, error: %{public}d", ret); -+ return ret; -+} - } // namespace Media - } // namespace OHOS -diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h -index efc84e5a7..3ba478a87 100755 ---- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h -+++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h -@@ -74,6 +74,8 @@ public: - - std::string GetStreamerId() override; - -+ int32_t GetLatestPts(int64_t &pts) override; -+ - int32_t RenderFirstFrame() override; - private: - static inline BrokerDelegator delegator_; -diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp -index a3c2b2974..3c2caa459 100755 ---- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp -+++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp -@@ -82,6 +82,7 @@ int32_t LppVideoStreamerServiceStub::Init() - void LppVideoStreamerServiceStub::SetPlayerFuncs() - { - FillPlayerFuncPart1(); -+ FillPlayerFuncPart2(); - } - - void LppVideoStreamerServiceStub::FillPlayerFuncPart1() -@@ -136,6 +137,12 @@ void LppVideoStreamerServiceStub::FillPlayerFuncPart1() - [this](MessageParcel &data, MessageParcel &reply) { return RenderFirstFrame(data, reply); }}; - } - -+void LppVideoStreamerServiceStub::FillPlayerFuncPart2() -+{ -+ playerFuncs_[GET_LATEST_PTS] = {"Player::GetLatestPts", -+ [this](MessageParcel &data, MessageParcel &reply) { return GetLatestPts(data, reply); }}; -+} -+ - int LppVideoStreamerServiceStub::OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) - { -@@ -532,5 +539,22 @@ int32_t LppVideoStreamerServiceStub::RenderFirstFrame(MessageParcel &data, Messa - return MSERR_OK; - } - -+int32_t LppVideoStreamerServiceStub::GetLatestPts(int64_t &pts) -+{ -+ MEDIA_LOGI("LppVideoStreamerServiceStub::GetLatestPts"); -+ CHECK_AND_RETURN_RET_LOG(lppVideoPlayerServer_ != nullptr, MSERR_INVALID_OPERATION, "player server is nullptr"); -+ return lppVideoPlayerServer_->GetLatestPts(pts); -+} -+ -+int32_t LppVideoStreamerServiceStub::GetLatestPts(MessageParcel &data, MessageParcel &reply) -+{ -+ (void)data; -+ int64_t pts = 0; -+ int32_t ret = GetLatestPts(pts); -+ MEDIA_LOGI("LppVideoStreamerServiceStub::GetLatestPts %{public}d %{public}ld", ret, pts); -+ reply.WriteInt32(ret); -+ reply.WriteInt64(pts); -+ return MSERR_OK; -+} - } // namespace Media - } // namespace OHOS -diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h -index eca927564..e708a8e14 100755 ---- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h -+++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h -@@ -81,9 +81,12 @@ public: - - int32_t RenderFirstFrame() override; - -+ int32_t GetLatestPts(int64_t &pts) override; -+ - int32_t Init(); - void SetPlayerFuncs(); - void FillPlayerFuncPart1(); -+ void FillPlayerFuncPart2(); - - private: - LppVideoStreamerServiceStub(); -@@ -114,6 +117,7 @@ public: - int32_t SetLppAudioStreamerId(MessageParcel &data, MessageParcel &reply); - int32_t GetStreamerId(MessageParcel &data, MessageParcel &reply); - int32_t RenderFirstFrame(MessageParcel &data, MessageParcel &reply); -+ int32_t GetLatestPts(MessageParcel &data, MessageParcel &reply); - - std::shared_ptr lppVideoPlayerServer_ = nullptr; - std::map> playerFuncs_; -diff --git a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp -index aed5713f7..d1e3a1b1b 100644 ---- a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp -+++ b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp -@@ -287,6 +287,15 @@ int32_t LppVideoStreamerServer::SetLppVideoStreamerCallback(const std::shared_pt - return MSERR_OK; - } - -+int32_t LppVideoStreamerServer::GetLatestPts(int64_t &pts) -+{ -+ MEDIA_LOGI("LppVideoStreamerServer GetLatestPts"); -+ CHECK_AND_RETURN_RET_LOG(streamerEngine_ != nullptr, MSERR_INVALID_OPERATION, "streamerEngine_ is nullptr"); -+ auto ret = streamerEngine_->GetLatestPts(pts); -+ CHECK_AND_RETURN_RET_LOG(ret == MSERR_OK, ret, "GetLatestPts Failed!"); -+ return ret; -+} -+ - int32_t LppVideoStreamerServer::SetLppAudioStreamerId(const std::string audioStreamId) - { - MEDIA_LOGI("LppVideoStreamerServer SetLppAudioStreamerId"); -diff --git a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h -index beec97728..0fbf7b171 100644 ---- a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h -+++ b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h -@@ -94,6 +94,8 @@ public: - - int32_t RenderFirstFrame() override; - -+ int32_t GetLatestPts(int64_t &pts) override; -+ - void OnDataNeeded(const int32_t maxBufferSize, const int32_t maxFrameNum) override; - bool OnAnchorUpdateNeeded(int64_t &anchorPts, int64_t &anchorClk) override; - void OnError(const MediaServiceErrCode errCode, const std::string &errMsg) override; -diff --git a/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h b/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h -index 25e1a4f3a..be06f4c77 100644 ---- a/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h -+++ b/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h -@@ -49,6 +49,7 @@ public: - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); - MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp)); - MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); -+ MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); - }; - } - } -diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h -index 59dd5614a..22cb8bee1 100644 ---- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h -+++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h -@@ -52,6 +52,7 @@ public: - std::string GetStreamerId() override; - std::shared_ptr GetLppSyncManager() override; - int32_t RenderFirstFrame() override; -+ int32_t GetLatestPts(int64_t &pts) override; - void OnEvent(const Event &event); - - private: -diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h -index 73382ddfc..759e78384 100644 ---- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h -+++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h -@@ -53,6 +53,7 @@ public: - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId), (override)); - MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp), (override)); - MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver), (override)); -+ MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts), (override)); - }; - } // namespace Media - } // namespace OHOS -diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h -index ffeb753ab..22c25138f 100644 ---- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h -+++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h -@@ -51,6 +51,7 @@ public: - MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); - MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); -+ MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); - }; - - class LowPowerPlayerFactory { -diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h -index b522cb9dd..9c6e41ca8 100644 ---- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h -+++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h -@@ -51,6 +51,7 @@ public: - MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); - MOCK_METHOD(int32_t, GetShareBuffer, (int& fd)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); -+ MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); - }; - } // V1_0 - } // LowPowerPlayer -diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h -index 2bb991ea2..ef1f08996 100644 ---- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h -+++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h -@@ -49,7 +49,7 @@ public: - int32_t SetTunnelId(uint64_t tunnelId); - int32_t SetAudioIsLpp(bool isLpp); - void SetEventReceiver(std::shared_ptr eventReceiver); -- -+ int32_t GetLatestPts(int64_t &pts); - private: - void ResetTimeAnchor(); - -diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h -index 8c9532f45..341b27ab2 100644 ---- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h -+++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h -@@ -52,6 +52,7 @@ public: - MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); - MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); -+ MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); - }; - - class LowPowerPlayerFactory { -diff --git a/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h -index f7b3c55f1..6f4f09db0 100644 ---- a/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h -+++ b/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h -@@ -52,6 +52,7 @@ public: - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId), (override)); - MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp), (override)); - MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver), (override)); -+ MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts), (override)); - }; - } // namespace Media - } // namespace OHOS --- -2.45.2.huawei.10 - diff --git a/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp b/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp index 5ed1622b2..2147b2427 100644 --- a/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp +++ b/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp @@ -634,7 +634,6 @@ OH_AVErrCode OH_LowPowerVideoSinkCallback_SetStreamChangedListener( int32_t res = callback->SetStreamChangedListener(onStreamChanged, userData); return LppMsErrToOHAvErr(res); } - OH_AVErrCode OH_LowPowerVideoSinkCallback_SetFirstFrameDecodedListener(OH_LowPowerVideoSinkCallback *callback, OH_LowPowerVideoSink_OnFirstFrameDecoded onFirstFrameDecoded, void *userData) { @@ -644,14 +643,3 @@ OH_AVErrCode OH_LowPowerVideoSinkCallback_SetFirstFrameDecodedListener(OH_LowPow int32_t res = callback->SetFirstFrameReadyListener(onFirstFrameDecoded, userData); return LppMsErrToOHAvErr(res); } - -OH_AVErrCode OH_LowPowerVideoSink_GetLatestPts(OH_LowPowerVideoSink *streamer, int64_t *pts) -{ - MEDIA_LOGD("OH_LowPowerVideoSink_GetLatestPts"); - CHECK_AND_RETURN_RET_LOG(streamer != nullptr, AV_ERR_INVALID_VAL, "streamer is nullptr!"); - LowPowerVideoSinkObject *streamerObj = reinterpret_cast(streamer); - CHECK_AND_RETURN_RET_LOG(streamerObj != nullptr, AV_ERR_INVALID_VAL, "streamerObj is nullptr"); - CHECK_AND_RETURN_RET_LOG(streamerObj->videoStreamer_ != nullptr, AV_ERR_INVALID_VAL, "videoStreamer_ is nullptr"); - int32_t res = streamerObj->videoStreamer_->GetLatestPts(*pts); - return LppMsErrToOHAvErr(res); -} diff --git a/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp b/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp index 414b33325..f7adadd72 100644 --- a/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp +++ b/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp @@ -262,15 +262,5 @@ std::string VideoStreamerImpl::GetStreamerId() CHECK_AND_RETURN_RET_LOG(streamerService_ != nullptr, "", "player service does not exist.."); return streamerService_->GetStreamerId(); } - -int32_t VideoStreamerImpl::GetLatestPts(int64_t &pts) -{ - MEDIA_LOGI("VideoStreamerImpl GetLatestPts"); - CHECK_AND_RETURN_RET_LOG(streamerService_ != nullptr, MSERR_SERVICE_DIED, - "GetLatestPts player service does not exist.."); - int32_t ret = streamerService_->GetLatestPts(pts); - pts = (ret == MSERR_OK) ? pts : 0; - return ret; -} } // namespace Media } // namespace OHOS diff --git a/frameworks/native/lpp_video_streamer/video_streamer_impl.h b/frameworks/native/lpp_video_streamer/video_streamer_impl.h index 1a0b1e3e9..16015c442 100644 --- a/frameworks/native/lpp_video_streamer/video_streamer_impl.h +++ b/frameworks/native/lpp_video_streamer/video_streamer_impl.h @@ -76,8 +76,6 @@ public: std::string GetStreamerId() override; - int32_t GetLatestPts(int64_t &pts) override; - private: std::shared_ptr callback_; std::shared_ptr streamerService_ = nullptr; diff --git a/interfaces/inner_api/native/lpp_video_streamer.h b/interfaces/inner_api/native/lpp_video_streamer.h index 34de7d154..d29cd78a0 100644 --- a/interfaces/inner_api/native/lpp_video_streamer.h +++ b/interfaces/inner_api/native/lpp_video_streamer.h @@ -103,8 +103,6 @@ public: virtual int32_t RenderFirstFrame() = 0; virtual std::string GetStreamerId() = 0; - - virtual int32_t GetLatestPts(int64_t &pts) = 0; }; class __attribute__((visibility("default"))) VideoStreamerFactory { diff --git a/interfaces/kits/c/lowpower_video_sink.h b/interfaces/kits/c/lowpower_video_sink.h index f74db9821..d1c11f7e3 100644 --- a/interfaces/kits/c/lowpower_video_sink.h +++ b/interfaces/kits/c/lowpower_video_sink.h @@ -314,20 +314,6 @@ OH_AVErrCode OH_LowPowerVideoSink_SetTargetStartFrame( const int64_t timeoutMs, void* userData); -/** - * @brief Get the latest presentation timestamp (PTS) from lowpower video sink. - * - * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance. - * @param {int64_t*} pts Pointer to store the latest PTS value (in microseconds). - * @return Returns AV_ERR_OK if the timestamp is obtained successfully; - * otherwise, returns a specific error code as defined in {@link OH_AVErrCode}: - * {@link AV_ERR_INVALID_VAL} the sink is nullptr, or sink is invalid. - * {@link AV_ERR_SERVICE_DIED} media service is died. - * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted. - * @since 21 - */ -OH_AVErrCode OH_LowPowerVideoSink_GetLatestPts(OH_LowPowerVideoSink *streamer, int64_t *pts); - /** * @brief Set playback speed for the lowpower video sink * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h index 52029e9a6..229bbb003 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h +++ b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h @@ -50,7 +50,6 @@ public: int32_t SetTunnelId(uint64_t tunnelId) override; int32_t SetAudioIsLpp(bool isLpp) override; void SetEventReceiver(std::shared_ptr eventReceiver) override; - int32_t GetLatestPts(int64_t &pts) override; private: void ResetTimeAnchor(); diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h index a78c947e6..c602d662d 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h +++ b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h @@ -56,8 +56,6 @@ public: int32_t UnbindOutputBuffers(); int32_t GetShareBuffer(int32_t &fd); int32_t SetTunnelId(uint64_t tunnelId); - int32_t GetLatestPts(int64_t &pts); - void OnError(const int32_t errorCode, const std::string &errorMsg); void OnTargetArrived(const int64_t targetPts, const bool isTimeout); void OnRenderStarted(); diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp index 392286602..c6b7cdf88 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp +++ b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp @@ -263,16 +263,6 @@ int32_t LppSyncManager::SetTunnelId(uint64_t tunnelId) return MSERR_OK; } -int32_t LppSyncManager::GetLatestPts(int64_t &pts) -{ - MEDIA_LOG_I("LppSyncManager::GetLatestPts"); - FALSE_RETURN_V_NOLOG(videoIsLpp_, MSERR_UNKNOWN); - FALSE_RETURN_V_MSG_E(adapter_ != nullptr, MSERR_INVALID_OPERATION, "adapter_ is nullptr"); - auto ret = adapter_->GetLatestPts(pts); - FALSE_RETURN_V_MSG_E(ret == MSERR_OK, ret, "adapter_ GetLatestPts failed"); - return MSERR_OK; -} - int32_t LppSyncManager::SetAudioIsLpp(bool isLpp) { audioIsLpp_ = isLpp; diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp index dc5aa9195..87b1d5615 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp +++ b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp @@ -321,14 +321,6 @@ int32_t LppSyncManagerAdapter::SetTunnelId(uint64_t tunnelId) return MSERR_OK; } -int32_t LppSyncManagerAdapter::GetLatestPts(int64_t &pts) -{ - MediaTrace trace("LppSyncManagerAdapter::GetLatestPts"); - MEDIA_LOG_I("GetLatestPts enter"); - FALSE_RETURN_V_MSG_E(syncMgrAdapter_ != nullptr, MSERR_INVALID_OPERATION, "syncMgrAdapter_ is nullptr"); - return syncMgrAdapter_->GetLatestPts(pts); -} - void LppSyncManagerAdapter::SetEventReceiver(std::shared_ptr eventReceiver) { eventReceiver_ = eventReceiver; diff --git a/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h b/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h index dd95907cc..f39780d21 100644 --- a/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h +++ b/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h @@ -55,7 +55,6 @@ public: std::string GetStreamerId() override; std::shared_ptr GetLppSyncManager() override; int32_t RenderFirstFrame() override; - int32_t GetLatestPts(int64_t &pts) override; void OnEvent(const Event &event); private: diff --git a/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp b/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp index 4db33be9c..8b4e6c0e6 100644 --- a/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp +++ b/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp @@ -130,13 +130,6 @@ int32_t HiLppVideoStreamerImpl::SetParameter(const Format ¶m) return MSERR_OK; } -int32_t HiLppVideoStreamerImpl::GetLatestPts(int64_t &pts) -{ - MEDIA_LOG_I("HiLppVideoStreamerImpl::GetLatestPts"); - FALSE_RETURN_V_MSG(vdec_ != nullptr, MSERR_INVALID_OPERATION, "vdec_ nullptr"); - return syncMgr_->GetLatestPts(pts); -} - int32_t HiLppVideoStreamerImpl::Configure(const Format ¶m) { FALSE_RETURN_V_MSG(vdec_ != nullptr, MSERR_INVALID_OPERATION, "vdec_ nullptr"); diff --git a/services/include/i_lpp_video_streamer_service.h b/services/include/i_lpp_video_streamer_service.h index 770d1470e..ffdc2c52f 100644 --- a/services/include/i_lpp_video_streamer_service.h +++ b/services/include/i_lpp_video_streamer_service.h @@ -75,8 +75,6 @@ public: virtual std::string GetStreamerId() = 0; virtual int32_t RenderFirstFrame() = 0; - - virtual int32_t GetLatestPts(int64_t &pts) = 0; }; } // namespace Media } // namespace OHOS diff --git a/services/services/engine_intf/i_lpp_sync_manager.h b/services/services/engine_intf/i_lpp_sync_manager.h index 38f9bf540..2edba8cee 100644 --- a/services/services/engine_intf/i_lpp_sync_manager.h +++ b/services/services/engine_intf/i_lpp_sync_manager.h @@ -50,7 +50,6 @@ public: virtual int32_t SetTunnelId(uint64_t tunnelId) = 0; virtual int32_t SetAudioIsLpp(bool isLpp) = 0; virtual void SetEventReceiver(std::shared_ptr eventReceiver) = 0; - virtual int32_t GetLatestPts(int64_t &pts) = 0; }; } diff --git a/services/services/engine_intf/i_lpp_video_streamer.h b/services/services/engine_intf/i_lpp_video_streamer.h index c411b1c94..507230511 100644 --- a/services/services/engine_intf/i_lpp_video_streamer.h +++ b/services/services/engine_intf/i_lpp_video_streamer.h @@ -66,7 +66,6 @@ public: virtual std::string GetStreamerId() = 0; virtual std::shared_ptr GetLppSyncManager() = 0; virtual int32_t RenderFirstFrame() = 0; - virtual int32_t GetLatestPts(int64_t &pts) = 0; }; } // namespace Media } // namespace OHOS diff --git a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp index dae58d353..952fda07b 100644 --- a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp +++ b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp @@ -243,15 +243,5 @@ void LppVideoStreamerClient::MediaServerDied() "mediaserver is died, please create a new video sink instance again"); } } - -int32_t LppVideoStreamerClient::GetLatestPts(int64_t &pts) -{ - MEDIA_LOGI("LppVideoStreamerClient GetLatestPts"); - CHECK_AND_RETURN_RET_LOG(playerProxy_ != nullptr, MSERR_SERVICE_DIED, - "LppVideoStreamerClient GetLatestPts player service does not exist.."); - int32_t ret = playerProxy_->GetLatestPts(pts); - CHECK_AND_RETURN_RET_LOG(ret == MSERR_OK, ret, "LppVideoStreamerClient GetLatestPts failed."); - return MSERR_OK; -} } // namespace Media } // namespace OHOS \ No newline at end of file diff --git a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h index 325f8e4a1..7b5a6885d 100644 --- a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h +++ b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h @@ -76,8 +76,6 @@ public: int32_t RenderFirstFrame() override; - int32_t GetLatestPts(int64_t &pts) override; - void MediaServerDied(); private: diff --git a/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h b/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h index c9928ef1d..32982afbf 100644 --- a/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h +++ b/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h @@ -80,8 +80,6 @@ public: virtual int32_t RenderFirstFrame() = 0; - virtual int32_t GetLatestPts(int64_t &pts) = 0; - /** * IPC code ID */ @@ -111,7 +109,6 @@ public: GET_STREAM_ID, SET_AUDIO_STREAMER_ID, RENDER_FIRST_FRAME, - GET_LATEST_PTS, MAX_IPC_ID, // all IPC codes should be added before MAX_IPC_ID }; diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp index 898d65663..c4556605e 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp @@ -429,24 +429,5 @@ int32_t LppVideoStreamerServiceProxy::RenderFirstFrame() return reply.ReadInt32(); } -int32_t LppVideoStreamerServiceProxy::GetLatestPts(int64_t &pts) -{ - MEDIA_LOGI("LppVideoStreamerServiceProxy GetLatestPts"); - MessageParcel data; - MessageParcel reply; - MessageOption option; - - bool token = data.WriteInterfaceToken(LppVideoStreamerServiceProxy::GetDescriptor()); - CHECK_AND_RETURN_RET_LOG(token, MSERR_INVALID_OPERATION, "Failed to write descriptor!"); - - int32_t error = Remote()->SendRequest(GET_LATEST_PTS, data, reply, option); - CHECK_AND_RETURN_RET_LOG( - error == MSERR_OK, MSERR_INVALID_OPERATION, "GetLatestPts SendRequest failed, error: %{public}d", error); - int32_t ret = reply.ReadInt32(); - pts = reply.ReadInt64(); - CHECK_AND_RETURN_RET_LOG( - ret == MSERR_OK, MSERR_INVALID_OPERATION, "GetLatestPts failed, error: %{public}d", ret); - return ret; -} } // namespace Media } // namespace OHOS diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h index 3ba478a87..efc84e5a7 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h @@ -74,8 +74,6 @@ public: std::string GetStreamerId() override; - int32_t GetLatestPts(int64_t &pts) override; - int32_t RenderFirstFrame() override; private: static inline BrokerDelegator delegator_; diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp index 3c2caa459..a3c2b2974 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp @@ -82,7 +82,6 @@ int32_t LppVideoStreamerServiceStub::Init() void LppVideoStreamerServiceStub::SetPlayerFuncs() { FillPlayerFuncPart1(); - FillPlayerFuncPart2(); } void LppVideoStreamerServiceStub::FillPlayerFuncPart1() @@ -137,12 +136,6 @@ void LppVideoStreamerServiceStub::FillPlayerFuncPart1() [this](MessageParcel &data, MessageParcel &reply) { return RenderFirstFrame(data, reply); }}; } -void LppVideoStreamerServiceStub::FillPlayerFuncPart2() -{ - playerFuncs_[GET_LATEST_PTS] = {"Player::GetLatestPts", - [this](MessageParcel &data, MessageParcel &reply) { return GetLatestPts(data, reply); }}; -} - int LppVideoStreamerServiceStub::OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { @@ -539,22 +532,5 @@ int32_t LppVideoStreamerServiceStub::RenderFirstFrame(MessageParcel &data, Messa return MSERR_OK; } -int32_t LppVideoStreamerServiceStub::GetLatestPts(int64_t &pts) -{ - MEDIA_LOGI("LppVideoStreamerServiceStub::GetLatestPts"); - CHECK_AND_RETURN_RET_LOG(lppVideoPlayerServer_ != nullptr, MSERR_INVALID_OPERATION, "player server is nullptr"); - return lppVideoPlayerServer_->GetLatestPts(pts); -} - -int32_t LppVideoStreamerServiceStub::GetLatestPts(MessageParcel &data, MessageParcel &reply) -{ - (void)data; - int64_t pts = 0; - int32_t ret = GetLatestPts(pts); - MEDIA_LOGI("LppVideoStreamerServiceStub::GetLatestPts %{public}d %{public}ld", ret, pts); - reply.WriteInt32(ret); - reply.WriteInt64(pts); - return MSERR_OK; -} } // namespace Media } // namespace OHOS diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h index e708a8e14..eca927564 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h @@ -81,12 +81,9 @@ public: int32_t RenderFirstFrame() override; - int32_t GetLatestPts(int64_t &pts) override; - int32_t Init(); void SetPlayerFuncs(); void FillPlayerFuncPart1(); - void FillPlayerFuncPart2(); private: LppVideoStreamerServiceStub(); @@ -117,7 +114,6 @@ public: int32_t SetLppAudioStreamerId(MessageParcel &data, MessageParcel &reply); int32_t GetStreamerId(MessageParcel &data, MessageParcel &reply); int32_t RenderFirstFrame(MessageParcel &data, MessageParcel &reply); - int32_t GetLatestPts(MessageParcel &data, MessageParcel &reply); std::shared_ptr lppVideoPlayerServer_ = nullptr; std::map> playerFuncs_; diff --git a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp index 0f7725305..34462bbe3 100644 --- a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp +++ b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp @@ -287,15 +287,6 @@ int32_t LppVideoStreamerServer::SetLppVideoStreamerCallback(const std::shared_pt return MSERR_OK; } -int32_t LppVideoStreamerServer::GetLatestPts(int64_t &pts) -{ - MEDIA_LOGI("LppVideoStreamerServer GetLatestPts"); - CHECK_AND_RETURN_RET_LOG(streamerEngine_ != nullptr, MSERR_INVALID_OPERATION, "streamerEngine_ is nullptr"); - auto ret = streamerEngine_->GetLatestPts(pts); - CHECK_AND_RETURN_RET_LOG(ret == MSERR_OK, ret, "GetLatestPts Failed!"); - return ret; -} - int32_t LppVideoStreamerServer::SetLppAudioStreamerId(const std::string audioStreamId) { MEDIA_LOGI("LppVideoStreamerServer SetLppAudioStreamerId"); diff --git a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h index 0fbf7b171..beec97728 100644 --- a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h +++ b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h @@ -94,8 +94,6 @@ public: int32_t RenderFirstFrame() override; - int32_t GetLatestPts(int64_t &pts) override; - void OnDataNeeded(const int32_t maxBufferSize, const int32_t maxFrameNum) override; bool OnAnchorUpdateNeeded(int64_t &anchorPts, int64_t &anchorClk) override; void OnError(const MediaServiceErrCode errCode, const std::string &errMsg) override; diff --git a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H264_AAC.mp4 b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H264_AAC.mp4 index e26cfd93d..8018a7ddb 120000 --- a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H264_AAC.mp4 +++ b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H264_AAC.mp4 @@ -1,3 +1 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0015f820f9b7d097e7aa7ceff00b487705fc56796a296b6856f13626d8181d5e -size 58 +../../../../unittest/resources/test_videofile/H264_AAC.mp4 \ No newline at end of file diff --git a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H264_MP3.mp4 b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H264_MP3.mp4 index 917bfdf83..c6f57c87a 120000 --- a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H264_MP3.mp4 +++ b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H264_MP3.mp4 @@ -1,3 +1 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0e2ced1eadff8becbef63fcc3ef17027ababa64e629c48060f88f98e3601c927 -size 58 +../../../../unittest/resources/test_videofile/H264_MP3.mp4 \ No newline at end of file diff --git a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H265_AAC.mp4 b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H265_AAC.mp4 index 8b1c251c3..261e00984 120000 --- a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H265_AAC.mp4 +++ b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H265_AAC.mp4 @@ -1,3 +1 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8481eddd29472dcac39184fcda7f0624dd900fd2de64eb5eda24b792d13d54c5 -size 58 +../../../../unittest/resources/test_videofile/H265_AAC.mp4 \ No newline at end of file diff --git a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/HDR.mp4 b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/HDR.mp4 index 5759a5113..4e63b1b38 120000 --- a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/HDR.mp4 +++ b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/HDR.mp4 @@ -1,3 +1 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:34d977493439d8292e03ffaf04dac4ef33348ab85fd8d0abf97a82654c7087bb -size 53 +../../../../unittest/resources/test_videofile/HDR.mp4 \ No newline at end of file diff --git a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/MPEG4_MP3.mp4 b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/MPEG4_MP3.mp4 index 653bc0f33..ec0db91cc 120000 --- a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/MPEG4_MP3.mp4 +++ b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/MPEG4_MP3.mp4 @@ -1,3 +1 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7007548cb1f9b6ed00bde327e096de364dcdd17bef3a65fd2675d2efa830143c -size 59 +../../../../unittest/resources/test_videofile/MPEG4_MP3.mp4 \ No newline at end of file diff --git a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/SDR.mp4 b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/SDR.mp4 index ea2507691..87bcce8e0 120000 --- a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/SDR.mp4 +++ b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/SDR.mp4 @@ -1,3 +1 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5cd42264cd19387fcb8a93478d1033f3087a6c732191b0253a6429ac000d053f -size 53 +../../../../unittest/resources/test_videofile/SDR.mp4 \ No newline at end of file diff --git a/test/fuzztest/transcoder_fuzztest/transcoderstub_fuzzer/corpus/HDR.mp4 b/test/fuzztest/transcoder_fuzztest/transcoderstub_fuzzer/corpus/HDR.mp4 index 5759a5113..4e63b1b38 120000 --- a/test/fuzztest/transcoder_fuzztest/transcoderstub_fuzzer/corpus/HDR.mp4 +++ b/test/fuzztest/transcoder_fuzztest/transcoderstub_fuzzer/corpus/HDR.mp4 @@ -1,3 +1 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:34d977493439d8292e03ffaf04dac4ef33348ab85fd8d0abf97a82654c7087bb -size 53 +../../../../unittest/resources/test_videofile/HDR.mp4 \ No newline at end of file diff --git a/test/fuzztest/transcoder_fuzztest/transcoderstub_fuzzer/corpus/SDR.mp4 b/test/fuzztest/transcoder_fuzztest/transcoderstub_fuzzer/corpus/SDR.mp4 index ea2507691..87bcce8e0 120000 --- a/test/fuzztest/transcoder_fuzztest/transcoderstub_fuzzer/corpus/SDR.mp4 +++ b/test/fuzztest/transcoder_fuzztest/transcoderstub_fuzzer/corpus/SDR.mp4 @@ -1,3 +1 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5cd42264cd19387fcb8a93478d1033f3087a6c732191b0253a6429ac000d053f -size 53 +../../../../unittest/resources/test_videofile/SDR.mp4 \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h b/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h index 0f78ba26d..85e72ad28 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h @@ -1,56 +1,55 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef I_LPP_SYNC_MANAGER_H -#define I_LPP_SYNC_MANAGER_H -#include -#include -#include "format.h" -#include "i_lpp_video_streamer.h" -#include "pipeline/pipeline.h" - -namespace OHOS { -namespace Media { - -class ILppSyncManager : public std::enable_shared_from_this { -public: - virtual ~ILppSyncManager() = default; - MOCK_METHOD(int32_t, Init, ()); - MOCK_METHOD(int32_t, GetTimeAnchor, (int64_t &anchorPts, int64_t &anchorClock)); - MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId)); - MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId)); - MOCK_METHOD(int32_t, Prepare, ()); - MOCK_METHOD(int32_t, StartRender, ()); - MOCK_METHOD(int32_t, RenderNextFrame, ()); - MOCK_METHOD(int32_t, Pause, ()); - MOCK_METHOD(int32_t, Resume, ()); - MOCK_METHOD(int32_t, Flush, ()); - MOCK_METHOD(int32_t, Stop, ()); - MOCK_METHOD(int32_t, Reset, ()); - MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs)); - MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); - MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters)); - MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters)); - MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk)); - MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap)); - MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); - MOCK_METHOD(int32_t, GetShareBuffer, (int32_t &fd)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); - MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp)); - MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); - MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); -}; -} -} +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef I_LPP_SYNC_MANAGER_H +#define I_LPP_SYNC_MANAGER_H +#include +#include +#include "format.h" +#include "i_lpp_video_streamer.h" +#include "pipeline/pipeline.h" + +namespace OHOS { +namespace Media { + +class ILppSyncManager : public std::enable_shared_from_this { +public: + virtual ~ILppSyncManager() = default; + MOCK_METHOD(int32_t, Init, ()); + MOCK_METHOD(int32_t, GetTimeAnchor, (int64_t &anchorPts, int64_t &anchorClock)); + MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId)); + MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId)); + MOCK_METHOD(int32_t, Prepare, ()); + MOCK_METHOD(int32_t, StartRender, ()); + MOCK_METHOD(int32_t, RenderNextFrame, ()); + MOCK_METHOD(int32_t, Pause, ()); + MOCK_METHOD(int32_t, Resume, ()); + MOCK_METHOD(int32_t, Flush, ()); + MOCK_METHOD(int32_t, Stop, ()); + MOCK_METHOD(int32_t, Reset, ()); + MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs)); + MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); + MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters)); + MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters)); + MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk)); + MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap)); + MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); + MOCK_METHOD(int32_t, GetShareBuffer, (int32_t &fd)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); + MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp)); + MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); +}; +} +} #endif \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h index e43d47920..1b9af148f 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h +++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h @@ -1,88 +1,87 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef HILPP_VSTREAMER_IMPL_H -#define HILPP_VSTREAMER_IMPL_H -#include "i_lpp_video_streamer.h" -#include "i_lpp_sync_manager.h" -#include "pipeline/pipeline.h" -#include "lpp_video_data_manager.h" -#include "lpp_vdec_adapter.h" -#include "lpp_video_callback_looper.h" -#include "video_decoder_adapter.h" -#include "i_lpp_engine_manager.h" - -namespace OHOS { -namespace Media { - -class HiLppVideoStreamerImpl : public ILppVideoStreamerEngine, - public std::enable_shared_from_this { -public: - HiLppVideoStreamerImpl(); - ~HiLppVideoStreamerImpl() override; - int32_t Init(const std::string &mime) override; - int32_t SetObs(const std::weak_ptr &obs) override; - int32_t SetParameter(const Format ¶m) override; - int32_t Configure(const Format ¶m) override; - int32_t SetVideoSurface(sptr surface) override; - int32_t Prepare() override; - int32_t StartDecode() override; - int32_t StartRender() override; - int32_t Pause() override; - int32_t Resume() override; - int32_t Flush() override; - int32_t Stop() override; - int32_t Reset() override; - int32_t SetPlaybackSpeed(const float playbackSpeed) override; - int32_t SetSyncAudioStreamer(int streamerId) override; - int32_t SetTargetStartFrame(const int64_t targetPts, const int timeoutMs) override; - int32_t ReturnFrames(sptr framePacket) override; - int32_t SetLppAudioStreamerId(std::string audioStreamerId) override; - std::string GetStreamerId() override; - std::shared_ptr GetLppSyncManager() override; - int32_t RenderFirstFrame() override; - int32_t GetLatestPts(int64_t &pts) override; - void OnEvent(const Event &event); - -private: - void InitLppMode(); - void HandleDataNeededEvent(const Event &event); - void HandleFirstFrameReadyEvent(const Event &event); - void HandleRenderStartedEvent(const Event &event); - void HandleCompleteEvent(const Event &event); - void HandleResolutionChangeEvent(const Event &event); - void HandleTargetArrivedEvent(const Event &event); - int32_t EosPause(); - void HandleErrorEvent(const Event &event); - - bool isLpp_{false}; - std::string streamerId_{}; - int32_t channelId_{}; - int32_t shareBufferFd_{}; - sptr surface_{nullptr}; - std::shared_ptr dataMgr_{nullptr}; - std::shared_ptr vdec_{nullptr}; - std::shared_ptr syncMgr_{nullptr}; - std::shared_ptr callbackLooper_{nullptr}; - std::string audioStreamerId_{}; - std::weak_ptr audioStreamerEngine_; - std::shared_ptr eventReceiver_ {nullptr}; - - bool isChannelSetDone_ {false}; - bool isPaused_ {false}; - std::mutex pauseMutex_ {}; -}; -} // namespace Media -} // namespace OHOS +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef HILPP_VSTREAMER_IMPL_H +#define HILPP_VSTREAMER_IMPL_H +#include "i_lpp_video_streamer.h" +#include "i_lpp_sync_manager.h" +#include "pipeline/pipeline.h" +#include "lpp_video_data_manager.h" +#include "lpp_vdec_adapter.h" +#include "lpp_video_callback_looper.h" +#include "video_decoder_adapter.h" +#include "i_lpp_engine_manager.h" + +namespace OHOS { +namespace Media { + +class HiLppVideoStreamerImpl : public ILppVideoStreamerEngine, + public std::enable_shared_from_this { +public: + HiLppVideoStreamerImpl(); + ~HiLppVideoStreamerImpl() override; + int32_t Init(const std::string &mime) override; + int32_t SetObs(const std::weak_ptr &obs) override; + int32_t SetParameter(const Format ¶m) override; + int32_t Configure(const Format ¶m) override; + int32_t SetVideoSurface(sptr surface) override; + int32_t Prepare() override; + int32_t StartDecode() override; + int32_t StartRender() override; + int32_t Pause() override; + int32_t Resume() override; + int32_t Flush() override; + int32_t Stop() override; + int32_t Reset() override; + int32_t SetPlaybackSpeed(const float playbackSpeed) override; + int32_t SetSyncAudioStreamer(int streamerId) override; + int32_t SetTargetStartFrame(const int64_t targetPts, const int timeoutMs) override; + int32_t ReturnFrames(sptr framePacket) override; + int32_t SetLppAudioStreamerId(std::string audioStreamerId) override; + std::string GetStreamerId() override; + std::shared_ptr GetLppSyncManager() override; + int32_t RenderFirstFrame() override; + void OnEvent(const Event &event); + +private: + void InitLppMode(); + void HandleDataNeededEvent(const Event &event); + void HandleFirstFrameReadyEvent(const Event &event); + void HandleRenderStartedEvent(const Event &event); + void HandleCompleteEvent(const Event &event); + void HandleResolutionChangeEvent(const Event &event); + void HandleTargetArrivedEvent(const Event &event); + int32_t EosPause(); + void HandleErrorEvent(const Event &event); + + bool isLpp_{false}; + std::string streamerId_{}; + int32_t channelId_{}; + int32_t shareBufferFd_{}; + sptr surface_{nullptr}; + std::shared_ptr dataMgr_{nullptr}; + std::shared_ptr vdec_{nullptr}; + std::shared_ptr syncMgr_{nullptr}; + std::shared_ptr callbackLooper_{nullptr}; + std::string audioStreamerId_{}; + std::weak_ptr audioStreamerEngine_; + std::shared_ptr eventReceiver_ {nullptr}; + + bool isChannelSetDone_ {false}; + bool isPaused_ {false}; + std::mutex pauseMutex_ {}; +}; +} // namespace Media +} // namespace OHOS #endif \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h index 41bcde079..5cb2d3df5 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h @@ -1,60 +1,59 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef LPP_SYNC_MANAGER_H -#define LPP_SYNC_MANAGER_H - -#include -#include "i_lpp_sync_manager.h" -#include "lpp_sync_manager_adapter.h" -#include "pipeline/pipeline.h" - -namespace OHOS { -namespace Media { -class LppSyncManager : public ILppSyncManager { -public: - explicit LppSyncManager(std::string videoStreamerId, bool isLpp) - { - (void)videoStreamerId; - (void)isLpp; - } - ~LppSyncManager() {}; - MOCK_METHOD(int32_t, Init, (), (override)); - MOCK_METHOD(int32_t, GetTimeAnchor, (int64_t&, int64_t&), (override)); - MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId), (override)); - MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId), (override)); - MOCK_METHOD(int32_t, Prepare, (), (override)); - MOCK_METHOD(int32_t, StartRender, (), (override)); - MOCK_METHOD(int32_t, RenderNextFrame, (), (override)); - MOCK_METHOD(int32_t, Pause, (), (override)); - MOCK_METHOD(int32_t, Resume, (), (override)); - MOCK_METHOD(int32_t, Flush, (), (override)); - MOCK_METHOD(int32_t, Stop, (), (override)); - MOCK_METHOD(int32_t, Reset, (), (override)); - MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs), (override)); - MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed), (override)); - MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters), (override)); - MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters), (override)); - MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk), (override)); - MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap), (override)); - MOCK_METHOD(int32_t, UnbindOutputBuffers, (), (override)); - MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd), (override)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId), (override)); - MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp), (override)); - MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver), (override)); - MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts), (override)); -}; -} // namespace Media -} // namespace OHOS +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef LPP_SYNC_MANAGER_H +#define LPP_SYNC_MANAGER_H + +#include +#include "i_lpp_sync_manager.h" +#include "lpp_sync_manager_adapter.h" +#include "pipeline/pipeline.h" + +namespace OHOS { +namespace Media { +class LppSyncManager : public ILppSyncManager { +public: + explicit LppSyncManager(std::string videoStreamerId, bool isLpp) + { + (void)videoStreamerId; + (void)isLpp; + } + ~LppSyncManager() {}; + MOCK_METHOD(int32_t, Init, (), (override)); + MOCK_METHOD(int32_t, GetTimeAnchor, (int64_t&, int64_t&), (override)); + MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId), (override)); + MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId), (override)); + MOCK_METHOD(int32_t, Prepare, (), (override)); + MOCK_METHOD(int32_t, StartRender, (), (override)); + MOCK_METHOD(int32_t, RenderNextFrame, (), (override)); + MOCK_METHOD(int32_t, Pause, (), (override)); + MOCK_METHOD(int32_t, Resume, (), (override)); + MOCK_METHOD(int32_t, Flush, (), (override)); + MOCK_METHOD(int32_t, Stop, (), (override)); + MOCK_METHOD(int32_t, Reset, (), (override)); + MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs), (override)); + MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed), (override)); + MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters), (override)); + MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters), (override)); + MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk), (override)); + MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap), (override)); + MOCK_METHOD(int32_t, UnbindOutputBuffers, (), (override)); + MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd), (override)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId), (override)); + MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp), (override)); + MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver), (override)); +}; +} // namespace Media +} // namespace OHOS #endif \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h index e4f713430..2736d4528 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h +++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h @@ -1,76 +1,75 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef LPP_SYNC_MANAGER_ADAPTER_H -#define LPP_SYNC_MANAGER_ADAPTER_H - -#include -#include -#include -#include - -#include "media_core.h" -#include "player.h" -#include "surface_buffer.h" -#include "pipeline/pipeline.h" - -namespace OHOS { -namespace Media { -class LppSyncManagerAdapter : public std::enable_shared_from_this { -public: - MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId)); - MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId)); - MOCK_METHOD(int32_t, Init, ()); - MOCK_METHOD(int32_t, StartRender, ()); - MOCK_METHOD(int32_t, RenderNextFrame, ()); - MOCK_METHOD(int32_t, Pause, ()); - MOCK_METHOD(int32_t, Resume, ()); - MOCK_METHOD(int32_t, Flush, ()); - MOCK_METHOD(int32_t, Stop, ()); - MOCK_METHOD(int32_t, Reset, ()); - MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs)); - MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); - MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters)); - MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters)); - MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk)); - MOCK_METHOD(int32_t, LoadAdapter, (uint32_t& instanceId)); - MOCK_METHOD(int32_t, UnloadAdapter, (uint32_t instanceId)); - MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap)); - MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); - MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); - MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); - MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); -}; - -class LowPowerPlayerFactory { -public: - static int32_t CreateLppSyncManagerAdapter(uint32_t &instanceId, std::shared_ptr &adapter) - { - instanceId = 1; - if (adapter != nullptr) { - return 0; - } - adapter = std::make_shared(); - return 0; - } - static int32_t DestroyLppSyncManagerAdapter( - const uint32_t instanceId, std::shared_ptr adapter) - { - return 0; - } -}; -} // namespace Media -} // namespace OHOS +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef LPP_SYNC_MANAGER_ADAPTER_H +#define LPP_SYNC_MANAGER_ADAPTER_H + +#include +#include +#include +#include + +#include "media_core.h" +#include "player.h" +#include "surface_buffer.h" +#include "pipeline/pipeline.h" + +namespace OHOS { +namespace Media { +class LppSyncManagerAdapter : public std::enable_shared_from_this { +public: + MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId)); + MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId)); + MOCK_METHOD(int32_t, Init, ()); + MOCK_METHOD(int32_t, StartRender, ()); + MOCK_METHOD(int32_t, RenderNextFrame, ()); + MOCK_METHOD(int32_t, Pause, ()); + MOCK_METHOD(int32_t, Resume, ()); + MOCK_METHOD(int32_t, Flush, ()); + MOCK_METHOD(int32_t, Stop, ()); + MOCK_METHOD(int32_t, Reset, ()); + MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs)); + MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); + MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters)); + MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters)); + MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk)); + MOCK_METHOD(int32_t, LoadAdapter, (uint32_t& instanceId)); + MOCK_METHOD(int32_t, UnloadAdapter, (uint32_t instanceId)); + MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap)); + MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); + MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); + MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); +}; + +class LowPowerPlayerFactory { +public: + static int32_t CreateLppSyncManagerAdapter(uint32_t &instanceId, std::shared_ptr &adapter) + { + instanceId = 1; + if (adapter != nullptr) { + return 0; + } + adapter = std::make_shared(); + return 0; + } + static int32_t DestroyLppSyncManagerAdapter( + const uint32_t instanceId, std::shared_ptr adapter) + { + return 0; + } +}; +} // namespace Media +} // namespace OHOS #endif // LPP_SYNC_MANAGER_ADAPTER_H \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h index 4d467c105..9224148f3 100644 --- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h +++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h @@ -1,60 +1,59 @@ -/* - * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_HDI_LOW_POWER_PLAYER_V1_0_ILPPSYNCMANAGERADAPTER_H -#define OHOS_HDI_LOW_POWER_PLAYER_V1_0_ILPPSYNCMANAGERADAPTER_H - -#include -#include -#include - -#include "ilpp_sync_manager_callback.h" -#include "surface_buffer.h" -#include "../native_buffer.h" -#include "hdf_base.h" - -namespace OHOS { -namespace HDI { -namespace LowPowerPlayer { -namespace V1_0 { -using namespace OHOS::HDI::Base; -class ILppSyncManagerAdapter : public RefBase { -public: - MOCK_METHOD(int32_t, SetVideoChannelId, (uint32_t channelId)); - MOCK_METHOD(int32_t, SetAudioChannelId, (uint32_t channelId)); - MOCK_METHOD(int32_t, StartRender, ()); - MOCK_METHOD(int32_t, RenderNextFrame, ()); - MOCK_METHOD(int32_t, Pause, ()); - MOCK_METHOD(int32_t, Resume, ()); - MOCK_METHOD(int32_t, Flush, ()); - MOCK_METHOD(int32_t, Stop, ()); - MOCK_METHOD(int32_t, Reset, ()); - MOCK_METHOD(int32_t, SetTargetStartFrame, (uint64_t framePts, uint32_t timeoutMs)); - MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); - MOCK_METHOD(int32_t, RegisterCallback, (const sptr& syncCallback)); - MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameter)); - MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameter)); - MOCK_METHOD(int32_t, UpdateTimeAnchor, (int64_t anchorPts, int64_t anchorClk)); - MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& outputBuffers)); - MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); - MOCK_METHOD(int32_t, GetShareBuffer, (int& fd)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); - MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); -}; -} // V1_0 -} // LowPowerPlayer -} // HDI -} // OHOS +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_HDI_LOW_POWER_PLAYER_V1_0_ILPPSYNCMANAGERADAPTER_H +#define OHOS_HDI_LOW_POWER_PLAYER_V1_0_ILPPSYNCMANAGERADAPTER_H + +#include +#include +#include + +#include "ilpp_sync_manager_callback.h" +#include "surface_buffer.h" +#include "../native_buffer.h" +#include "hdf_base.h" + +namespace OHOS { +namespace HDI { +namespace LowPowerPlayer { +namespace V1_0 { +using namespace OHOS::HDI::Base; +class ILppSyncManagerAdapter : public RefBase { +public: + MOCK_METHOD(int32_t, SetVideoChannelId, (uint32_t channelId)); + MOCK_METHOD(int32_t, SetAudioChannelId, (uint32_t channelId)); + MOCK_METHOD(int32_t, StartRender, ()); + MOCK_METHOD(int32_t, RenderNextFrame, ()); + MOCK_METHOD(int32_t, Pause, ()); + MOCK_METHOD(int32_t, Resume, ()); + MOCK_METHOD(int32_t, Flush, ()); + MOCK_METHOD(int32_t, Stop, ()); + MOCK_METHOD(int32_t, Reset, ()); + MOCK_METHOD(int32_t, SetTargetStartFrame, (uint64_t framePts, uint32_t timeoutMs)); + MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); + MOCK_METHOD(int32_t, RegisterCallback, (const sptr& syncCallback)); + MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameter)); + MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameter)); + MOCK_METHOD(int32_t, UpdateTimeAnchor, (int64_t anchorPts, int64_t anchorClk)); + MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& outputBuffers)); + MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); + MOCK_METHOD(int32_t, GetShareBuffer, (int& fd)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); +}; +} // V1_0 +} // LowPowerPlayer +} // HDI +} // OHOS #endif // OHOS_HDI_LOW_POWER_PLAYER_V1_0_ILPPSYNCMANAGERADAPTER_H \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h index 75203ceba..3f3755f5a 100644 --- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h @@ -1,71 +1,71 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef LPP_SYNC_MANAGER_H -#define LPP_SYNC_MANAGER_H - -#include "lpp_sync_manager_adapter.h" -#include "osal/task/task.h" - -namespace OHOS { -namespace Media { - -class LppSyncManager : public std::enable_shared_from_this { -public: - explicit LppSyncManager(std::string videoStreamerId, bool isLpp); - ~LppSyncManager(); - int32_t GetTimeAnchor(int64_t &anchorPts, int64_t &anchorClock); - - int32_t SetVideoChannelId(const uint32_t channelId); - int32_t SetAudioChannelId(const uint32_t channelId); - int32_t Init(); - int32_t Prepare(); - int32_t StartRender(); - int32_t RenderNextFrame(); - int32_t Pause(); - int32_t Resume(); - int32_t Flush(); - int32_t Stop(); - int32_t Reset(); - int32_t SetTargetStartFrame(const uint64_t targetPts, uint32_t timeoutMs = 0); - int32_t SetPlaybackSpeed(float speed); - int32_t SetParameter(const std::map ¶meters); - int32_t GetParameter(std::map ¶meters); - int32_t UpdateTimeAnchor(const int64_t anchorPts, const int64_t anchorClk); - int32_t BindOutputBuffers(const std::map> &bufferMap); - int32_t UnbindOutputBuffers(); - int32_t GetShareBuffer(int32_t &fd); - int32_t SetTunnelId(uint64_t tunnelId); - int32_t SetAudioIsLpp(bool isLpp); - void SetEventReceiver(std::shared_ptr eventReceiver); - int32_t GetLatestPts(int64_t &pts); -private: - void ResetTimeAnchor(); - - uint32_t adapterId_ {0}; - std::string videoStreamerId_ {}; - std::shared_ptr adapter_ {nullptr}; - bool videoIsLpp_ {true}; - bool audioIsLpp_ {false}; - std::mutex anchorMutex_{}; - uint64_t localAnchorPts_ {0}; - uint64_t localAnchorClk_ {0}; - std::unique_ptr synctask_ {nullptr}; - std::shared_ptr eventReceiver_ {nullptr}; -}; - -} // namespace Media -} // namespace OHOS - +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef LPP_SYNC_MANAGER_H +#define LPP_SYNC_MANAGER_H + +#include "lpp_sync_manager_adapter.h" +#include "osal/task/task.h" + +namespace OHOS { +namespace Media { + +class LppSyncManager : public std::enable_shared_from_this { +public: + explicit LppSyncManager(std::string videoStreamerId, bool isLpp); + ~LppSyncManager(); + int32_t GetTimeAnchor(int64_t &anchorPts, int64_t &anchorClock); + + int32_t SetVideoChannelId(const uint32_t channelId); + int32_t SetAudioChannelId(const uint32_t channelId); + int32_t Init(); + int32_t Prepare(); + int32_t StartRender(); + int32_t RenderNextFrame(); + int32_t Pause(); + int32_t Resume(); + int32_t Flush(); + int32_t Stop(); + int32_t Reset(); + int32_t SetTargetStartFrame(const uint64_t targetPts, uint32_t timeoutMs = 0); + int32_t SetPlaybackSpeed(float speed); + int32_t SetParameter(const std::map ¶meters); + int32_t GetParameter(std::map ¶meters); + int32_t UpdateTimeAnchor(const int64_t anchorPts, const int64_t anchorClk); + int32_t BindOutputBuffers(const std::map> &bufferMap); + int32_t UnbindOutputBuffers(); + int32_t GetShareBuffer(int32_t &fd); + int32_t SetTunnelId(uint64_t tunnelId); + int32_t SetAudioIsLpp(bool isLpp); + void SetEventReceiver(std::shared_ptr eventReceiver); + +private: + void ResetTimeAnchor(); + + uint32_t adapterId_ {0}; + std::string videoStreamerId_ {}; + std::shared_ptr adapter_ {nullptr}; + bool videoIsLpp_ {true}; + bool audioIsLpp_ {false}; + std::mutex anchorMutex_{}; + uint64_t localAnchorPts_ {0}; + uint64_t localAnchorClk_ {0}; + std::unique_ptr synctask_ {nullptr}; + std::shared_ptr eventReceiver_ {nullptr}; +}; + +} // namespace Media +} // namespace OHOS + #endif \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h index 31cfa94e7..c9ea2f2e3 100644 --- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h +++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h @@ -1,78 +1,77 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef LPP_SYNC_MANAGER_ADAPTER_H -#define LPP_SYNC_MANAGER_ADAPTER_H - -#include -#include -#include -#include - -#include "media_core.h" -#include "player.h" -#include "surface_buffer.h" -#include "pipeline/pipeline.h" - -namespace OHOS { -namespace Media { - -class LppSyncManagerAdapter : public std::enable_shared_from_this { -public: - MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId)); - MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId)); - MOCK_METHOD(int32_t, Init, ()); - MOCK_METHOD(int32_t, StartRender, ()); - MOCK_METHOD(int32_t, RenderNextFrame, ()); - MOCK_METHOD(int32_t, Pause, ()); - MOCK_METHOD(int32_t, Resume, ()); - MOCK_METHOD(int32_t, Flush, ()); - MOCK_METHOD(int32_t, Stop, ()); - MOCK_METHOD(int32_t, Reset, ()); - MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs)); - MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); - MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters)); - MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters)); - MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk)); - MOCK_METHOD(int32_t, LoadAdapter, (uint32_t& instanceId)); - MOCK_METHOD(int32_t, UnloadAdapter, (uint32_t instanceId)); - MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap)); - MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); - MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); - MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); - MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); -}; - -class LowPowerPlayerFactory { -public: - static int32_t CreateLppSyncManagerAdapter(uint32_t &instanceId, std::shared_ptr &adapter) - { - instanceId = 1; - if (adapter != nullptr) { - return 0; - } - adapter = std::make_shared(); - return 0; - } - static int32_t DestroyLppSyncManagerAdapter( - const uint32_t instanceId, std::shared_ptr adapter) - { - return 0; - } -}; - -} // namespace Media -} // namespace OHOS +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef LPP_SYNC_MANAGER_ADAPTER_H +#define LPP_SYNC_MANAGER_ADAPTER_H + +#include +#include +#include +#include + +#include "media_core.h" +#include "player.h" +#include "surface_buffer.h" +#include "pipeline/pipeline.h" + +namespace OHOS { +namespace Media { + +class LppSyncManagerAdapter : public std::enable_shared_from_this { +public: + MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId)); + MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId)); + MOCK_METHOD(int32_t, Init, ()); + MOCK_METHOD(int32_t, StartRender, ()); + MOCK_METHOD(int32_t, RenderNextFrame, ()); + MOCK_METHOD(int32_t, Pause, ()); + MOCK_METHOD(int32_t, Resume, ()); + MOCK_METHOD(int32_t, Flush, ()); + MOCK_METHOD(int32_t, Stop, ()); + MOCK_METHOD(int32_t, Reset, ()); + MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs)); + MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed)); + MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters)); + MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters)); + MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk)); + MOCK_METHOD(int32_t, LoadAdapter, (uint32_t& instanceId)); + MOCK_METHOD(int32_t, UnloadAdapter, (uint32_t instanceId)); + MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap)); + MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); + MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); + MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); +}; + +class LowPowerPlayerFactory { +public: + static int32_t CreateLppSyncManagerAdapter(uint32_t &instanceId, std::shared_ptr &adapter) + { + instanceId = 1; + if (adapter != nullptr) { + return 0; + } + adapter = std::make_shared(); + return 0; + } + static int32_t DestroyLppSyncManagerAdapter( + const uint32_t instanceId, std::shared_ptr adapter) + { + return 0; + } +}; + +} // namespace Media +} // namespace OHOS #endif // LPP_SYNC_MANAGER_ADAPTER_H \ No newline at end of file diff --git a/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h index 496edb438..dbb510bf4 100644 --- a/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h @@ -1,59 +1,58 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef LPP_SYNC_MANAGER_H -#define LPP_SYNC_MANAGER_H - -#include -#include "i_lpp_sync_manager.h" -#include "pipeline/pipeline.h" - -namespace OHOS { -namespace Media { -class LppSyncManager : public ILppSyncManager { -public: - explicit LppSyncManager(std::string videoStreamerId, bool isLpp) - { - (void)videoStreamerId; - (void)isLpp; - } - ~LppSyncManager() {}; - MOCK_METHOD(int32_t, Init, (), (override)); - MOCK_METHOD(int32_t, GetTimeAnchor, (int64_t&, int64_t&), (override)); - MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId), (override)); - MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId), (override)); - MOCK_METHOD(int32_t, Prepare, (), (override)); - MOCK_METHOD(int32_t, StartRender, (), (override)); - MOCK_METHOD(int32_t, RenderNextFrame, (), (override)); - MOCK_METHOD(int32_t, Pause, (), (override)); - MOCK_METHOD(int32_t, Resume, (), (override)); - MOCK_METHOD(int32_t, Flush, (), (override)); - MOCK_METHOD(int32_t, Stop, (), (override)); - MOCK_METHOD(int32_t, Reset, (), (override)); - MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs), (override)); - MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed), (override)); - MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters), (override)); - MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters), (override)); - MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk), (override)); - MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap), (override)); - MOCK_METHOD(int32_t, UnbindOutputBuffers, (), (override)); - MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd), (override)); - MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId), (override)); - MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp), (override)); - MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver), (override)); - MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts), (override)); -}; -} // namespace Media -} // namespace OHOS +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef LPP_SYNC_MANAGER_H +#define LPP_SYNC_MANAGER_H + +#include +#include "i_lpp_sync_manager.h" +#include "pipeline/pipeline.h" + +namespace OHOS { +namespace Media { +class LppSyncManager : public ILppSyncManager { +public: + explicit LppSyncManager(std::string videoStreamerId, bool isLpp) + { + (void)videoStreamerId; + (void)isLpp; + } + ~LppSyncManager() {}; + MOCK_METHOD(int32_t, Init, (), (override)); + MOCK_METHOD(int32_t, GetTimeAnchor, (int64_t&, int64_t&), (override)); + MOCK_METHOD(int32_t, SetVideoChannelId, (const uint32_t channelId), (override)); + MOCK_METHOD(int32_t, SetAudioChannelId, (const uint32_t channelId), (override)); + MOCK_METHOD(int32_t, Prepare, (), (override)); + MOCK_METHOD(int32_t, StartRender, (), (override)); + MOCK_METHOD(int32_t, RenderNextFrame, (), (override)); + MOCK_METHOD(int32_t, Pause, (), (override)); + MOCK_METHOD(int32_t, Resume, (), (override)); + MOCK_METHOD(int32_t, Flush, (), (override)); + MOCK_METHOD(int32_t, Stop, (), (override)); + MOCK_METHOD(int32_t, Reset, (), (override)); + MOCK_METHOD(int32_t, SetTargetStartFrame, (const uint64_t targetPts, uint32_t timeoutMs), (override)); + MOCK_METHOD(int32_t, SetPlaybackSpeed, (float speed), (override)); + MOCK_METHOD(int32_t, SetParameter, ((const std::map)& parameters), (override)); + MOCK_METHOD(int32_t, GetParameter, ((std::map)& parameters), (override)); + MOCK_METHOD(int32_t, UpdateTimeAnchor, (const int64_t anchorPts, const int64_t anchorClk), (override)); + MOCK_METHOD(int32_t, BindOutputBuffers, ((const std::map>)& bufferMap), (override)); + MOCK_METHOD(int32_t, UnbindOutputBuffers, (), (override)); + MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd), (override)); + MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId), (override)); + MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp), (override)); + MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver), (override)); +}; +} // namespace Media +} // namespace OHOS #endif \ No newline at end of file -- Gitee From 73b11ef2692081c24897072148d804b209ae3aaf Mon Sep 17 00:00:00 2001 From: zpf Date: Fri, 29 Aug 2025 21:56:36 +0800 Subject: [PATCH 7/7] lpp pts see Signed-off-by: zpf --- .../lppplayer/native_lpp_video_streamer.cpp | 12 ++++++++++ .../video_streamer_impl.cpp | 10 ++++++++ .../lpp_video_streamer/video_streamer_impl.h | 2 ++ .../inner_api/native/lpp_video_streamer.h | 2 ++ interfaces/kits/c/lowpower_video_sink.h | 14 +++++++++++ .../lpp/lpp_sync_manager/lpp_sync_manager.h | 1 + .../lpp_sync_manager_adapter.h | 2 ++ .../lpp_sync_manager/src/lpp_sync_manager.cpp | 10 ++++++++ .../src/lpp_sync_manager_adapter.cpp | 8 +++++++ .../lpp_video_streamer/hilpp_vstreamer_impl.h | 1 + .../src/hilpp_vstreamer_impl.cpp | 7 ++++++ .../include/i_lpp_video_streamer_service.h | 2 ++ .../services/engine_intf/i_lpp_sync_manager.h | 1 + .../engine_intf/i_lpp_video_streamer.h | 1 + .../client/lpp_video_streamer_client.cpp | 10 ++++++++ .../client/lpp_video_streamer_client.h | 2 ++ .../i_standard_lpp_video_streamer_service.h | 3 +++ .../ipc/lpp_video_streamer_service_proxy.cpp | 19 +++++++++++++++ .../ipc/lpp_video_streamer_service_proxy.h | 2 ++ .../ipc/lpp_video_streamer_service_stub.cpp | 24 +++++++++++++++++++ .../ipc/lpp_video_streamer_service_stub.h | 4 ++++ .../server/lpp_video_streamer_server.cpp | 9 +++++++ .../server/lpp_video_streamer_server.h | 2 ++ .../corpus/H264_AAC.mp4 | 4 +++- .../corpus/H264_MP3.mp4 | 4 +++- .../corpus/H265_AAC.mp4 | 4 +++- .../corpus/HDR.mp4 | 4 +++- .../corpus/MPEG4_MP3.mp4 | 4 +++- .../corpus/SDR.mp4 | 4 +++- .../transcoderstub_fuzzer/corpus/HDR.mp4 | 4 +++- .../transcoderstub_fuzzer/corpus/SDR.mp4 | 4 +++- .../mock/i_lpp_sync_manager.h | 3 ++- .../mock/hilpp_vstreamer_impl.h | 3 ++- .../mock/lpp_sync_manager.h | 5 ++-- .../mock/lpp_sync_manager_adapter.h | 3 ++- .../mock/v1_0/ilpp_sync_manager_adapter.h | 3 ++- .../mock/lpp_sync_manager.h | 4 ++-- .../mock/lpp_sync_manager_adapter.h | 3 ++- .../mock/lpp_sync_manager.h | 3 ++- 39 files changed, 189 insertions(+), 18 deletions(-) diff --git a/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp b/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp index 2147b2427..5ed1622b2 100644 --- a/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp +++ b/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp @@ -634,6 +634,7 @@ OH_AVErrCode OH_LowPowerVideoSinkCallback_SetStreamChangedListener( int32_t res = callback->SetStreamChangedListener(onStreamChanged, userData); return LppMsErrToOHAvErr(res); } + OH_AVErrCode OH_LowPowerVideoSinkCallback_SetFirstFrameDecodedListener(OH_LowPowerVideoSinkCallback *callback, OH_LowPowerVideoSink_OnFirstFrameDecoded onFirstFrameDecoded, void *userData) { @@ -643,3 +644,14 @@ OH_AVErrCode OH_LowPowerVideoSinkCallback_SetFirstFrameDecodedListener(OH_LowPow int32_t res = callback->SetFirstFrameReadyListener(onFirstFrameDecoded, userData); return LppMsErrToOHAvErr(res); } + +OH_AVErrCode OH_LowPowerVideoSink_GetLatestPts(OH_LowPowerVideoSink *streamer, int64_t *pts) +{ + MEDIA_LOGD("OH_LowPowerVideoSink_GetLatestPts"); + CHECK_AND_RETURN_RET_LOG(streamer != nullptr, AV_ERR_INVALID_VAL, "streamer is nullptr!"); + LowPowerVideoSinkObject *streamerObj = reinterpret_cast(streamer); + CHECK_AND_RETURN_RET_LOG(streamerObj != nullptr, AV_ERR_INVALID_VAL, "streamerObj is nullptr"); + CHECK_AND_RETURN_RET_LOG(streamerObj->videoStreamer_ != nullptr, AV_ERR_INVALID_VAL, "videoStreamer_ is nullptr"); + int32_t res = streamerObj->videoStreamer_->GetLatestPts(*pts); + return LppMsErrToOHAvErr(res); +} diff --git a/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp b/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp index f7adadd72..414b33325 100644 --- a/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp +++ b/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp @@ -262,5 +262,15 @@ std::string VideoStreamerImpl::GetStreamerId() CHECK_AND_RETURN_RET_LOG(streamerService_ != nullptr, "", "player service does not exist.."); return streamerService_->GetStreamerId(); } + +int32_t VideoStreamerImpl::GetLatestPts(int64_t &pts) +{ + MEDIA_LOGI("VideoStreamerImpl GetLatestPts"); + CHECK_AND_RETURN_RET_LOG(streamerService_ != nullptr, MSERR_SERVICE_DIED, + "GetLatestPts player service does not exist.."); + int32_t ret = streamerService_->GetLatestPts(pts); + pts = (ret == MSERR_OK) ? pts : 0; + return ret; +} } // namespace Media } // namespace OHOS diff --git a/frameworks/native/lpp_video_streamer/video_streamer_impl.h b/frameworks/native/lpp_video_streamer/video_streamer_impl.h index 16015c442..1a0b1e3e9 100644 --- a/frameworks/native/lpp_video_streamer/video_streamer_impl.h +++ b/frameworks/native/lpp_video_streamer/video_streamer_impl.h @@ -76,6 +76,8 @@ public: std::string GetStreamerId() override; + int32_t GetLatestPts(int64_t &pts) override; + private: std::shared_ptr callback_; std::shared_ptr streamerService_ = nullptr; diff --git a/interfaces/inner_api/native/lpp_video_streamer.h b/interfaces/inner_api/native/lpp_video_streamer.h index d29cd78a0..34de7d154 100644 --- a/interfaces/inner_api/native/lpp_video_streamer.h +++ b/interfaces/inner_api/native/lpp_video_streamer.h @@ -103,6 +103,8 @@ public: virtual int32_t RenderFirstFrame() = 0; virtual std::string GetStreamerId() = 0; + + virtual int32_t GetLatestPts(int64_t &pts) = 0; }; class __attribute__((visibility("default"))) VideoStreamerFactory { diff --git a/interfaces/kits/c/lowpower_video_sink.h b/interfaces/kits/c/lowpower_video_sink.h index d1c11f7e3..f74db9821 100644 --- a/interfaces/kits/c/lowpower_video_sink.h +++ b/interfaces/kits/c/lowpower_video_sink.h @@ -314,6 +314,20 @@ OH_AVErrCode OH_LowPowerVideoSink_SetTargetStartFrame( const int64_t timeoutMs, void* userData); +/** + * @brief Get the latest presentation timestamp (PTS) from lowpower video sink. + * + * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance. + * @param {int64_t*} pts Pointer to store the latest PTS value (in microseconds). + * @return Returns AV_ERR_OK if the timestamp is obtained successfully; + * otherwise, returns a specific error code as defined in {@link OH_AVErrCode}: + * {@link AV_ERR_INVALID_VAL} the sink is nullptr, or sink is invalid. + * {@link AV_ERR_SERVICE_DIED} media service is died. + * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted. + * @since 21 + */ +OH_AVErrCode OH_LowPowerVideoSink_GetLatestPts(OH_LowPowerVideoSink *streamer, int64_t *pts); + /** * @brief Set playback speed for the lowpower video sink * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h index 229bbb003..52029e9a6 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h +++ b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager.h @@ -50,6 +50,7 @@ public: int32_t SetTunnelId(uint64_t tunnelId) override; int32_t SetAudioIsLpp(bool isLpp) override; void SetEventReceiver(std::shared_ptr eventReceiver) override; + int32_t GetLatestPts(int64_t &pts) override; private: void ResetTimeAnchor(); diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h index c602d662d..a78c947e6 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h +++ b/services/engine/histreamer/lpp/lpp_sync_manager/lpp_sync_manager_adapter.h @@ -56,6 +56,8 @@ public: int32_t UnbindOutputBuffers(); int32_t GetShareBuffer(int32_t &fd); int32_t SetTunnelId(uint64_t tunnelId); + int32_t GetLatestPts(int64_t &pts); + void OnError(const int32_t errorCode, const std::string &errorMsg); void OnTargetArrived(const int64_t targetPts, const bool isTimeout); void OnRenderStarted(); diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp index c6b7cdf88..392286602 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp +++ b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager.cpp @@ -263,6 +263,16 @@ int32_t LppSyncManager::SetTunnelId(uint64_t tunnelId) return MSERR_OK; } +int32_t LppSyncManager::GetLatestPts(int64_t &pts) +{ + MEDIA_LOG_I("LppSyncManager::GetLatestPts"); + FALSE_RETURN_V_NOLOG(videoIsLpp_, MSERR_UNKNOWN); + FALSE_RETURN_V_MSG_E(adapter_ != nullptr, MSERR_INVALID_OPERATION, "adapter_ is nullptr"); + auto ret = adapter_->GetLatestPts(pts); + FALSE_RETURN_V_MSG_E(ret == MSERR_OK, ret, "adapter_ GetLatestPts failed"); + return MSERR_OK; +} + int32_t LppSyncManager::SetAudioIsLpp(bool isLpp) { audioIsLpp_ = isLpp; diff --git a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp index 87b1d5615..dc5aa9195 100644 --- a/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp +++ b/services/engine/histreamer/lpp/lpp_sync_manager/src/lpp_sync_manager_adapter.cpp @@ -321,6 +321,14 @@ int32_t LppSyncManagerAdapter::SetTunnelId(uint64_t tunnelId) return MSERR_OK; } +int32_t LppSyncManagerAdapter::GetLatestPts(int64_t &pts) +{ + MediaTrace trace("LppSyncManagerAdapter::GetLatestPts"); + MEDIA_LOG_I("GetLatestPts enter"); + FALSE_RETURN_V_MSG_E(syncMgrAdapter_ != nullptr, MSERR_INVALID_OPERATION, "syncMgrAdapter_ is nullptr"); + return syncMgrAdapter_->GetLatestPts(pts); +} + void LppSyncManagerAdapter::SetEventReceiver(std::shared_ptr eventReceiver) { eventReceiver_ = eventReceiver; diff --git a/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h b/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h index f39780d21..dd95907cc 100644 --- a/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h +++ b/services/engine/histreamer/lpp/lpp_video_streamer/hilpp_vstreamer_impl.h @@ -55,6 +55,7 @@ public: std::string GetStreamerId() override; std::shared_ptr GetLppSyncManager() override; int32_t RenderFirstFrame() override; + int32_t GetLatestPts(int64_t &pts) override; void OnEvent(const Event &event); private: diff --git a/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp b/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp index 8b4e6c0e6..4db33be9c 100644 --- a/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp +++ b/services/engine/histreamer/lpp/lpp_video_streamer/src/hilpp_vstreamer_impl.cpp @@ -130,6 +130,13 @@ int32_t HiLppVideoStreamerImpl::SetParameter(const Format ¶m) return MSERR_OK; } +int32_t HiLppVideoStreamerImpl::GetLatestPts(int64_t &pts) +{ + MEDIA_LOG_I("HiLppVideoStreamerImpl::GetLatestPts"); + FALSE_RETURN_V_MSG(vdec_ != nullptr, MSERR_INVALID_OPERATION, "vdec_ nullptr"); + return syncMgr_->GetLatestPts(pts); +} + int32_t HiLppVideoStreamerImpl::Configure(const Format ¶m) { FALSE_RETURN_V_MSG(vdec_ != nullptr, MSERR_INVALID_OPERATION, "vdec_ nullptr"); diff --git a/services/include/i_lpp_video_streamer_service.h b/services/include/i_lpp_video_streamer_service.h index ffdc2c52f..770d1470e 100644 --- a/services/include/i_lpp_video_streamer_service.h +++ b/services/include/i_lpp_video_streamer_service.h @@ -75,6 +75,8 @@ public: virtual std::string GetStreamerId() = 0; virtual int32_t RenderFirstFrame() = 0; + + virtual int32_t GetLatestPts(int64_t &pts) = 0; }; } // namespace Media } // namespace OHOS diff --git a/services/services/engine_intf/i_lpp_sync_manager.h b/services/services/engine_intf/i_lpp_sync_manager.h index 2edba8cee..38f9bf540 100644 --- a/services/services/engine_intf/i_lpp_sync_manager.h +++ b/services/services/engine_intf/i_lpp_sync_manager.h @@ -50,6 +50,7 @@ public: virtual int32_t SetTunnelId(uint64_t tunnelId) = 0; virtual int32_t SetAudioIsLpp(bool isLpp) = 0; virtual void SetEventReceiver(std::shared_ptr eventReceiver) = 0; + virtual int32_t GetLatestPts(int64_t &pts) = 0; }; } diff --git a/services/services/engine_intf/i_lpp_video_streamer.h b/services/services/engine_intf/i_lpp_video_streamer.h index 507230511..c411b1c94 100644 --- a/services/services/engine_intf/i_lpp_video_streamer.h +++ b/services/services/engine_intf/i_lpp_video_streamer.h @@ -66,6 +66,7 @@ public: virtual std::string GetStreamerId() = 0; virtual std::shared_ptr GetLppSyncManager() = 0; virtual int32_t RenderFirstFrame() = 0; + virtual int32_t GetLatestPts(int64_t &pts) = 0; }; } // namespace Media } // namespace OHOS diff --git a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp index 952fda07b..dae58d353 100644 --- a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp +++ b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.cpp @@ -243,5 +243,15 @@ void LppVideoStreamerClient::MediaServerDied() "mediaserver is died, please create a new video sink instance again"); } } + +int32_t LppVideoStreamerClient::GetLatestPts(int64_t &pts) +{ + MEDIA_LOGI("LppVideoStreamerClient GetLatestPts"); + CHECK_AND_RETURN_RET_LOG(playerProxy_ != nullptr, MSERR_SERVICE_DIED, + "LppVideoStreamerClient GetLatestPts player service does not exist.."); + int32_t ret = playerProxy_->GetLatestPts(pts); + CHECK_AND_RETURN_RET_LOG(ret == MSERR_OK, ret, "LppVideoStreamerClient GetLatestPts failed."); + return MSERR_OK; +} } // namespace Media } // namespace OHOS \ No newline at end of file diff --git a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h index 7b5a6885d..325f8e4a1 100644 --- a/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h +++ b/services/services/lpp_video_streamer/client/lpp_video_streamer_client.h @@ -76,6 +76,8 @@ public: int32_t RenderFirstFrame() override; + int32_t GetLatestPts(int64_t &pts) override; + void MediaServerDied(); private: diff --git a/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h b/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h index 32982afbf..c9928ef1d 100644 --- a/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h +++ b/services/services/lpp_video_streamer/ipc/i_standard_lpp_video_streamer_service.h @@ -80,6 +80,8 @@ public: virtual int32_t RenderFirstFrame() = 0; + virtual int32_t GetLatestPts(int64_t &pts) = 0; + /** * IPC code ID */ @@ -109,6 +111,7 @@ public: GET_STREAM_ID, SET_AUDIO_STREAMER_ID, RENDER_FIRST_FRAME, + GET_LATEST_PTS, MAX_IPC_ID, // all IPC codes should be added before MAX_IPC_ID }; diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp index c4556605e..898d65663 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.cpp @@ -429,5 +429,24 @@ int32_t LppVideoStreamerServiceProxy::RenderFirstFrame() return reply.ReadInt32(); } +int32_t LppVideoStreamerServiceProxy::GetLatestPts(int64_t &pts) +{ + MEDIA_LOGI("LppVideoStreamerServiceProxy GetLatestPts"); + MessageParcel data; + MessageParcel reply; + MessageOption option; + + bool token = data.WriteInterfaceToken(LppVideoStreamerServiceProxy::GetDescriptor()); + CHECK_AND_RETURN_RET_LOG(token, MSERR_INVALID_OPERATION, "Failed to write descriptor!"); + + int32_t error = Remote()->SendRequest(GET_LATEST_PTS, data, reply, option); + CHECK_AND_RETURN_RET_LOG( + error == MSERR_OK, MSERR_INVALID_OPERATION, "GetLatestPts SendRequest failed, error: %{public}d", error); + int32_t ret = reply.ReadInt32(); + pts = reply.ReadInt64(); + CHECK_AND_RETURN_RET_LOG( + ret == MSERR_OK, MSERR_INVALID_OPERATION, "GetLatestPts failed, error: %{public}d", ret); + return ret; +} } // namespace Media } // namespace OHOS diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h index efc84e5a7..3ba478a87 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_proxy.h @@ -74,6 +74,8 @@ public: std::string GetStreamerId() override; + int32_t GetLatestPts(int64_t &pts) override; + int32_t RenderFirstFrame() override; private: static inline BrokerDelegator delegator_; diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp index a3c2b2974..3c2caa459 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.cpp @@ -82,6 +82,7 @@ int32_t LppVideoStreamerServiceStub::Init() void LppVideoStreamerServiceStub::SetPlayerFuncs() { FillPlayerFuncPart1(); + FillPlayerFuncPart2(); } void LppVideoStreamerServiceStub::FillPlayerFuncPart1() @@ -136,6 +137,12 @@ void LppVideoStreamerServiceStub::FillPlayerFuncPart1() [this](MessageParcel &data, MessageParcel &reply) { return RenderFirstFrame(data, reply); }}; } +void LppVideoStreamerServiceStub::FillPlayerFuncPart2() +{ + playerFuncs_[GET_LATEST_PTS] = {"Player::GetLatestPts", + [this](MessageParcel &data, MessageParcel &reply) { return GetLatestPts(data, reply); }}; +} + int LppVideoStreamerServiceStub::OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { @@ -532,5 +539,22 @@ int32_t LppVideoStreamerServiceStub::RenderFirstFrame(MessageParcel &data, Messa return MSERR_OK; } +int32_t LppVideoStreamerServiceStub::GetLatestPts(int64_t &pts) +{ + MEDIA_LOGI("LppVideoStreamerServiceStub::GetLatestPts"); + CHECK_AND_RETURN_RET_LOG(lppVideoPlayerServer_ != nullptr, MSERR_INVALID_OPERATION, "player server is nullptr"); + return lppVideoPlayerServer_->GetLatestPts(pts); +} + +int32_t LppVideoStreamerServiceStub::GetLatestPts(MessageParcel &data, MessageParcel &reply) +{ + (void)data; + int64_t pts = 0; + int32_t ret = GetLatestPts(pts); + MEDIA_LOGI("LppVideoStreamerServiceStub::GetLatestPts %{public}d %{public}ld", ret, pts); + reply.WriteInt32(ret); + reply.WriteInt64(pts); + return MSERR_OK; +} } // namespace Media } // namespace OHOS diff --git a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h index eca927564..e708a8e14 100644 --- a/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h +++ b/services/services/lpp_video_streamer/ipc/lpp_video_streamer_service_stub.h @@ -81,9 +81,12 @@ public: int32_t RenderFirstFrame() override; + int32_t GetLatestPts(int64_t &pts) override; + int32_t Init(); void SetPlayerFuncs(); void FillPlayerFuncPart1(); + void FillPlayerFuncPart2(); private: LppVideoStreamerServiceStub(); @@ -114,6 +117,7 @@ public: int32_t SetLppAudioStreamerId(MessageParcel &data, MessageParcel &reply); int32_t GetStreamerId(MessageParcel &data, MessageParcel &reply); int32_t RenderFirstFrame(MessageParcel &data, MessageParcel &reply); + int32_t GetLatestPts(MessageParcel &data, MessageParcel &reply); std::shared_ptr lppVideoPlayerServer_ = nullptr; std::map> playerFuncs_; diff --git a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp index 34462bbe3..0f7725305 100644 --- a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp +++ b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.cpp @@ -287,6 +287,15 @@ int32_t LppVideoStreamerServer::SetLppVideoStreamerCallback(const std::shared_pt return MSERR_OK; } +int32_t LppVideoStreamerServer::GetLatestPts(int64_t &pts) +{ + MEDIA_LOGI("LppVideoStreamerServer GetLatestPts"); + CHECK_AND_RETURN_RET_LOG(streamerEngine_ != nullptr, MSERR_INVALID_OPERATION, "streamerEngine_ is nullptr"); + auto ret = streamerEngine_->GetLatestPts(pts); + CHECK_AND_RETURN_RET_LOG(ret == MSERR_OK, ret, "GetLatestPts Failed!"); + return ret; +} + int32_t LppVideoStreamerServer::SetLppAudioStreamerId(const std::string audioStreamId) { MEDIA_LOGI("LppVideoStreamerServer SetLppAudioStreamerId"); diff --git a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h index beec97728..0fbf7b171 100644 --- a/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h +++ b/services/services/lpp_video_streamer/server/lpp_video_streamer_server.h @@ -94,6 +94,8 @@ public: int32_t RenderFirstFrame() override; + int32_t GetLatestPts(int64_t &pts) override; + void OnDataNeeded(const int32_t maxBufferSize, const int32_t maxFrameNum) override; bool OnAnchorUpdateNeeded(int64_t &anchorPts, int64_t &anchorClk) override; void OnError(const MediaServiceErrCode errCode, const std::string &errMsg) override; diff --git a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H264_AAC.mp4 b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H264_AAC.mp4 index 8018a7ddb..e26cfd93d 120000 --- a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H264_AAC.mp4 +++ b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H264_AAC.mp4 @@ -1 +1,3 @@ -../../../../unittest/resources/test_videofile/H264_AAC.mp4 \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:0015f820f9b7d097e7aa7ceff00b487705fc56796a296b6856f13626d8181d5e +size 58 diff --git a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H264_MP3.mp4 b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H264_MP3.mp4 index c6f57c87a..917bfdf83 120000 --- a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H264_MP3.mp4 +++ b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H264_MP3.mp4 @@ -1 +1,3 @@ -../../../../unittest/resources/test_videofile/H264_MP3.mp4 \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:0e2ced1eadff8becbef63fcc3ef17027ababa64e629c48060f88f98e3601c927 +size 58 diff --git a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H265_AAC.mp4 b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H265_AAC.mp4 index 261e00984..8b1c251c3 120000 --- a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H265_AAC.mp4 +++ b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/H265_AAC.mp4 @@ -1 +1,3 @@ -../../../../unittest/resources/test_videofile/H265_AAC.mp4 \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:8481eddd29472dcac39184fcda7f0624dd900fd2de64eb5eda24b792d13d54c5 +size 58 diff --git a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/HDR.mp4 b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/HDR.mp4 index 4e63b1b38..5759a5113 120000 --- a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/HDR.mp4 +++ b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/HDR.mp4 @@ -1 +1,3 @@ -../../../../unittest/resources/test_videofile/HDR.mp4 \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:34d977493439d8292e03ffaf04dac4ef33348ab85fd8d0abf97a82654c7087bb +size 53 diff --git a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/MPEG4_MP3.mp4 b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/MPEG4_MP3.mp4 index ec0db91cc..653bc0f33 120000 --- a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/MPEG4_MP3.mp4 +++ b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/MPEG4_MP3.mp4 @@ -1 +1,3 @@ -../../../../unittest/resources/test_videofile/MPEG4_MP3.mp4 \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:7007548cb1f9b6ed00bde327e096de364dcdd17bef3a65fd2675d2efa830143c +size 59 diff --git a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/SDR.mp4 b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/SDR.mp4 index 87bcce8e0..ea2507691 120000 --- a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/SDR.mp4 +++ b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/corpus/SDR.mp4 @@ -1 +1,3 @@ -../../../../unittest/resources/test_videofile/SDR.mp4 \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:5cd42264cd19387fcb8a93478d1033f3087a6c732191b0253a6429ac000d053f +size 53 diff --git a/test/fuzztest/transcoder_fuzztest/transcoderstub_fuzzer/corpus/HDR.mp4 b/test/fuzztest/transcoder_fuzztest/transcoderstub_fuzzer/corpus/HDR.mp4 index 4e63b1b38..5759a5113 120000 --- a/test/fuzztest/transcoder_fuzztest/transcoderstub_fuzzer/corpus/HDR.mp4 +++ b/test/fuzztest/transcoder_fuzztest/transcoderstub_fuzzer/corpus/HDR.mp4 @@ -1 +1,3 @@ -../../../../unittest/resources/test_videofile/HDR.mp4 \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:34d977493439d8292e03ffaf04dac4ef33348ab85fd8d0abf97a82654c7087bb +size 53 diff --git a/test/fuzztest/transcoder_fuzztest/transcoderstub_fuzzer/corpus/SDR.mp4 b/test/fuzztest/transcoder_fuzztest/transcoderstub_fuzzer/corpus/SDR.mp4 index 87bcce8e0..ea2507691 120000 --- a/test/fuzztest/transcoder_fuzztest/transcoderstub_fuzzer/corpus/SDR.mp4 +++ b/test/fuzztest/transcoder_fuzztest/transcoderstub_fuzzer/corpus/SDR.mp4 @@ -1 +1,3 @@ -../../../../unittest/resources/test_videofile/SDR.mp4 \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:5cd42264cd19387fcb8a93478d1033f3087a6c732191b0253a6429ac000d053f +size 53 diff --git a/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h b/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h index 85e72ad28..45f109f17 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/engine/lpp_astream_impl_unit_test/mock/i_lpp_sync_manager.h @@ -49,7 +49,8 @@ public: MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp)); MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); + MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); }; } } -#endif \ No newline at end of file +#endif diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h index 1b9af148f..10b508f89 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h +++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/hilpp_vstreamer_impl.h @@ -52,6 +52,7 @@ public: std::string GetStreamerId() override; std::shared_ptr GetLppSyncManager() override; int32_t RenderFirstFrame() override; + int32_t GetLatestPts(int64_t &pts) override; void OnEvent(const Event &event); private: @@ -84,4 +85,4 @@ private: }; } // namespace Media } // namespace OHOS -#endif \ No newline at end of file +#endif diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h index 5cb2d3df5..936367e5a 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager.h @@ -1,4 +1,4 @@ -/* +:/* * Copyright (C) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,7 +53,8 @@ public: MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId), (override)); MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp), (override)); MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver), (override)); + MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts), (override)); }; } // namespace Media } // namespace OHOS -#endif \ No newline at end of file +#endif diff --git a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h index 2736d4528..360d66151 100644 --- a/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h +++ b/test/unittest/lpp_unit_test/engine/lpp_video_stream_unit_test/mock/lpp_sync_manager_adapter.h @@ -51,6 +51,7 @@ public: MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd)); MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); + MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); }; class LowPowerPlayerFactory { @@ -72,4 +73,4 @@ public: }; } // namespace Media } // namespace OHOS -#endif // LPP_SYNC_MANAGER_ADAPTER_H \ No newline at end of file +#endif // LPP_SYNC_MANAGER_ADAPTER_H diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h index 9224148f3..6bb4fae05 100644 --- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h +++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_adapter_unit_test/mock/v1_0/ilpp_sync_manager_adapter.h @@ -51,9 +51,10 @@ public: MOCK_METHOD(int32_t, UnbindOutputBuffers, ()); MOCK_METHOD(int32_t, GetShareBuffer, (int& fd)); MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); + MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); }; } // V1_0 } // LowPowerPlayer } // HDI } // OHOS -#endif // OHOS_HDI_LOW_POWER_PLAYER_V1_0_ILPPSYNCMANAGERADAPTER_H \ No newline at end of file +#endif // OHOS_HDI_LOW_POWER_PLAYER_V1_0_ILPPSYNCMANAGERADAPTER_H diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h index 3f3755f5a..b7b4f8352 100644 --- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager.h @@ -49,7 +49,7 @@ public: int32_t SetTunnelId(uint64_t tunnelId); int32_t SetAudioIsLpp(bool isLpp); void SetEventReceiver(std::shared_ptr eventReceiver); - + int32_t GetLatestPts(int64_t &pts); private: void ResetTimeAnchor(); @@ -68,4 +68,4 @@ private: } // namespace Media } // namespace OHOS -#endif \ No newline at end of file +#endif diff --git a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h index c9ea2f2e3..aa01564c0 100644 --- a/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h +++ b/test/unittest/lpp_unit_test/module/lpp_sync_mgr_unit_test/mock/lpp_sync_manager_adapter.h @@ -52,6 +52,7 @@ public: MOCK_METHOD(int32_t, GetShareBuffer, (int32_t& fd)); MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId)); MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver)); + MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts)); }; class LowPowerPlayerFactory { @@ -74,4 +75,4 @@ public: } // namespace Media } // namespace OHOS -#endif // LPP_SYNC_MANAGER_ADAPTER_H \ No newline at end of file +#endif // LPP_SYNC_MANAGER_ADAPTER_H diff --git a/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h b/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h index dbb510bf4..0b0d892df 100644 --- a/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h +++ b/test/unittest/lpp_unit_test/module/lpp_video_dec_adapter_unit_test/mock/lpp_sync_manager.h @@ -52,7 +52,8 @@ public: MOCK_METHOD(int32_t, SetTunnelId, (uint64_t tunnelId), (override)); MOCK_METHOD(int32_t, SetAudioIsLpp, (bool isLpp), (override)); MOCK_METHOD(void, SetEventReceiver, (std::shared_ptr eventReceiver), (override)); + MOCK_METHOD(int32_t, GetLatestPts, (int64_t &pts), (override)); }; } // namespace Media } // namespace OHOS -#endif \ No newline at end of file +#endif -- Gitee