Remove the problematic packet release calls in OutputHandler::run.

OutputHandler::run is installed as a MultiStreamCallback into the TaskRunner and it's invoked in the Graph::CallbackToJava() jni method.

In CallbackToJava(), the packets are removed in RemovePacket() calls after the multi stream callback is invoked. The current logic lets the MultiStreamCallback release the packets first and leaves null pointers to RemovePacket() to remove, which may cause the app crash. The fix is to remove the packet release calls in the MultiStreamCallback and always leave the packet release work to RemovePacket().

PiperOrigin-RevId: 487558809
This commit is contained in:
Jiuqiang Tang 2022-11-10 09:25:38 -08:00 committed by Copybara-Service
parent 0b12aa9435
commit 2ce3a9719e

View File

@ -119,12 +119,6 @@ public class OutputHandler<OutputT extends TaskResult, InputT> {
} else { } else {
Log.e(TAG, "Error occurs when getting MediaPipe task result. " + e); Log.e(TAG, "Error occurs when getting MediaPipe task result. " + e);
} }
} finally {
for (Packet packet : packets) {
if (packet != null) {
packet.release();
}
}
} }
} }
} }