From e4275063fe7ece606d06674a06c81a93e2baa490 Mon Sep 17 00:00:00 2001 From: jiangzhiwen01 Date: Sat, 6 Nov 2021 17:38:15 +0800 Subject: [PATCH] fix add_packet_to_input_stream deadlock of python --- mediapipe/python/pybind/calculator_graph.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mediapipe/python/pybind/calculator_graph.cc b/mediapipe/python/pybind/calculator_graph.cc index afcf4a65c..36a2bdfa0 100644 --- a/mediapipe/python/pybind/calculator_graph.cc +++ b/mediapipe/python/pybind/calculator_graph.cc @@ -168,6 +168,7 @@ void CalculatorGraphSubmodule(pybind11::module* module) { RaisePyErrorIfNotOk( self->AddPacketToInputStream(stream, packet.At(packet_timestamp))); }, + py::call_guard(), R"doc(Add a packet to a graph input stream. If the graph input stream add mode is ADD_IF_NOT_FULL, the packet will not be @@ -347,6 +348,7 @@ void CalculatorGraphSubmodule(pybind11::module* module) { calculator_graph.def( "wait_for_observed_output", [](CalculatorGraph* self) { + py::gil_scoped_release gil_release; RaisePyErrorIfNotOk(self->WaitForObservedOutput()); }, R"doc(Wait until a packet is emitted on one of the observed output streams.