diff --git a/base/src/MotionVectorExtractor.cpp b/base/src/MotionVectorExtractor.cpp index bc92bb37e..e274351b7 100644 --- a/base/src/MotionVectorExtractor.cpp +++ b/base/src/MotionVectorExtractor.cpp @@ -191,9 +191,9 @@ int DetailFfmpeg::decodeAndGetMotionVectors(AVPacket* pkt, frame_container& fram { DrawingOverlay drawingOverlay; drawingOverlay.add(&compositeOverlay); - - outFrame = makeFrameWithPinId(sideData->size, motionVectorPinId); - memcpy(outFrame->data(), sideData->data, sideData->size); + auto serializedSize = drawingOverlay.mGetSerializeSize(); + outFrame = makeFrameWithPinId(serializedSize, motionVectorPinId); + memcpy(outFrame->data(), sideData->data, serializedSize); 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));