diff --git a/frameworks/native/common/lpp_common.cpp b/frameworks/native/common/lpp_common.cpp index ff4d60ef77cb71b442afb453c2313db6c15874da..192ab8dc08f37bcc4fed9787070790b0a474d0d4 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 3bc61d623bb2e03cb20908f638891ad54e20e907..09c830e450953477c9e9e2d04f9d5ecd3a393f2c 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(); }