diff --git a/frameworks/native/capi/common/native_player_magic.h b/frameworks/native/capi/common/native_player_magic.h index b38fc9ddae2852eb1138e74abf0e95bbdefce3f6..60051f9edcc22b6350df065bb014cb27d2ac3cc7 100644 --- a/frameworks/native/capi/common/native_player_magic.h +++ b/frameworks/native/capi/common/native_player_magic.h @@ -90,4 +90,8 @@ struct OH_AVSamplesBuffer : public OHOS::RefBase { virtual ~OH_AVSamplesBuffer() = default; }; +struct OH_LowPowerAVSink_Capability : public OHOS::RefBase { + OH_LowPowerAVSink_Capability() = default; + virtual ~OH_LowPowerAVSink_Capability() = default; +}; #endif // NATIVE_SCREEN_CAPTURE_MAGIC_H \ No newline at end of file diff --git a/frameworks/native/capi/lppplayer/native_lpp_common.h b/frameworks/native/capi/lppplayer/native_lpp_common.h index e72ec635e5f8c3502442abb7794277ec82554ff5..4780f568e0127038da280c9ac28b3bad85fc91f6 100644 --- a/frameworks/native/capi/lppplayer/native_lpp_common.h +++ b/frameworks/native/capi/lppplayer/native_lpp_common.h @@ -35,6 +35,7 @@ #include "lpp_video_streamer.h" #include "lpp_common.h" #include "native_window.h" +#include "lpp_capability.h" namespace OHOS { namespace Media { @@ -93,6 +94,15 @@ struct LowPowerVideoSinkObject : public OH_LowPowerVideoSink { const std::shared_ptr videoStreamer_ = nullptr; AVSamplesBufferObject *framePacket_ = nullptr; }; + +struct LowPowerAVSinkCapabilityObject : public OH_LowPowerAVSink_Capability { + explicit LowPowerAVSinkCapabilityObject(std::shared_ptr lppCapibility) + : lppCapibility_(lppCapibility) + {} + ~LowPowerAVSinkCapabilityObject() = default; + + std::shared_ptr lppCapibility_ = nullptr; +}; } // namespace Media } // namespace OHOS #endif // NATIVE_LPP_COMMON_H \ No newline at end of file diff --git a/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp b/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp index 2147b242756b3cc91bff16d3c4ed925080bef40b..94c60dfe57d60c777364c7e27003c64d5c7bf32e 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,18 @@ OH_AVErrCode OH_LowPowerVideoSinkCallback_SetFirstFrameDecodedListener(OH_LowPow int32_t res = callback->SetFirstFrameReadyListener(onFirstFrameDecoded, userData); return LppMsErrToOHAvErr(res); } + +OH_LowPowerAVSink_Capability *OH_LowPowerAVSink_GetCapability() +{ + MEDIA_LOGD("OH_LowPowerAVSink_GetCapability"); + LppAvCapabilityInfo *info = VideoStreamerFactory::GetLppCapacity(); + CHECK_AND_RETURN_RET_LOG(info != nullptr, nullptr, "info is nullptr!"); + std::shared_ptr sharedPtr(info); + info = nullptr; + CHECK_AND_RETURN_RET_LOG(sharedPtr != nullptr, nullptr, "sharedPtr is nullptr!"); + LowPowerAVSinkCapabilityObject *object = new(std::nothrow) LowPowerAVSinkCapabilityObject(sharedPtr); + CHECK_AND_RETURN_RET_LOG(object != nullptr, nullptr, "object is nullptr!"); + MEDIA_LOGI("OH_LowPowerAVSink_Capability *OH_LowPowerAVSink_GetCapability() %{public}zu %{public}zu", + object->lppCapibility_->videoCap_.size(), object->lppCapibility_->audioCap_.size()); + return object; +} diff --git a/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp b/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp index f7adadd72a932eb07fc7187d21a2cd65acb715e6..d7bf73f3fb7e02af0cebfad7d69611355d7fde93 100644 --- a/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp +++ b/frameworks/native/lpp_video_streamer/video_streamer_impl.cpp @@ -34,6 +34,13 @@ std::shared_ptr VideoStreamerFactory::CreateByMime(const std::str return impl; } +LppAvCapabilityInfo *VideoStreamerFactory::GetLppCapacity() +{ + LppAvCapabilityInfo *lppAvCapability = MediaServiceFactory::GetInstance().GetLppCapacity(); + CHECK_AND_RETURN_RET_LOG(lppAvCapability != nullptr, nullptr, "VideoStreamerFactory::failed to GetLppCapacity"); + return lppAvCapability; +} + int32_t VideoStreamerImpl::Init(const std::string &mime) { MEDIA_LOGI("VideoStreamerImpl Init, mime %{public}s", mime.c_str()); diff --git a/frameworks/native/media_service_helper/BUILD.gn b/frameworks/native/media_service_helper/BUILD.gn index a4124df862ed642975b5d111bfae27fa1609d0bb..3575301353d19db644367374de87b1f49fb5e677 100644 --- a/frameworks/native/media_service_helper/BUILD.gn +++ b/frameworks/native/media_service_helper/BUILD.gn @@ -100,9 +100,15 @@ ohos_shared_library("media_helper_client") { "hilog:libhilog", "image_framework:image_native", "ipc:ipc_single", - "media_foundation:media_foundation" + "media_foundation:media_foundation", ] + if (player_framework_support_lowpower_av_sink) { + external_deps += [ + "drivers_interface_lpplayer:liblow_power_player_proxy_1.0", + ] + } + innerapi_tags = [ "platformsdk" ] subsystem_name = "multimedia" part_name = "player_framework" diff --git a/interfaces/inner_api/native/BUILD.gn b/interfaces/inner_api/native/BUILD.gn index 10b2a4ae06ab6f447a0b36431d078666278b028f..a89225c8ce785260e872a1787e1eb9ac9a37007c 100644 --- a/interfaces/inner_api/native/BUILD.gn +++ b/interfaces/inner_api/native/BUILD.gn @@ -218,8 +218,15 @@ ohos_shared_library("media_client") { "ipc:ipc_single", "qos_manager:qos", "samgr:samgr_proxy", + "hdf_core:libhdi", ] + if (player_framework_support_lowpower_av_sink) { + external_deps += [ + "drivers_interface_lpplayer:liblow_power_player_proxy_1.0", + ] + } + public_external_deps = [ "graphic_2d:color_manager", "media_foundation:media_foundation", diff --git a/interfaces/inner_api/native/lpp_capability.h b/interfaces/inner_api/native/lpp_capability.h new file mode 100644 index 0000000000000000000000000000000000000000..b78d734de800599555176baa5235494eb6fbe760 --- /dev/null +++ b/interfaces/inner_api/native/lpp_capability.h @@ -0,0 +1,195 @@ +/* + * 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_CAPABILITY_H +#define LPP_CAPABILITY_H + +#include "media_log.h" +#include +#ifdef SUPPORT_LPP_VIDEO_STRAMER +#include "v1_0/ilow_power_player_factory.h" +namespace PlayerHDI = OHOS::HDI::LowPowerPlayer::V1_0; +#endif + +namespace OHOS { +namespace Media { +struct VideoMimeCapIpc : public Parcelable { +public: + std::string mime_ = ""; /** video/avc, video/hevc */ + uint32_t minWidth_ = 0; + uint32_t minHeight_ = 0; + uint32_t maxWidth_ = 0; + uint32_t maxHeight_ = 0; + uint32_t maxPixelPerSecond_ = 0; + uint32_t maxInstance_ = 0; + bool isSupportDRM_ = false; + std::vector supportHDRTypes_ = {}; /** HDR10, HDR10+, HDRVivid */ +#ifdef SUPPORT_LPP_VIDEO_STRAMER + VideoMimeCapIpc(const PlayerHDI::VideoMimeCap &videoMimeCap) + { + mime_ = videoMimeCap.mime; + minWidth_ = videoMimeCap.minWidth; + minHeight_ = videoMimeCap.minHeight; + maxWidth_ = videoMimeCap.maxWidth; + maxHeight_ = videoMimeCap.maxHeight; + maxPixelPerSecond_ = videoMimeCap.maxPixelPerSecond; + maxInstance_ = videoMimeCap.maxInstance; + isSupportDRM_ = videoMimeCap.isSupportDRM; + for (uint32_t i = 0; i < videoMimeCap.supportHDRTypes.size(); i++) { + supportHDRTypes_.push_back(videoMimeCap.supportHDRTypes[i]); + } + } +#endif + + VideoMimeCapIpc() {} + + bool Marshalling(Parcel &parcel) const override + { + parcel.WriteString(mime_); + parcel.WriteUint32(minWidth_); + parcel.WriteUint32(minHeight_); + parcel.WriteUint32(maxWidth_); + parcel.WriteUint32(maxHeight_); + parcel.WriteUint32(maxPixelPerSecond_); + parcel.WriteUint32(maxInstance_); + parcel.WriteBool(isSupportDRM_); + uint32_t typeSize = supportHDRTypes_.size(); + parcel.WriteUint32(typeSize); + for (uint32_t i = 0; i < typeSize; i++) { + parcel.WriteUint32(supportHDRTypes_[i]); + } + return true; + } + + void UnmarshallingSelf(Parcel &parcel) + { + mime_ = parcel.ReadString(); + minWidth_ = parcel.ReadUint32(); + minHeight_ = parcel.ReadUint32(); + maxWidth_ = parcel.ReadUint32(); + maxHeight_ = parcel.ReadUint32(); + maxPixelPerSecond_ = parcel.ReadUint32(); + maxInstance_ = parcel.ReadUint32(); + isSupportDRM_ = parcel.ReadBool(); + uint32_t typeSize = parcel.ReadUint32(); + for (uint32_t i = 0; i < typeSize; i++) { + supportHDRTypes_.push_back(parcel.ReadUint32()); + } + } +}; + +struct AudioMimeCapIpc : public Parcelable { +public: + std::string mime_ = ""; /** AAC, Flac, Vorbis, MPEG, G711mu, AMR(amrnb, amrwb), APE */ + uint32_t sampleRate_ = 0; + uint32_t channelCount_ = 0; +#ifdef SUPPORT_LPP_VIDEO_STRAMER + AudioMimeCapIpc(const PlayerHDI::AudioMimeCap &audioMimeCap) + { + mime_ = audioMimeCap.mime; + sampleRate_ = audioMimeCap.sampleRate; + channelCount_ = audioMimeCap.channelCount; + } +#endif + + AudioMimeCapIpc() {} + + bool Marshalling(Parcel &parcel) const override + { + parcel.WriteString(mime_); + parcel.WriteUint32(sampleRate_); + parcel.WriteUint32(channelCount_); + return true; + } + + void UnmarshallingSelf(Parcel &parcel) + { + mime_ = parcel.ReadString(); + sampleRate_ = parcel.ReadUint32(); + channelCount_ = parcel.ReadUint32(); + } +}; + +struct LppAvCapabilityInfo : public Parcelable { +public: + uint32_t maxInstance_ = 0; + std::vector videoCap_ = {}; /** videoCap */ + std::vector audioCap_ = {}; + + LppAvCapabilityInfo() {} + +#ifdef SUPPORT_LPP_VIDEO_STRAMER + void SetLppAvCapabilityInfo(PlayerHDI::LppAVCap &lppAVCap) + { + maxInstance_ = lppAVCap.maxInstance; + for (uint32_t i = 0; i < lppAVCap.videoCap.size(); i++) { + VideoMimeCapIpc videoMimeCapIpc(lppAVCap.videoCap[i]); + videoCap_.push_back(videoMimeCapIpc); + } + + for (uint32_t i = 0; i < lppAVCap.audioCap.size(); i++) { + AudioMimeCapIpc audioMimeCapIpc(lppAVCap.audioCap[i]); + audioCap_.push_back(audioMimeCapIpc); + } + } +#endif + + bool Marshalling(Parcel &parcel) const override + { + parcel.WriteUint32(maxInstance_); + + parcel.WriteUint32(videoCap_.size()); + for (uint32_t i = 0; i< videoCap_.size(); i++) { + videoCap_[i].Marshalling(parcel); + } + + parcel.WriteUint32(audioCap_.size()); + for (uint32_t i = 0; i< audioCap_.size(); i++) { + audioCap_[i].Marshalling(parcel); + } + return true; + } + + static LppAvCapabilityInfo Unmarshalling(Parcel &parcel) + { + const uint32_t MAX_SIZE = 65535; + LppAvCapabilityInfo info; + info.maxInstance_ = parcel.ReadUint32(); + + uint32_t videoCapSize = parcel.ReadUint32(); + if (videoCapSize > MAX_SIZE) { + return info; + } + for (uint32_t i = 0; i< videoCapSize; i++) { + VideoMimeCapIpc videoCap; + videoCap.UnmarshallingSelf(parcel); + info.videoCap_.push_back(videoCap); + } + + uint32_t audioCapSize = parcel.ReadUint32(); + if (audioCapSize > MAX_SIZE) { + return info; + } + for (uint32_t i = 0; i< audioCapSize; i++) { + AudioMimeCapIpc audioCap; + audioCap.UnmarshallingSelf(parcel); + info.audioCap_.push_back(audioCap); + } + return info; + } +}; +} +} +#endif // LPP_CAPABILITY_H \ No newline at end of file diff --git a/interfaces/inner_api/native/lpp_common.h b/interfaces/inner_api/native/lpp_common.h index 038c61421937621cfd88cf0fdb365497cdb03ccd..bb128aafae14cf685d3abef22b0b8cd1bc36f320 100644 --- a/interfaces/inner_api/native/lpp_common.h +++ b/interfaces/inner_api/native/lpp_common.h @@ -27,7 +27,7 @@ enum LppErrCode : int32_t { LPP_ERROR_OK = 0, LPP_ERROR_UNKONWN, }; - + class LppDataPacket : public OHOS::RefBase { public: diff --git a/interfaces/inner_api/native/lpp_video_streamer.h b/interfaces/inner_api/native/lpp_video_streamer.h index d29cd78a0af5d0f8d9b75b916ae9a0f3c6b6a586..ac6a72fac8370f41c164335d20d6a8948a085b66 100644 --- a/interfaces/inner_api/native/lpp_video_streamer.h +++ b/interfaces/inner_api/native/lpp_video_streamer.h @@ -22,10 +22,9 @@ #include "meta/format.h" #include "lpp_audio_streamer.h" #include "lpp_common.h" - +#include "lpp_capability.h" namespace OHOS { namespace Media { - class VideoStreamerKeys { public: static constexpr std::string_view LPP_CURRENT_POSITION = "current_position"; @@ -113,9 +112,15 @@ public: (void)mime; return nullptr; } + static LppAvCapabilityInfo *GetLppCapacity() + { + return nullptr; + } #else static std::shared_ptr CreateByMime(const std::string &mime); + static LppAvCapabilityInfo *GetLppCapacity(); #endif + private: VideoStreamerFactory() = default; ~VideoStreamerFactory() = default; diff --git a/interfaces/inner_api/native/player_framework.versionscript b/interfaces/inner_api/native/player_framework.versionscript index e6a712c866d3aebed1fa12727f91cfe4334bf52d..7dc3297e6ecc5cddd8ba9c7dbaee15c750864b23 100644 --- a/interfaces/inner_api/native/player_framework.versionscript +++ b/interfaces/inner_api/native/player_framework.versionscript @@ -28,6 +28,8 @@ *OHOS::Media::ScreenCaptureFactory::CreateScreenCaptureMonitor*; *OHOS::Media::ScreenCaptureControllerFactory::CreateScreenCaptureController*; *OHOS::Media::AudioStreamerFactory::CreateByMime*; + *OHOS::Media::VideoStreamerFactory::CreatePlayer*; + *OHOS::Media::VideoStreamerFactory::GetLppCapacity*; *OHOS::Media::VideoStreamerFactory::CreateByMime*; *OHOS::Media::Format::*; *OHOS::Media::VideoCaps::*; diff --git a/interfaces/kits/c/BUILD.gn b/interfaces/kits/c/BUILD.gn index b7a43bf8bc84018f58b435e0a43ccc1773808888..82df840a492a03094758a0d3550560259c48aceb 100644 --- a/interfaces/kits/c/BUILD.gn +++ b/interfaces/kits/c/BUILD.gn @@ -93,6 +93,13 @@ ohos_shared_library("native_avscreen_capture") { "qos_manager:qos", "window_manager:libdm", ] + + if (player_framework_support_lowpower_av_sink) { + external_deps += [ + "drivers_interface_lpplayer:liblow_power_player_proxy_1.0", + ] + } + output_extension = "so" subsystem_name = "multimedia" part_name = "player_framework" @@ -133,6 +140,13 @@ ohos_shared_library("avplayer") { "samgr:samgr_proxy", "window_manager:libdm", ] + + if (player_framework_support_lowpower_av_sink) { + external_deps += [ + "drivers_interface_lpplayer:liblow_power_player_proxy_1.0", + ] + } + if (player_framework_support_drm) { public_external_deps = [ "drm_framework:drm_framework", @@ -187,6 +201,12 @@ ohos_shared_library("avrecorder") { "window_manager:libdm", ] + if (player_framework_support_lowpower_av_sink) { + external_deps += [ + "drivers_interface_lpplayer:liblow_power_player_proxy_1.0", + ] + } + if (player_framework_support_auto_create_file) { external_deps += [ "media_library:media_library", @@ -240,6 +260,12 @@ ohos_shared_library("avimage_generator") { "window_manager:libdm", ] + if (player_framework_support_lowpower_av_sink) { + external_deps += [ + "drivers_interface_lpplayer:liblow_power_player_proxy_1.0", + ] + } + innerapi_tags = [ "ndk" ] output_extension = "so" @@ -287,6 +313,13 @@ ohos_shared_library("avmetadata_extractor") { "samgr:samgr_proxy", "window_manager:libdm", ] + + if (player_framework_support_lowpower_av_sink) { + external_deps += [ + "drivers_interface_lpplayer:liblow_power_player_proxy_1.0", + ] + } + if (player_framework_support_drm) { public_external_deps = [ "drm_framework:drm_framework", @@ -391,6 +424,13 @@ ohos_shared_library("lowpower_avsink") { "image_framework:pixelmap", "hisysevent:libhisysevent", ] + + if (player_framework_support_lowpower_av_sink) { + external_deps += [ + "drivers_interface_lpplayer:liblow_power_player_proxy_1.0", + ] + } + innerapi_tags = [ "ndk" ] output_extension = "so" subsystem_name = "multimedia" diff --git a/interfaces/kits/c/lowpower_audio_sink_base.h b/interfaces/kits/c/lowpower_audio_sink_base.h index 51fea73d22773a9f7e6b537cb68dfecd9c495819..93589ce6f4352ba799f55f401662869b1920743a 100644 --- a/interfaces/kits/c/lowpower_audio_sink_base.h +++ b/interfaces/kits/c/lowpower_audio_sink_base.h @@ -59,7 +59,7 @@ typedef struct OH_LowPowerAudioSink OH_LowPowerAudioSink; * @since 20 */ typedef struct OH_LowPowerAudioSinkCallback OH_LowPowerAudioSinkCallback; - + /** * @brief When an error occurs in the running of the OH_LowPowerAudioSink instance, the function pointer will be called * to report specific error information. diff --git a/interfaces/kits/c/lowpower_avsink_base.h b/interfaces/kits/c/lowpower_avsink_base.h index 27483c91d16ccef0545c5aab0cfa6ce199ac275b..1f5fdeb2efb0621504702cd07ee9bbe4a91a9f9f 100644 --- a/interfaces/kits/c/lowpower_avsink_base.h +++ b/interfaces/kits/c/lowpower_avsink_base.h @@ -52,7 +52,14 @@ extern "C" { * @since 20 */ typedef struct OH_AVSamplesBuffer OH_AVSamplesBuffer; - + +/** + * @brief Forward declaration of OH_LowPowerAVSink_Capability. + * + * @since 21 + */ +typedef struct OH_LowPowerAVSink_Capability OH_LowPowerAVSink_Capability; + /** * @brief Append one OH_AVBuffer data to framePacketBuffer instance. * @@ -76,7 +83,20 @@ OH_AVErrCode OH_AVSamplesBuffer_AppendOneBuffer(OH_AVSamplesBuffer *samplesBuffe * @since 20 */ int32_t OH_AVSamplesBuffer_GetRemainedCapacity(OH_AVSamplesBuffer *samplesBuffer); + +/** + * @brief Query the supported capabilities of a lowpower audio/video sink. + * + * This function queries and returns the capability set supported by the current + * lowpower audio/video sink, including but not limited to supported media formats, etc. + * + * @return {OH_LowPowerAVSink_Capability*} + * - A pointer to the capability structure if the sink supports capability queries and the query is successful. + * - nullptr if the sink does not support capability queries or the query fails. + * @since 21 + */ +OH_LowPowerAVSink_Capability *OH_LowPowerAVSink_GetCapability(); #ifdef __cplusplus } #endif diff --git a/interfaces/kits/c/lowpower_video_sink.h b/interfaces/kits/c/lowpower_video_sink.h index d1c11f7e32cd3594d5f094edd7cb19e1a71e6536..f363d3aa9edbc3adf30fa7e1e84b7f1e3c58237f 100644 --- a/interfaces/kits/c/lowpower_video_sink.h +++ b/interfaces/kits/c/lowpower_video_sink.h @@ -470,7 +470,6 @@ OH_AVErrCode OH_LowPowerVideoSinkCallback_SetFirstFrameDecodedListener( */ OH_AVErrCode OH_LowPowerVideoSinkCallback_SetEosListener(OH_LowPowerVideoSinkCallback* callback, OH_LowPowerVideoSink_OnEos onEos, void* userData); - #ifdef __cplusplus } #endif 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 8b4e6c0e6f1e547f2b8bda87bb9143ce79adf8c7..8278a68c441eac41975fdd09c01c289b6a328018 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 @@ -85,6 +85,7 @@ int32_t HiLppVideoStreamerImpl::Init(const std::string &mime) vdec_ = std::make_shared(streamerId_, isLpp_); bool switchToCommon = false; auto ret = vdec_->Init(mime, switchToCommon); + FALSE_RETURN_V_MSG(switchToCommon == false, AV_ERR_UNSUPPORT, "lpp is not support"); FALSE_RETURN_V_MSG(ret == MSERR_OK, ret, "vdec_ init failed"); FALSE_LOG_MSG_W(!switchToCommon, "switch isLpp_ to false"); isLpp_ = isLpp_ ? !switchToCommon : isLpp_; diff --git a/services/include/i_media_service.h b/services/include/i_media_service.h index 32d7ca0f2de5af5b23c62d43eb2337c4d075b301..0ced80e8c0488a451bebc43894be627ea5285c50 100644 --- a/services/include/i_media_service.h +++ b/services/include/i_media_service.h @@ -234,6 +234,8 @@ public: virtual std::shared_ptr CreateLppVideoStreamerService() = 0; virtual int32_t DestroyLppVideoStreamerService(std::shared_ptr lppVideoPlayer) = 0; + + virtual LppAvCapabilityInfo *GetLppCapacity() = 0; #endif /** diff --git a/services/services/BUILD.gn b/services/services/BUILD.gn index d6de68caabac533607506844fd6de647547b3760..1a318f6de6f0f34f34a6e34ca73ad30d0ea3e596 100644 --- a/services/services/BUILD.gn +++ b/services/services/BUILD.gn @@ -319,7 +319,14 @@ ohos_shared_library("media_service") { "window_manager:session_manager_lite", ] } - + + if (player_framework_support_lowpower_av_sink) { + external_deps += [ + "drivers_interface_lpplayer:liblow_power_player_proxy_1.0", + "hdf_core:libhdi", + ] + } + if (player_framework_support_avsession_background) { sources += [ "player/avsession_background/avsession_background.cpp" ] external_deps += [ 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 beec977287889e4a66edb71ac6b975e5756f3eb0..1544d4297fe45ff017c7fe1320297641a4c77671 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 @@ -102,7 +102,7 @@ public: void OnTargetArrived(const int64_t targetPts, const bool isTimeout) override; void OnFirstFrameReady() override; void OnStreamChanged(Format &format) override; - + private: int32_t CreateStreamerEngine(); bool StateEnter(VideoState targetState, const std::string funcName = ""); diff --git a/services/services/sa_media/client/media_client.cpp b/services/services/sa_media/client/media_client.cpp index 187eaed0587bfbddc630f84899337f818d499e6c..004427c83248cac3ec2a54707576d79e3f680e36 100644 --- a/services/services/sa_media/client/media_client.cpp +++ b/services/services/sa_media/client/media_client.cpp @@ -435,6 +435,16 @@ int32_t MediaClient::DestroyLppAudioStreamerService(std::shared_ptrGetLppCapacity(*lppAvCapabilityInfo); + CHECK_AND_RETURN_RET_LOG(ret == 0, nullptr, "MediaClient::GetLppCapacityfailed"); + return lppAvCapabilityInfo; +} + std::shared_ptr MediaClient::CreateLppVideoStreamerService() { MEDIA_LOGI("CreateLppVideoStreamerService start"); diff --git a/services/services/sa_media/client/media_client.h b/services/services/sa_media/client/media_client.h index 353b31712be54453ff4f26321c648f21a513b0e6..70dfa6b6f92b42a7fbe33af3bb43210c623c1dc3 100644 --- a/services/services/sa_media/client/media_client.h +++ b/services/services/sa_media/client/media_client.h @@ -94,6 +94,7 @@ public: #ifdef SUPPORT_LPP_VIDEO_STRAMER std::shared_ptr CreateLppVideoStreamerService() override; int32_t DestroyLppVideoStreamerService(std::shared_ptr lppAudioPlayer) override; + LppAvCapabilityInfo *GetLppCapacity() override; #endif private: diff --git a/services/services/sa_media/ipc/i_standard_media_service.h b/services/services/sa_media/ipc/i_standard_media_service.h index 80f81713ffedbd98174da4555cf81219c73ab639..f387decaabb5d7eafebeeebad1b7712cfe4b8edf 100644 --- a/services/services/sa_media/ipc/i_standard_media_service.h +++ b/services/services/sa_media/ipc/i_standard_media_service.h @@ -20,6 +20,7 @@ #include "iremote_broker.h" #include "iremote_proxy.h" #include "iremote_stub.h" +#include "lpp_capability.h" #include namespace OHOS { @@ -81,6 +82,8 @@ public: virtual int32_t ResetAllProxy() = 0; + virtual int32_t GetLppCapacity(LppAvCapabilityInfo &lppAvCapability) = 0; + /** * IPC code ID */ @@ -92,6 +95,8 @@ public: GET_PLAYER_PIDS = 4, FREEZE = 5, RESET_ALL_PROXY = 6, + GET_RAMAINED_CAPACITY = 7, + GET_LPP_CAPABILITY = 8, }; DECLARE_INTERFACE_DESCRIPTOR(u"IStandardMediaService"); diff --git a/services/services/sa_media/ipc/media_service_proxy.cpp b/services/services/sa_media/ipc/media_service_proxy.cpp index c91e6ab56a89eb4ab5516fbdd16ca40aa3be3889..595fd4b46a5aab9736bb8c7c003d8ba34c9be7f1 100644 --- a/services/services/sa_media/ipc/media_service_proxy.cpp +++ b/services/services/sa_media/ipc/media_service_proxy.cpp @@ -76,6 +76,24 @@ std::vector MediaServiceProxy::GetPlayerPids() return res; } +int32_t MediaServiceProxy::GetLppCapacity(LppAvCapabilityInfo &lppAvCapability) { + MEDIA_LOGI("MediaServiceProxy::GetLppCapacity"); + MessageParcel data; + MessageParcel reply; + MessageOption option; + int32_t error = -1; + bool token = data.WriteInterfaceToken(MediaServiceProxy::GetDescriptor()); + CHECK_AND_RETURN_RET_LOG(token, error, "Failed to write descriptor!"); + error = Remote()->SendRequest(MediaServiceMsg::GET_LPP_CAPABILITY, data, reply, option); + CHECK_AND_RETURN_RET_LOG(error == MSERR_OK, error, "Failed to SendRequest"); + int32_t ret = reply.ReadInt32(); + CHECK_AND_RETURN_RET_LOG(ret == MSERR_OK, ret, "Fail to MediaServiceProxy::GetLppCapacity"); + lppAvCapability = LppAvCapabilityInfo::Unmarshalling(reply); + MEDIA_LOGI("MediaServiceProxy::GetLppCapacity %{public}zu %{public}zu", + lppAvCapability.videoCap_.size(), lppAvCapability.audioCap_.size()); + return ret; +} + sptr MediaServiceProxy::GetSubSystemAbility(IStandardMediaService::MediaSystemAbility subSystemId, const sptr &listener) { diff --git a/services/services/sa_media/ipc/media_service_proxy.h b/services/services/sa_media/ipc/media_service_proxy.h index 44de1d94a28adbdcfca4b13eb910dc6b22647183..397d1bfd4c743cb14a36536e22072a9cefd93bf1 100644 --- a/services/services/sa_media/ipc/media_service_proxy.h +++ b/services/services/sa_media/ipc/media_service_proxy.h @@ -40,6 +40,7 @@ public: int32_t ResetAllProxy() override; + int32_t GetLppCapacity(LppAvCapabilityInfo &lppAvCapability) override; private: bool IsGetSubSystemAbilityASync() const; static inline BrokerDelegator delegator_; diff --git a/services/services/sa_media/ipc/media_service_stub.cpp b/services/services/sa_media/ipc/media_service_stub.cpp index 0c701f82c79614709cd1a7f621a8d593889124b9..8955b126e6fa7bafd0647db749f785d24a9116da 100644 --- a/services/services/sa_media/ipc/media_service_stub.cpp +++ b/services/services/sa_media/ipc/media_service_stub.cpp @@ -58,6 +58,8 @@ void MediaServiceStub::Init() [this](MessageParcel &data, MessageParcel &reply) { return HandleFreezeStubForPids(data, reply); }; mediaFuncs_[RESET_ALL_PROXY] = [this](MessageParcel &data, MessageParcel &reply) { return HandleResetAllProxy(data, reply); }; + mediaFuncs_[GET_LPP_CAPABILITY] = + [this] (MessageParcel &data, MessageParcel &reply) { return GetLppCapacityStub(data, reply); }; } int32_t MediaServiceStub::HandleFreezeStubForPids(MessageParcel &data, MessageParcel &reply) @@ -199,6 +201,17 @@ int32_t MediaServiceStub::ReleaseClientListenerStub(MessageParcel &data, Message return MSERR_OK; } +int32_t MediaServiceStub::GetLppCapacityStub(MessageParcel &data, MessageParcel &reply) +{ + (void)data; + LppAvCapabilityInfo info; + int32_t ret = GetLppCapacity(info); + CHECK_AND_RETURN_RET_LOG(ret == 0, ret, "Failed to write descriptor!"); + reply.WriteInt32(ret); + info.Marshalling(reply); + return MSERR_OK; +} + int32_t MediaServiceStub::GetPlayerPidsStub(MessageParcel &data, MessageParcel &reply) { (void)data; @@ -222,6 +235,20 @@ std::vector MediaServiceStub::GetPlayerPids() return MediaServerManager::GetInstance().GetPlayerPids(); } +int32_t MediaServiceStub::GetLppCapacity(LppAvCapabilityInfo &lppAvCapability) +{ + MEDIA_LOGI("MediaServiceStub::GetLppCapacity"); + #ifdef SUPPORT_LPP_VIDEO_STRAMER + int32_t ret = MediaServerManager::GetInstance().GetLppCapacity(lppAvCapability); + #else + int32_t ret = MSERR_UNKNOWN; + #endif + MEDIA_LOGI("MediaServiceStub::GetLppCapacity %{public}lu %{public}lu", + lppAvCapability.videoCap_.size(), lppAvCapability.audioCap_.size()); + CHECK_AND_RETURN_RET_LOG(ret == 0, MSERR_UNKNOWN, "MediaServiceStub::GetLppCapacity GetLppCapacity"); + return ret; +} + int32_t MediaServiceStub::GetSystemAbility(MessageParcel &data, MessageParcel &reply) { int32_t mediaSystemAbility = data.ReadInt32(); diff --git a/services/services/sa_media/ipc/media_service_stub.h b/services/services/sa_media/ipc/media_service_stub.h index 7c4f836a229f317b8796b0ad8d65baf0f992bca0..aea49f3a8c491bb8f439f144bdb360285990b48c 100644 --- a/services/services/sa_media/ipc/media_service_stub.h +++ b/services/services/sa_media/ipc/media_service_stub.h @@ -44,6 +44,8 @@ private: int32_t GetPlayerPidsStub(MessageParcel &data, MessageParcel &reply); void ReleaseClientListener() override; std::vector GetPlayerPids() override; + int32_t GetLppCapacity(LppAvCapabilityInfo &lppAvCapability) override; + int32_t GetLppCapacityStub(MessageParcel &data, MessageParcel &reply); int32_t HandleFreezeStubForPids(MessageParcel &data, MessageParcel &reply); int32_t HandleResetAllProxy(MessageParcel &data, MessageParcel &reply); void ClientDied(pid_t pid); diff --git a/services/services/sa_media/server_manager/media_server_manager.cpp b/services/services/sa_media/server_manager/media_server_manager.cpp index 4069d5b428251f6802895a5eedc2a15694a252b5..417c8fc95f0017af88f1237f38c4eeaebb0ac0f2 100644 --- a/services/services/sa_media/server_manager/media_server_manager.cpp +++ b/services/services/sa_media/server_manager/media_server_manager.cpp @@ -50,6 +50,10 @@ #include "player_xcollie.h" #include "client/memory_collector_client.h" #include +#ifdef SUPPORT_LPP_VIDEO_STRAMER +#include "v1_0/ilow_power_player_factory.h" +namespace PlayerHDI = OHOS::HDI::LowPowerPlayer::V1_0; +#endif namespace { constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, LOG_DOMAIN_PLAYER, "MediaServerManager"}; @@ -550,6 +554,18 @@ sptr MediaServerManager::CreateLppAudioPlayerStubObject() #endif #ifdef SUPPORT_LPP_VIDEO_STRAMER +int32_t MediaServerManager::GetLppCapacity(LppAvCapabilityInfo &lppAvCapability) { + auto factory = PlayerHDI::ILowPowerPlayerFactory::Get(true); + CHECK_AND_RETURN_RET_LOG(factory != nullptr, UNKNOWN_ERROR, "MediaServerManager::GetLppCapacity is failed"); + PlayerHDI::LppAVCap lppAVCap; + int32_t ret = factory->GetAVCapability(lppAVCap); + MEDIA_LOGI("MediaServerManager::GetLppCapacity %{public}lu %{public}lu", + lppAVCap.videoCap.size(), lppAVCap.audioCap.size()); + CHECK_AND_RETURN_RET_LOG(ret == 0, ret, "FAILED MediaServerManager::GetLppCapacity"); + lppAvCapability.SetLppAvCapabilityInfo(lppAVCap); + return ret; +} + sptr MediaServerManager::CreateLppVideoPlayerStubObject() { MEDIA_LOGI("CreateLppVideoPlayerStubObject start"); diff --git a/services/services/sa_media/server_manager/media_server_manager.h b/services/services/sa_media/server_manager/media_server_manager.h index 8b858652abceec454c6e715201f52c32b8c9c08c..e2fbc193108f6b5f6066deb1ea68f1da08842fe1 100644 --- a/services/services/sa_media/server_manager/media_server_manager.h +++ b/services/services/sa_media/server_manager/media_server_manager.h @@ -25,10 +25,11 @@ #include "nocopyable.h" #include "osal/task/task.h" #include - +#include "lpp_capability.h" namespace OHOS { namespace Media { using DumperEntry = std::function; + struct Dumper { pid_t pid_; pid_t uid_; @@ -79,6 +80,10 @@ public: #endif bool CanKillMediaService(); std::vector GetPlayerPids(); +#ifdef SUPPORT_LPP_VIDEO_STRAMER + int32_t GetLppCapacity(LppAvCapabilityInfo &lppAvCapability); +#endif + private: MediaServerManager(); #ifdef SUPPORT_PLAYER diff --git a/test/BUILD.gn b/test/BUILD.gn index 4585469a553b4b8eeac217ba465f1694c5598883..dacc54a9089daa5194c8c9e5b45e75f9c3db8f5b 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -125,7 +125,5 @@ group("media_unit_test") { group("media_fuzz_test") { testonly = true deps = [] - if (player_framework_support_test) { deps += [ "fuzztest:fuzztest" ] - } } diff --git a/test/fuzztest/avmetadata_fuzztest/avmetadatahelper_fuzzer/BUILD.gn b/test/fuzztest/avmetadata_fuzztest/avmetadatahelper_fuzzer/BUILD.gn index cd4357fc312bb6872c2dfcbab0efc79eaaf372e7..0b192e0f099514beb82cc1b01455825e73b139ac 100644 --- a/test/fuzztest/avmetadata_fuzztest/avmetadatahelper_fuzzer/BUILD.gn +++ b/test/fuzztest/avmetadata_fuzztest/avmetadatahelper_fuzzer/BUILD.gn @@ -52,4 +52,10 @@ ohos_fuzztest("AVmetadataHelperFuzzTest") { "safwk:system_ability_fwk", "samgr:samgr_proxy", ] + + if (player_framework_support_lowpower_av_sink) { + external_deps += [ + "drivers_interface_lpplayer:liblow_power_player_proxy_1.0", + ] + } } diff --git a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/BUILD.gn b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/BUILD.gn index c10fb043fce65fb3d63051a03f1966bc5af1645d..a13ed5c15d251f7596daaa958221485bd1cdb491 100644 --- a/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/BUILD.gn +++ b/test/fuzztest/avmetadata_fuzztest/avmetadatahelperdatasrc_fuzzer/BUILD.gn @@ -62,4 +62,16 @@ ohos_fuzztest("AVmetadataHelperDataSrcFuzzTest") { "safwk:system_ability_fwk", "samgr:samgr_proxy", ] + + if (player_framework_support_lowpower_av_sink) { + external_deps += [ + "drivers_interface_lpplayer:liblow_power_player_proxy_1.0", + ] + } + + if (player_framework_support_lowpower_av_sink) { + external_deps += [ + "drivers_interface_lpplayer:liblow_power_player_proxy_1.0", + ] + } } diff --git a/test/fuzztest/avmetadata_fuzztest/avmetadatastub_fuzzer/BUILD.gn b/test/fuzztest/avmetadata_fuzztest/avmetadatastub_fuzzer/BUILD.gn index e9cc035a609400b42e43cf127544edb7da93cb35..792000b20d6748f9951d464db840095f1dcda490 100644 --- a/test/fuzztest/avmetadata_fuzztest/avmetadatastub_fuzzer/BUILD.gn +++ b/test/fuzztest/avmetadata_fuzztest/avmetadatastub_fuzzer/BUILD.gn @@ -72,4 +72,10 @@ ohos_fuzztest("AVmetadataStubFuzzTest") { "safwk:system_ability_fwk", "samgr:samgr_proxy", ] + + if (player_framework_support_lowpower_av_sink) { + external_deps += [ + "drivers_interface_lpplayer:liblow_power_player_proxy_1.0", + ] + } } diff --git a/test/fuzztest/avmetadata_fuzztest/avmetadatastublocal_fuzzer/BUILD.gn b/test/fuzztest/avmetadata_fuzztest/avmetadatastublocal_fuzzer/BUILD.gn index 75f52dfe9ade219f8925f534231f6abc5290e3ef..5b51b160367f7b4e01ee46a7fd3b028179dbd545 100644 --- a/test/fuzztest/avmetadata_fuzztest/avmetadatastublocal_fuzzer/BUILD.gn +++ b/test/fuzztest/avmetadata_fuzztest/avmetadatastublocal_fuzzer/BUILD.gn @@ -72,4 +72,10 @@ ohos_fuzztest("AVmetadataStubLocalFuzzTest") { "safwk:system_ability_fwk", "samgr:samgr_proxy", ] + + if (player_framework_support_lowpower_av_sink) { + external_deps += [ + "drivers_interface_lpplayer:liblow_power_player_proxy_1.0", + ] + } } diff --git a/test/fuzztest/common/stub_common.cpp b/test/fuzztest/common/stub_common.cpp index dbe61db7907a77d1c59d1f6b789fda8edccc1afa..9d37ef03e3e0ad03cdfd639317d0a4bb0a1826ea 100644 --- a/test/fuzztest/common/stub_common.cpp +++ b/test/fuzztest/common/stub_common.cpp @@ -84,5 +84,11 @@ int32_t MediaServiceProxyFuzzer::ResetAllProxy() { return 0; } + +int32_t MediaServiceProxyFuzzer::GetLppCapacity(LppAvCapabilityInfo &lppAvCapability) +{ + (void)lppAvCapability; + return 0; +} } } \ No newline at end of file diff --git a/test/fuzztest/common/stub_common.h b/test/fuzztest/common/stub_common.h index d4d0d84653c5f64fbcb4329b8ee8283162c8f70f..fbec84cc6722f15fca4874594c6cc9add38d1cf6 100644 --- a/test/fuzztest/common/stub_common.h +++ b/test/fuzztest/common/stub_common.h @@ -42,6 +42,7 @@ public: std::vector GetPlayerPids(); int32_t FreezeStubForPids(const std::set &pidList, bool isProxy); int32_t ResetAllProxy(); + int32_t GetLppCapacity(LppAvCapabilityInfo &lppAvCapability); private: static inline BrokerDelegator delegator_; }; diff --git a/test/fuzztest/lowpoweravsink_fuzztest/lowpoweraudiosink_fuzzer/BUILD.gn b/test/fuzztest/lowpoweravsink_fuzztest/lowpoweraudiosink_fuzzer/BUILD.gn index a8863abb1d3ee004dc96bee2d33f23e5e7157899..fa3dfd604bec802371b23029d05bc469309e296c 100644 --- a/test/fuzztest/lowpoweravsink_fuzztest/lowpoweraudiosink_fuzzer/BUILD.gn +++ b/test/fuzztest/lowpoweravsink_fuzztest/lowpoweraudiosink_fuzzer/BUILD.gn @@ -88,4 +88,4 @@ ohos_fuzztest("LowPowerAudioSinkFuzzTest") { "safwk:system_ability_fwk", "samgr:samgr_proxy", ] -} \ No newline at end of file +} diff --git a/test/fuzztest/lowpoweravsink_fuzztest/lowpowervideosink_fuzzer/BUILD.gn b/test/fuzztest/lowpoweravsink_fuzztest/lowpowervideosink_fuzzer/BUILD.gn index 1ad5771ba5740d3fe014c02ed7b132960db40fe7..2ae17be785d456b0a51a3ea545e08d2f1f4a2f71 100644 --- a/test/fuzztest/lowpoweravsink_fuzztest/lowpowervideosink_fuzzer/BUILD.gn +++ b/test/fuzztest/lowpoweravsink_fuzztest/lowpowervideosink_fuzzer/BUILD.gn @@ -87,4 +87,4 @@ ohos_fuzztest("LowPowerVideoSinkFuzzTest") { "safwk:system_ability_fwk", "samgr:samgr_proxy", ] -} \ No newline at end of file +} diff --git a/test/fuzztest/player_fuzztest/playerdatasrc_fuzzer/BUILD.gn b/test/fuzztest/player_fuzztest/playerdatasrc_fuzzer/BUILD.gn index 679781a6f03964397918be7602a6d21401681ed1..6e7cd655603e5af197bc0acacab22102545de04b 100644 --- a/test/fuzztest/player_fuzztest/playerdatasrc_fuzzer/BUILD.gn +++ b/test/fuzztest/player_fuzztest/playerdatasrc_fuzzer/BUILD.gn @@ -86,4 +86,10 @@ ohos_fuzztest("PlayerDataSrcFuzzTest") { "safwk:system_ability_fwk", "samgr:samgr_proxy", ] + + if (player_framework_support_lowpower_av_sink) { + external_deps += [ + "drivers_interface_lpplayer:liblow_power_player_proxy_1.0", + ] + } } diff --git a/test/fuzztest/player_fuzztest/playermp4_fuzzer/BUILD.gn b/test/fuzztest/player_fuzztest/playermp4_fuzzer/BUILD.gn index 7af6a73db52ef33a6c5a788625488f31be26dafa..57250f252375c25ff4d3e96ea209596313a70606 100644 --- a/test/fuzztest/player_fuzztest/playermp4_fuzzer/BUILD.gn +++ b/test/fuzztest/player_fuzztest/playermp4_fuzzer/BUILD.gn @@ -72,4 +72,10 @@ ohos_fuzztest("PlayerMp4FuzzTest") { "safwk:system_ability_fwk", "samgr:samgr_proxy", ] + + if (player_framework_support_lowpower_av_sink) { + external_deps += [ + "drivers_interface_lpplayer:liblow_power_player_proxy_1.0", + ] + } } diff --git a/test/fuzztest/player_fuzztest/playersei_fuzzer/BUILD.gn b/test/fuzztest/player_fuzztest/playersei_fuzzer/BUILD.gn index 92bfc0496904ac95866ed94dfe7e3c339cf1c9f8..5beb67f810809f75cb1414874a2d60aee6fd8e95 100644 --- a/test/fuzztest/player_fuzztest/playersei_fuzzer/BUILD.gn +++ b/test/fuzztest/player_fuzztest/playersei_fuzzer/BUILD.gn @@ -88,4 +88,10 @@ ohos_fuzztest("PlayerSeiFuzzTest") { "safwk:system_ability_fwk", "samgr:samgr_proxy", ] + + if (player_framework_support_lowpower_av_sink) { + external_deps += [ + "drivers_interface_lpplayer:liblow_power_player_proxy_1.0", + ] + } } diff --git a/test/fuzztest/player_fuzztest/playerservicestub_fuzzer/BUILD.gn b/test/fuzztest/player_fuzztest/playerservicestub_fuzzer/BUILD.gn index 3f5c3455af3b2e2e1f1843cda7e5fc25bebce68f..842919407d70e485abcb899a90c2091578f71adb 100644 --- a/test/fuzztest/player_fuzztest/playerservicestub_fuzzer/BUILD.gn +++ b/test/fuzztest/player_fuzztest/playerservicestub_fuzzer/BUILD.gn @@ -65,4 +65,10 @@ ohos_fuzztest("PlayerServiceStubFuzzTest") { "safwk:system_ability_fwk", "samgr:samgr_proxy", ] + + if (player_framework_support_lowpower_av_sink) { + external_deps += [ + "drivers_interface_lpplayer:liblow_power_player_proxy_1.0", + ] + } } diff --git a/test/fuzztest/player_fuzztest/playerservicestub_fuzzer/playerservicestub_fuzzer.cpp b/test/fuzztest/player_fuzztest/playerservicestub_fuzzer/playerservicestub_fuzzer.cpp index 5375ce0fc7459888c0539e6819a47685ab7bdbd3..2adbafc081346fc1b7c62defd29d5958e295d34e 100644 --- a/test/fuzztest/player_fuzztest/playerservicestub_fuzzer/playerservicestub_fuzzer.cpp +++ b/test/fuzztest/player_fuzztest/playerservicestub_fuzzer/playerservicestub_fuzzer.cpp @@ -100,6 +100,11 @@ public: return 0; } + int32_t GetLppCapacity(LppAvCapabilityInfo &lppAvCapability) + { + (void)lppAvCapability; + return 0; + } private: static inline BrokerDelegator delegator_; }; diff --git a/test/fuzztest/player_fuzztest/playerstub_fuzzer/BUILD.gn b/test/fuzztest/player_fuzztest/playerstub_fuzzer/BUILD.gn index 7f2a5f8751c0db09f4474968ffc11329e604c773..9f5d404e66d1613c2e2ff8d4b364c266ae8a7c78 100644 --- a/test/fuzztest/player_fuzztest/playerstub_fuzzer/BUILD.gn +++ b/test/fuzztest/player_fuzztest/playerstub_fuzzer/BUILD.gn @@ -72,4 +72,10 @@ ohos_fuzztest("PlayerStubFuzzTest") { "safwk:system_ability_fwk", "samgr:samgr_proxy", ] + + if (player_framework_support_lowpower_av_sink) { + external_deps += [ + "drivers_interface_lpplayer:liblow_power_player_proxy_1.0", + ] + } } diff --git a/test/fuzztest/screen_capture_fuzztest/screencaptureservicestub_fuzzer/BUILD.gn b/test/fuzztest/screen_capture_fuzztest/screencaptureservicestub_fuzzer/BUILD.gn index 6259df1973b6e311a15e30f358f5dd3ea23d1c0e..2a09ec0dcc296d90d162ede76f7e58a6dd604251 100644 --- a/test/fuzztest/screen_capture_fuzztest/screencaptureservicestub_fuzzer/BUILD.gn +++ b/test/fuzztest/screen_capture_fuzztest/screencaptureservicestub_fuzzer/BUILD.gn @@ -78,5 +78,11 @@ ohos_fuzztest("ScreenCaptureServiceStubFuzzTest") { "samgr:samgr_proxy", ] + if (player_framework_support_lowpower_av_sink) { + external_deps += [ + "drivers_interface_lpplayer:liblow_power_player_proxy_1.0", + ] + } + part_name = "player_framework" } diff --git a/test/unittest/avmetadatahelper_test/BUILD.gn b/test/unittest/avmetadatahelper_test/BUILD.gn index fc9a6f0b21c9d2b2fb2c0735fbb996510c055172..fa8d2d30b0e9f33bdec605a7e3766f4cf69b0f87 100644 --- a/test/unittest/avmetadatahelper_test/BUILD.gn +++ b/test/unittest/avmetadatahelper_test/BUILD.gn @@ -176,6 +176,12 @@ ohos_unittest("avmetadatahelper_unit_test") { "samgr:samgr_proxy", "window_manager:libwm", ] + + if (player_framework_support_lowpower_av_sink) { + external_deps += [ + "drivers_interface_lpplayer:liblow_power_player_proxy_1.0", + ] + } if (player_framework_support_video) { external_deps += [ "graphic_surface:surface" ] diff --git a/test/unittest/avmetadatahelper_test/avmetadatahelper_impl_unit_test.cpp b/test/unittest/avmetadatahelper_test/avmetadatahelper_impl_unit_test.cpp index 76787eda0a11a5db67bf41b34544f9a4b7d987cf..e69611bca9c593bfb5ad33710a1ed6ca07b38d6c 100644 --- a/test/unittest/avmetadatahelper_test/avmetadatahelper_impl_unit_test.cpp +++ b/test/unittest/avmetadatahelper_test/avmetadatahelper_impl_unit_test.cpp @@ -114,6 +114,12 @@ int32_t MediaClient::ResetAllProxy() return 0; } +LppAvCapabilityInfo* MediaClient::GetLppCapacity() +{ + LppAvCapabilityInfo *lppAvCapabilityInfo = new LppAvCapabilityInfo(); + return lppAvCapabilityInfo; +} + namespace Test { void AVMetadtahelperImplUnitTest::SetUpTestCase(void) {} diff --git a/test/unittest/lpp_unit_test/inner/lpp_video_streamer_unit_test/BUILD.gn b/test/unittest/lpp_unit_test/inner/lpp_video_streamer_unit_test/BUILD.gn index 172487a433b3d4e953b47bac304d10ef7063147b..efbb140f1d1d75b86ff1fed7971e33fbc9707fb9 100644 --- a/test/unittest/lpp_unit_test/inner/lpp_video_streamer_unit_test/BUILD.gn +++ b/test/unittest/lpp_unit_test/inner/lpp_video_streamer_unit_test/BUILD.gn @@ -1,53 +1,53 @@ -# 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. - -import("//build/test.gni") -import("//foundation/multimedia/player_framework/config.gni") - -module_output_path = "player_framework/lpp_unit_test" - -ohos_unittest("lpp_video_streamer_unit_test") { - module_out_path = module_output_path - include_dirs = [ - "./include", - "$MEDIA_PLAYER_ROOT_DIR/interfaces/inner_api/native", - "$MEDIA_PLAYER_ROOT_DIR/frameworks/native/lpp_video_streamer", - "$MEDIA_PLAYER_ROOT_DIR/test/unittest/common/include", - ] - - cflags = [ - "-Wall", - "-Werror", - "-Wno-deprecated-declarations", - ] - - sources = [] - - if (player_framework_support_lowpower_av_sink) { - sources += [ - "lpp_video_streamer_unit_test.cpp", - ] - } - - deps = [ "$MEDIA_PLAYER_ROOT_DIR/interfaces/inner_api/native:media_client" ] - - external_deps = [ - "av_codec:av_codec_client", - "c_utils:utils", - "hilog:libhilog", - "media_foundation:media_foundation" - ] - - resource_config_file = - "$MEDIA_PLAYER_ROOT_DIR/test/unittest/resources/ohos_test.xml" -} \ No newline at end of file +# 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. + +import("//build/test.gni") +import("//foundation/multimedia/player_framework/config.gni") + +module_output_path = "player_framework/lpp_unit_test" + +ohos_unittest("lpp_video_streamer_unit_test") { + module_out_path = module_output_path + include_dirs = [ + "./include", + "$MEDIA_PLAYER_ROOT_DIR/interfaces/inner_api/native", + "$MEDIA_PLAYER_ROOT_DIR/frameworks/native/lpp_video_streamer", + "$MEDIA_PLAYER_ROOT_DIR/test/unittest/common/include", + ] + + cflags = [ + "-Wall", + "-Werror", + "-Wno-deprecated-declarations", + ] + + sources = [] + + if (player_framework_support_lowpower_av_sink) { + sources += [ + "lpp_video_streamer_unit_test.cpp", + ] + } + + deps = [ "$MEDIA_PLAYER_ROOT_DIR/interfaces/inner_api/native:media_client" ] + + external_deps = [ + "av_codec:av_codec_client", + "c_utils:utils", + "hilog:libhilog", + "media_foundation:media_foundation" + ] + + resource_config_file = + "$MEDIA_PLAYER_ROOT_DIR/test/unittest/resources/ohos_test.xml" +} diff --git a/test/unittest/media_server_manager_test/BUILD.gn b/test/unittest/media_server_manager_test/BUILD.gn index 833753a607617c34fe816659f85e7fad56b17df1..cc4174ef835e6eba0c120c026605178c6b7994da 100644 --- a/test/unittest/media_server_manager_test/BUILD.gn +++ b/test/unittest/media_server_manager_test/BUILD.gn @@ -125,6 +125,12 @@ ohos_unittest("media_server_manager_test") { "samgr:samgr_proxy", ] + if (player_framework_support_lowpower_av_sink) { + external_deps += [ + "drivers_interface_lpplayer:liblow_power_player_proxy_1.0", + ] + } + if (player_framework_support_video) { external_deps += [ "graphic_surface:surface" ] } diff --git a/test/unittest/media_service_helper_test/BUILD.gn b/test/unittest/media_service_helper_test/BUILD.gn index 292d283805c6c3b36d6f04ce28c3b41c2e05ce8c..fd91a2a29e581859fbf3f9d0777b7eaddd89e481 100644 --- a/test/unittest/media_service_helper_test/BUILD.gn +++ b/test/unittest/media_service_helper_test/BUILD.gn @@ -67,6 +67,12 @@ ohos_unittest("media_service_helper_unit_test") { "ipc:ipc_single", ] + if (player_framework_support_lowpower_av_sink) { + external_deps += [ + "drivers_interface_lpplayer:liblow_power_player_proxy_1.0", + ] + } + if (defined(global_parts_info) && defined(global_parts_info.multimedia_histreamer_ext)) { defines = [ "SUBSCRIBE_HISTREAMER_EXT" ] diff --git a/test/unittest/player_service_stub_test/BUILD.gn b/test/unittest/player_service_stub_test/BUILD.gn index bd09388115fdcdb13593f192de3e4d44dd648715..374bb34699e8383ec8d4fc43db89ebd0c14f5d16 100644 --- a/test/unittest/player_service_stub_test/BUILD.gn +++ b/test/unittest/player_service_stub_test/BUILD.gn @@ -117,6 +117,12 @@ ohos_unittest("player_service_stub_test") { external_deps += [ "graphic_surface:surface" ] } + if (player_framework_support_lowpower_av_sink) { + external_deps += [ + "drivers_interface_lpplayer:liblow_power_player_proxy_1.0", + ] + } + if (player_framework_support_screen_capture_stopbycall) { external_deps += [ "call_manager:tel_call_manager_api", diff --git a/test/unittest/sa_media_client_unit_test/BUILD.gn b/test/unittest/sa_media_client_unit_test/BUILD.gn index bf3e2f935f1de8ff302bb6e0a4077e915f7aa0e7..0e4005ff1f773539b705f5ebdbc2828406acca06 100644 --- a/test/unittest/sa_media_client_unit_test/BUILD.gn +++ b/test/unittest/sa_media_client_unit_test/BUILD.gn @@ -146,6 +146,12 @@ include_dirs = [ "$MEDIA_PLAYER_ROOT_DIR/services/services:media_service", "$MEDIA_PLAYER_ROOT_DIR/services/utils:media_service_utils", ] + + if (player_framework_support_lowpower_av_sink) { + external_deps += [ + "drivers_interface_lpplayer:liblow_power_player_proxy_1.0", + ] + } resource_config_file = "$MEDIA_PLAYER_ROOT_DIR/test/unittest/resources/ohos_test.xml" diff --git a/test/unittest/timeout_test/BUILD.gn b/test/unittest/timeout_test/BUILD.gn index 33812ec070373053dbb289544472ed43c1c28f56..272035ee18e5df500665d658af7168a433ccb42e 100644 --- a/test/unittest/timeout_test/BUILD.gn +++ b/test/unittest/timeout_test/BUILD.gn @@ -76,6 +76,12 @@ ohos_unittest("player_timeout_unit_test") { "window_manager:libwm", ] + if (player_framework_support_lowpower_av_sink) { + external_deps += [ + "drivers_interface_lpplayer:liblow_power_player_proxy_1.0", + ] + } + if (defined(global_parts_info) && defined(global_parts_info.multimedia_histreamer_ext)) { defines = [ "SUBSCRIBE_HISTREAMER_EXT" ] diff --git a/test/unittest/timeout_test/mock/mock_i_media_service.h b/test/unittest/timeout_test/mock/mock_i_media_service.h index 8c063f036fd43313d04fa7e801c2256782f38b0c..20d2af6aa59667e6ec8f41110292d7530f92cbd8 100644 --- a/test/unittest/timeout_test/mock/mock_i_media_service.h +++ b/test/unittest/timeout_test/mock/mock_i_media_service.h @@ -71,6 +71,7 @@ public: MOCK_METHOD(std::shared_ptr, CreateLppVideoStreamerService, (), (override)); MOCK_METHOD(int32_t, DestroyLppVideoStreamerService, (std::shared_ptr lppAudioPlayer), (override)); + MOCK_METHOD(LppAvCapabilityInfo*, GetLppCapacity, (), (override)); #endif MOCK_METHOD(sptr, GetMonitorProxy, (), (override));