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",