From c561bf569e655c1337533c2b30ed945beee7ffd5 Mon Sep 17 00:00:00 2001 From: JohannesItten Date: Thu, 9 Jul 2026 19:27:22 +0300 Subject: [PATCH] wait fixes --- nodes/pip/main.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/nodes/pip/main.cpp b/nodes/pip/main.cpp index d9d55a3..580ba61 100644 --- a/nodes/pip/main.cpp +++ b/nodes/pip/main.cpp @@ -131,10 +131,13 @@ class PiPNode : public dmf::NodeBase { uint8_t* bg_buf = nullptr; uint8_t* inset_buf = nullptr; - const mxlStatus bg_st = mxlFlowReaderGetGrainNonBlocking( - bg_reader, index, &bg_grain, &bg_buf); - const mxlStatus in_st = mxlFlowReaderGetGrainNonBlocking( - inset_reader, index, &inset_grain, &inset_buf); + // Use blocking reads: sync group returns OK when headIndex >= expectedIndex, + // but the writer may not have set validSlices yet. Blocking read handles + // that race by waiting for validSlices == totalSlices. + const mxlStatus bg_st = mxlFlowReaderGetGrain( + bg_reader, index, 40'000'000, &bg_grain, &bg_buf); + const mxlStatus in_st = mxlFlowReaderGetGrain( + inset_reader, index, 40'000'000, &inset_grain, &inset_buf); if (bg_st != MXL_STATUS_OK || in_st != MXL_STATUS_OK || !bg_buf || !inset_buf) { log("grain read after sync OK: bg=%s inset=%s at index=%llu",