From 0e09bb48fbd565646a71e895bf912d6462f9431c Mon Sep 17 00:00:00 2001 From: zaki Date: Tue, 18 Jul 2023 14:51:31 +0530 Subject: [PATCH 1/2] Taking size from getSerialize() now --- base/src/MotionVectorExtractor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/base/src/MotionVectorExtractor.cpp b/base/src/MotionVectorExtractor.cpp index bc92bb37e..873a042f1 100644 --- a/base/src/MotionVectorExtractor.cpp +++ b/base/src/MotionVectorExtractor.cpp @@ -191,8 +191,8 @@ int DetailFfmpeg::decodeAndGetMotionVectors(AVPacket* pkt, frame_container& fram { DrawingOverlay drawingOverlay; drawingOverlay.add(&compositeOverlay); - - outFrame = makeFrameWithPinId(sideData->size, motionVectorPinId); + auto serializedSize = drawingOverlay.mGetSerializeSize(); + outFrame = makeFrameWithPinId(serializedSize, motionVectorPinId); memcpy(outFrame->data(), sideData->data, sideData->size); drawingOverlay.serialize(outFrame); frames.insert(make_pair(motionVectorPinId, outFrame)); @@ -284,7 +284,7 @@ void DetailOpenH264::getMotionVectors(frame_container& frames, frame_sp& outFram { DrawingOverlay drawingOverlay; drawingOverlay.add(&compositeOverlay); - auto mvSize = static_cast(mMotionVectorSize); + auto mvSize = drawingOverlay.mGetSerializeSize(); outFrame = makeframe(outFrame, mvSize, motionVectorPinId); drawingOverlay.serialize(outFrame); frames.insert(make_pair(motionVectorPinId, outFrame)); From 3ab78b3c01f1e324fee4f8938f3f16e176e2fa07 Mon Sep 17 00:00:00 2001 From: zaki Date: Tue, 18 Jul 2023 19:13:33 +0530 Subject: [PATCH 2/2] Updated code to use serialized size --- base/src/MotionVectorExtractor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/src/MotionVectorExtractor.cpp b/base/src/MotionVectorExtractor.cpp index 873a042f1..e274351b7 100644 --- a/base/src/MotionVectorExtractor.cpp +++ b/base/src/MotionVectorExtractor.cpp @@ -193,7 +193,7 @@ int DetailFfmpeg::decodeAndGetMotionVectors(AVPacket* pkt, frame_container& fram drawingOverlay.add(&compositeOverlay); auto serializedSize = drawingOverlay.mGetSerializeSize(); outFrame = makeFrameWithPinId(serializedSize, motionVectorPinId); - memcpy(outFrame->data(), sideData->data, sideData->size); + memcpy(outFrame->data(), sideData->data, serializedSize); drawingOverlay.serialize(outFrame); frames.insert(make_pair(motionVectorPinId, outFrame)); }