Signal end-of-stream after creating latch

The output end-of-stream notification from the last shader could theoretically
arrive before the latch for detecting it is created, which might cause waiting
on the latch indefinitely. Create the latch before signaling end of stream so
that it's guaranteed to be set before the end-of-stream signal arrives.

PiperOrigin-RevId: 532056472
This commit is contained in:
andrewlewis 2023-05-15 11:25:24 +01:00 committed by Ian Baker
parent 0a86790be2
commit 857e6ebee8

View file

@ -374,9 +374,9 @@ public final class DefaultVideoFrameProcessor implements VideoFrameProcessor {
}
}
checkNotNull(textureManager).signalEndOfCurrentInputStream();
// Wait until the current input stream is processed before continuing to the next input.
latch = new CountDownLatch(1);
checkNotNull(textureManager).signalEndOfCurrentInputStream();
try {
latch.await();
} catch (InterruptedException e) {