From f14ed9bae08263dc205863f43461f3fa1edf83e0 Mon Sep 17 00:00:00 2001 From: zhanghongran Date: Mon, 22 May 2023 13:54:45 +0000 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9fcodec=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96=E6=89=93=E5=8D=B0=E7=B1=BB=E5=9E=8B=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhanghongran --- services/engine/codec/video/fcodec.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/services/engine/codec/video/fcodec.cpp b/services/engine/codec/video/fcodec.cpp index 8be273ec0..3cb94b882 100644 --- a/services/engine/codec/video/fcodec.cpp +++ b/services/engine/codec/video/fcodec.cpp @@ -105,7 +105,7 @@ void FCodec::ConfigureDefaultVal(const Format &format, const std::string_view &f if (format.GetIntValue(formatKey, val32) && val32 > minVal && val32 < maxVal) { format_.PutIntValue(formatKey, val32); } else { - AVCODEC_LOGW("Set parameter failed: %{public}.*s, which minimum threshold=%{public}d, " + AVCODEC_LOGW("Set parameter failed: size: %{public}zu %{public}s, which minimum threshold=%{public}d, " "maximum threshold=%{public}d", formatKey.size(), formatKey.data(), minVal, maxVal); format_.PutIntValue(formatKey, defaultVal); @@ -567,10 +567,10 @@ std::shared_ptr FCodec::GetInputBuffer(uint32_t index) AVCODEC_SYNC_TRACE; CHECK_AND_RETURN_RET_LOG(IsActive(), nullptr, "Get input buffer failed: not in Running or Flushed state"); std::vector> &avBuffers = buffers_[INDEX_INPUT]; - CHECK_AND_RETURN_RET_LOG(index < avBuffers.size(), nullptr, "Get buffer failed with bad index, index=%{public}zu", + CHECK_AND_RETURN_RET_LOG(index < avBuffers.size(), nullptr, "Get buffer failed with bad index, index=%{public}u", index); CHECK_AND_RETURN_RET_LOG(avBuffers[index]->owner_ == AVBuffer::OWNED_BY_USER, nullptr, - "Get buffer failed with index=%{public}zu, buffer is not available", index); + "Get buffer failed with index=%{public}u, buffer is not available", index); std::shared_lock iLock(inputMutex_); return std::static_pointer_cast(avBuffers[index]->memory_); } @@ -582,10 +582,10 @@ std::shared_ptr FCodec::GetOutputBuffer(uint32_t index) "Get output buffer failed: not in Running/Flushed/EOS state"); CHECK_AND_RETURN_RET_LOG(surface_ == nullptr, nullptr, "Get output buffer failed: surface output"); std::vector> &avBuffers = buffers_[INDEX_OUTPUT]; - CHECK_AND_RETURN_RET_LOG(index < avBuffers.size(), nullptr, "Get buffer failed with bad index, index=%{public}zu", + CHECK_AND_RETURN_RET_LOG(index < avBuffers.size(), nullptr, "Get buffer failed with bad index, index=%{public}u", index); CHECK_AND_RETURN_RET_LOG(avBuffers[index]->owner_ == AVBuffer::OWNED_BY_USER, nullptr, - "Get buffer failed with index=%{public}zu, buffer is not available", index); + "Get buffer failed with index=%{public}u, buffer is not available", index); std::unique_lock oLock(outputMutex_); return std::static_pointer_cast(avBuffers[index]->memory_); @@ -598,10 +598,10 @@ int32_t FCodec::QueueInputBuffer(uint32_t index, const AVCodecBufferInfo &info, "Queue input buffer failed: not in Running or Flushed state"); std::vector> &inBuffers = buffers_[INDEX_INPUT]; CHECK_AND_RETURN_RET_LOG(index < inBuffers.size(), AVCS_ERR_INVALID_VAL, - "Queue input buffer failed with bad index, index=%{public}zu, buffer_size=%{public}zu", + "Queue input buffer failed with bad index, index=%{public}u, buffer_size=%{public}zu", index, inBuffers.size()); CHECK_AND_RETURN_RET_LOG(inBuffers[index]->owner_ == AVBuffer::OWNED_BY_USER, AVCS_ERR_INVALID_OPERATION, - "Queue input buffer failed: buffer with index=%{public}zu is not available", index); + "Queue input buffer failed: buffer with index=%{public}u is not available", index); std::unique_lock iLock(inputMutex_); inBufQue_.emplace_back(index); inBuffers[index]->owner_ = AVBuffer::OWNED_BY_CODEC; @@ -823,7 +823,7 @@ void FCodec::RenderFrame() if (surfaceMemory->GetSurfaceBuffer() == nullptr) { std::this_thread::sleep_for(std::chrono::milliseconds(DEFAULT_TRY_DECODE_TIME)); } else { - AVCODEC_LOGD("render frame success, index=%{public}zu", index); + AVCODEC_LOGD("render frame success, index=%{public}u", index); std::lock_guard oLock(outputMutex_); codecAvailBuffers_.emplace_back(index); renderBuffers_.pop_front(); @@ -858,7 +858,7 @@ int32_t FCodec::ReleaseOutputBuffer(uint32_t index) } return AVCS_ERR_OK; } else { - AVCODEC_LOGE("Release output buffer failed: check your index=%{public}zu", index); + AVCODEC_LOGE("Release output buffer failed: check your index=%{public}u", index); return AVCS_ERR_INVALID_VAL; } } @@ -905,7 +905,7 @@ int32_t FCodec::RenderOutputBuffer(uint32_t index) renderBuffers_.emplace_back(index); return AVCS_ERR_OK; } else { - AVCODEC_LOGE("Failed to render output buffer with bad index, index=%{public}zu", index); + AVCODEC_LOGE("Failed to render output buffer with bad index, index=%{public}u", index); return AVCS_ERR_INVALID_VAL; } } @@ -978,7 +978,7 @@ int32_t FCodec::GetCodecCapability(std::vector &capaArray) capsData.profiles.emplace_back(static_cast(AVC_PROFILE_HIGH)); capaArray.emplace_back(capsData); } - AVCODEC_LOGI("Get %{public}d capability successful", capaArray.size()); + AVCODEC_LOGI("Get %{public}zu capability successful", capaArray.size()); return AVCS_ERR_OK; } } // namespace Codec -- Gitee From b14255f9cdff3c8233e3e535922cb1fbf9f988e5 Mon Sep 17 00:00:00 2001 From: zhanghongran Date: Mon, 22 May 2023 14:41:52 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9demuxer=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96=E6=89=93=E5=8D=B0=E7=B1=BB=E5=9E=8B=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhanghongran --- .../plugins/demuxer/ffmpeg_demuxer/ffmpeg_demuxer_plugin.cpp | 3 ++- services/engine/source/source.cpp | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/services/engine/plugin/plugins/demuxer/ffmpeg_demuxer/ffmpeg_demuxer_plugin.cpp b/services/engine/plugin/plugins/demuxer/ffmpeg_demuxer/ffmpeg_demuxer_plugin.cpp index 553c04643..7fcc40bca 100644 --- a/services/engine/plugin/plugins/demuxer/ffmpeg_demuxer/ffmpeg_demuxer_plugin.cpp +++ b/services/engine/plugin/plugins/demuxer/ffmpeg_demuxer/ffmpeg_demuxer_plugin.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include "securec.h" #include "avcodec_errors.h" #include "native_avcodec_base.h" @@ -316,7 +317,7 @@ int32_t FFmpegDemuxerPlugin::ConvertAVPacketToSample(AVStream* avStream, std::sh errno_t rc = memcpy_s(sample->GetBase(), copySize, samplePacket->pkt_->data+samplePacket->offset_, copySize); CHECK_AND_RETURN_RET_LOG(rc == EOK, AVCS_ERR_UNKNOWN, "memcpy_s failed"); - AVCODEC_LOGD("Copy from %{public}llu, copy size %{public}llu", samplePacket->offset_, copySize); + AVCODEC_LOGD("Copy from %{public}" PRIu64 ", copy size %{public}" PRIu64, samplePacket->offset_, copySize); if (copySize != copyFrameSize) { samplePacket->offset_ += copySize; return AVCS_ERR_NO_MEMORY; diff --git a/services/engine/source/source.cpp b/services/engine/source/source.cpp index 34b2ed34d..fb50d4ae7 100644 --- a/services/engine/source/source.cpp +++ b/services/engine/source/source.cpp @@ -341,9 +341,7 @@ int32_t Source::Create(std::string& uri) return AVCS_ERR_CREATE_SOURCE_SUB_SERVICE_FAILED; } Status pluginRet = sourcePlugin_->SetSource(mediaSource); - size_t size; - sourcePlugin_->GetSize(size); - AVCODEC_LOGD("mp4 fileSize: %{public}d", size); + CHECK_AND_RETURN_RET_LOG(pluginRet == Status::OK, AVCS_ERR_CREATE_SOURCE_SUB_SERVICE_FAILED, "create source failed when set data source for plugin!"); ret = LoadInputFormatList(); -- Gitee From 1224a463d18da7773c28dc9248c38796a7618b38 Mon Sep 17 00:00:00 2001 From: zhanghongran Date: Mon, 22 May 2023 14:55:44 +0000 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9demuxer=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96=E6=89=93=E5=8D=B0=E7=B1=BB=E5=9E=8B=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhanghongran --- .../plugins/demuxer/ffmpeg_demuxer/ffmpeg_demuxer_plugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/engine/plugin/plugins/demuxer/ffmpeg_demuxer/ffmpeg_demuxer_plugin.cpp b/services/engine/plugin/plugins/demuxer/ffmpeg_demuxer/ffmpeg_demuxer_plugin.cpp index 7fcc40bca..7a5cb849f 100644 --- a/services/engine/plugin/plugins/demuxer/ffmpeg_demuxer/ffmpeg_demuxer_plugin.cpp +++ b/services/engine/plugin/plugins/demuxer/ffmpeg_demuxer/ffmpeg_demuxer_plugin.cpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include "securec.h" #include "avcodec_errors.h" #include "native_avcodec_base.h" -- Gitee