diff --git a/mediapipe/framework/calculator_graph.cc b/mediapipe/framework/calculator_graph.cc index b9fc4c965..2a2088c6b 100644 --- a/mediapipe/framework/calculator_graph.cc +++ b/mediapipe/framework/calculator_graph.cc @@ -839,6 +839,10 @@ absl::Status CalculatorGraph::PrepareForRun( } absl::Status CalculatorGraph::WaitUntilIdle() { + if (has_sources_) { + LOG(WARNING) << "WaitUntilIdle called on a graph with source nodes, which " + "is not fully supported at the moment."; + } MP_RETURN_IF_ERROR(scheduler_.WaitUntilIdle()); VLOG(2) << "Scheduler idle."; absl::Status status = absl::OkStatus(); diff --git a/mediapipe/framework/calculator_graph.h b/mediapipe/framework/calculator_graph.h index 354694e39..748d2fb32 100644 --- a/mediapipe/framework/calculator_graph.h +++ b/mediapipe/framework/calculator_graph.h @@ -229,8 +229,11 @@ class CalculatorGraph { // Wait until the running graph is in the idle mode, which is when nothing can // be scheduled and nothing is running in the worker threads. This function // can be called only after StartRun(). + // // NOTE: The graph must not have any source nodes because source nodes prevent // the running graph from becoming idle until the source nodes are done. + // Currently, `WaitUntilIdle` cannot be used reliably on graphs with any + // source nodes. absl::Status WaitUntilIdle(); // Wait until a packet is emitted on one of the observed output streams. diff --git a/mediapipe/framework/scheduler.cc b/mediapipe/framework/scheduler.cc index 854c10fd5..ceadce787 100644 --- a/mediapipe/framework/scheduler.cc +++ b/mediapipe/framework/scheduler.cc @@ -273,8 +273,8 @@ absl::Status Scheduler::WaitForObservedOutput() { // Idleness requires: // 1. either the graph has no source nodes or all source nodes are closed, and // 2. no packets are added to graph input streams. -// For simplicity, we only allow WaitUntilIdle() to be called on a graph with -// no source nodes. (This is enforced by CalculatorGraph::WaitUntilIdle().) +// For simplicity, we only fully support WaitUntilIdle() to be called on a graph +// with no source nodes. // The application must ensure no other threads are adding packets to graph // input streams while a WaitUntilIdle() call is in progress. absl::Status Scheduler::WaitUntilIdle() {