From 9dd742cbe687ee60ea8879c190fd5db2e947e8c4 Mon Sep 17 00:00:00 2001 From: huangtianyu Date: Tue, 12 Aug 2025 10:00:35 +0000 Subject: [PATCH] fixLppUT Signed-off-by: huangtianyu --- frameworks/native/common/lpp_common.cpp | 3 ++- .../lpp_audio_streamer/ipc/lpp_audio_streamer_service_stub.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/frameworks/native/common/lpp_common.cpp b/frameworks/native/common/lpp_common.cpp index ff4d60ef7..192ab8dc0 100644 --- a/frameworks/native/common/lpp_common.cpp +++ b/frameworks/native/common/lpp_common.cpp @@ -174,6 +174,7 @@ bool LppDataPacket::WriteToByteBuffer(std::shared_ptr &avBuffer) avBuffer->memory_->SetSize(offset); CHECK_AND_RETURN_RET_LOG(frameCount_ > 0, false, "LppDataPacket isEmpty.."); uint8_t *buffer = avBuffer->memory_->GetAddr(); + CHECK_AND_RETURN_RET_LOG(avBuffer->memory_->GetCapacity() >= sizeof(uint32_t), false, "not enough capacity"); int32_t ret = memcpy_s(buffer, sizeof(uint32_t), &frameCount_, sizeof(uint32_t)); CHECK_AND_RETURN_RET_LOG(ret == 0, false, "memcopy error"); avBuffer->flag_ |= MediaAVCodec::AVCODEC_BUFFER_FLAG_MUL_FRAME; @@ -310,7 +311,7 @@ void LppDataPacket::DumpAVBufferToFile( } size_t ret = fwrite(reinterpret_cast(buffer->memory_->GetAddr()), DUMP_DATA_UNIT, bufferSize, dumpFile); - if (ret < 0) { + if (ret != bufferSize) { MEDIA_LOG_W("dump is fail."); } std::fclose(dumpFile); diff --git a/services/services/lpp_audio_streamer/ipc/lpp_audio_streamer_service_stub.cpp b/services/services/lpp_audio_streamer/ipc/lpp_audio_streamer_service_stub.cpp index 3bc61d623..09c830e45 100644 --- a/services/services/lpp_audio_streamer/ipc/lpp_audio_streamer_service_stub.cpp +++ b/services/services/lpp_audio_streamer/ipc/lpp_audio_streamer_service_stub.cpp @@ -416,7 +416,7 @@ int32_t LppAudioStreamerServiceStub::SetLppVideoStreamerId(MessageParcel &data, std::string LppAudioStreamerServiceStub::GetStreamerId() { - MEDIA_LOGD("GetStreamerId"); + CHECK_AND_RETURN_RET_LOG(lppAudioPlayerServer_ != nullptr, "", "player server is nullptr"); return lppAudioPlayerServer_->GetStreamerId(); } -- Gitee