diff --git a/mediapipe/python/packet_getter.py b/mediapipe/python/packet_getter.py index cf6e7574a6..dc4af277a7 100644 --- a/mediapipe/python/packet_getter.py +++ b/mediapipe/python/packet_getter.py @@ -17,6 +17,7 @@ from typing import List from google.protobuf import message +from google.protobuf import message_factory from google.protobuf import symbol_database from mediapipe.python._framework_bindings import _packet_getter from mediapipe.python._framework_bindings import packet as mp_packet @@ -67,7 +68,7 @@ def get_proto(packet: mp_packet.Packet) -> message.Message: raise TypeError('Can not find message descriptor by type name: %s' % proto_type_name) - message_class = symbol_database.Default().GetPrototype(descriptor) + message_class = message_factory.GetMessageClass(descriptor) # pylint:disable=protected-access serialized_proto = _packet_getter._get_serialized_proto(packet) # pylint:enable=protected-access @@ -107,7 +108,7 @@ def get_proto_list(packet: mp_packet.Packet) -> List[message.Message]: except KeyError: raise TypeError('Can not find message descriptor by type name: %s' % proto_type_name) - message_class = symbol_database.Default().GetPrototype(descriptor) + message_class = message_factory.GetMessageClass(descriptor) # pylint:disable=protected-access serialized_protos = _packet_getter._get_serialized_proto_list(packet) # pylint:enable=protected-access