Make timeout longer for emulators

Some test is flaky because frame processing is quite slow and triggered this
time out.

PiperOrigin-RevId: 650191068
This commit is contained in:
claincly 2024-07-08 03:44:45 -07:00 committed by Copybara-Service
parent f55c09cfe2
commit b4722ef1ea
2 changed files with 5 additions and 1 deletions

View File

@ -74,7 +74,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
* operation takes a long time to finish, the timeout could be a result of slow GL operation back * operation takes a long time to finish, the timeout could be a result of slow GL operation back
* pressured the decoder, and the decoder is not able to decode another frame. * pressured the decoder, and the decoder is not able to decode another frame.
*/ */
private static final long SURFACE_TEXTURE_TIMEOUT_MS = isRunningOnEmulator() ? 10_000 : 500; private static final long SURFACE_TEXTURE_TIMEOUT_MS = isRunningOnEmulator() ? 20_000 : 500;
// Wait delay between checking whether a registered frame arrives on the SurfaceTexture. // Wait delay between checking whether a registered frame arrives on the SurfaceTexture.
private static final long SURFACE_TEXTURE_WAIT_DELAY_MS = 10; private static final long SURFACE_TEXTURE_WAIT_DELAY_MS = 10;

View File

@ -16,6 +16,7 @@
package androidx.media3.transformer; package androidx.media3.transformer;
import static androidx.media3.common.util.Util.isRunningOnEmulator;
import static androidx.media3.transformer.AndroidTestUtil.FORCE_TRANSCODE_VIDEO_EFFECTS; import static androidx.media3.transformer.AndroidTestUtil.FORCE_TRANSCODE_VIDEO_EFFECTS;
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET; import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET;
import static androidx.media3.transformer.AndroidTestUtil.assumeFormatsSupported; import static androidx.media3.transformer.AndroidTestUtil.assumeFormatsSupported;
@ -53,6 +54,8 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class ForceEndOfStreamTest { public class ForceEndOfStreamTest {
// Referenced from ExternalTextureManager
private static final long SURFACE_TEXTURE_TIMEOUT_MS = isRunningOnEmulator() ? 20_000 : 500;
private final Context context = ApplicationProvider.getApplicationContext(); private final Context context = ApplicationProvider.getApplicationContext();
@Rule public final TestName testName = new TestName(); @Rule public final TestName testName = new TestName();
@ -125,6 +128,7 @@ public class ForceEndOfStreamTest {
context, context,
new FrameDroppingDecoderFactory(context, MP4_ASSET.videoFrameCount, framesToSkip), new FrameDroppingDecoderFactory(context, MP4_ASSET.videoFrameCount, framesToSkip),
Clock.DEFAULT)) Clock.DEFAULT))
.setMaxDelayBetweenMuxerSamplesMs(SURFACE_TEXTURE_TIMEOUT_MS)
.build(); .build();
} }