From 9456c6483064d9b9907dc2fff9c07a16824cadfb Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Fri, 17 Nov 2023 09:57:05 -0800 Subject: [PATCH] No public description PiperOrigin-RevId: 583417701 --- .../com/google/mediapipe/framework/PacketGetter.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mediapipe/java/com/google/mediapipe/framework/PacketGetter.java b/mediapipe/java/com/google/mediapipe/framework/PacketGetter.java index 5ea12872a..3d6b16ce6 100644 --- a/mediapipe/java/com/google/mediapipe/framework/PacketGetter.java +++ b/mediapipe/java/com/google/mediapipe/framework/PacketGetter.java @@ -128,6 +128,16 @@ public final class PacketGetter { return ProtoUtil.unpack(result, defaultInstance); } + public static T getProto(final Packet packet, Parser messageParser) { + SerializedMessage result = new SerializedMessage(); + nativeGetProto(packet.getNativeHandle(), result); + try { + return messageParser.parseFrom(result.value); + } catch (InvalidProtocolBufferException e) { + throw new IllegalArgumentException(e); + } + } + /** * @deprecated {@link #getProto(Packet, MessageLite)} is safer to use in obfuscated builds. */