Increase sleep duration when video encoder ends with no output frames

This duration was not sufficient on a Pixel 3a

PiperOrigin-RevId: 642276212
This commit is contained in:
kimvde 2024-06-11 08:18:37 -07:00 committed by Copybara-Service
parent f554c12099
commit b763673903

View File

@ -254,12 +254,12 @@ public final class DefaultCodec implements Codec {
@Override @Override
public void signalEndOfInputStream() throws ExportException { public void signalEndOfInputStream() throws ExportException {
if (!videoOutputStarted.get()) { if (!videoOutputStarted.get()) {
// When encoding a 1-frame video, there is a synchronization problem between feeding the frame // When encoding a video with a small number of frames, there is a synchronization problem
// to the encoder input surface and signaling end of stream. On some devices, sometimes, // between feeding the frame to the encoder input surface and signaling end of stream. On some
// the frame gets lost and an empty output is produced. Waiting before signaling end of stream // devices, sometimes, the frame gets lost and an empty output is produced. Waiting before
// seems to resolve this issue. See b/301603935. // signaling end of stream seems to resolve this issue. See b/301603935.
try { try {
Thread.sleep(10); Thread.sleep(30);
} catch (InterruptedException e) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} }