From 370bc5c765e5ee5c646855c331294ba73689341b Mon Sep 17 00:00:00 2001 From: Junrou Nishida Date: Sat, 16 Dec 2023 14:35:15 +0900 Subject: [PATCH] fix: dispose segmentation mask packets (#1066) --- .../Tasks/Vision/PoseLandmarker/PoseLandmarker.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Tasks/Vision/PoseLandmarker/PoseLandmarker.cs b/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Tasks/Vision/PoseLandmarker/PoseLandmarker.cs index 3bfe90e59..2263ae000 100644 --- a/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Tasks/Vision/PoseLandmarker/PoseLandmarker.cs +++ b/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Tasks/Vision/PoseLandmarker/PoseLandmarker.cs @@ -200,7 +200,15 @@ private static PoseLandmarkerResult BuildPoseLandmarkerResult(PacketMap outputPa var poseLandmarksProto = poseLandmarksProtoPacket.Get(); var poseWorldLandmarksProto = outputPackets.At>(_POSE_WORLD_LANDMARKS_STREAM_NAME).Get(); - var segmentationMasks = outputPackets.At>(_SEGMENTATION_MASK_STREAM_NAME)?.Get(); + + List segmentationMasks = null; + using (var segmentationMaskPacket = outputPackets.At>(_SEGMENTATION_MASK_STREAM_NAME)) + { + if (segmentationMaskPacket != null) + { + segmentationMasks = segmentationMaskPacket.Get(); + } + } return PoseLandmarkerResult.CreateFrom(poseLandmarksProto, poseWorldLandmarksProto, segmentationMasks); }