diff --git a/mediapipe/calculators/tensor/inference_calculator_metal.cc b/mediapipe/calculators/tensor/inference_calculator_metal.cc index e3451b423..591f0a750 100644 --- a/mediapipe/calculators/tensor/inference_calculator_metal.cc +++ b/mediapipe/calculators/tensor/inference_calculator_metal.cc @@ -191,6 +191,11 @@ absl::Status InferenceCalculatorMetalImpl::Process(CalculatorContext* cc) { [output_encoder endEncoding]; } [command_buffer commit]; + // The below call is found (manual testing) to resolve flickering issues for + // some use cases where multiple Metal calculators are involved. + // TODO: investigate and ensure proper synchronization + // (e.g. fences/barriers/events). + [command_buffer waitUntilScheduled]; kOutTensors(cc).Send(std::move(output_tensors)); return absl::OkStatus();