Fix CompositionPlayerTest.imagePreview_imagePlaysForSetDuration

PiperOrigin-RevId: 700931124
This commit is contained in:
kimvde 2024-11-28 00:34:21 -08:00 committed by Copybara-Service
parent 08619bf6fa
commit dfe3c90f9a

View file

@ -245,6 +245,7 @@ public class CompositionPlayerTest {
.setUri(JPG_SINGLE_PIXEL_ASSET.uri) .setUri(JPG_SINGLE_PIXEL_ASSET.uri)
.setImageDurationMs(1_000) .setImageDurationMs(1_000)
.build()) .build())
.setFrameRate(30)
.build()) .build())
.build()) .build())
.build()); .build());
@ -258,7 +259,9 @@ public class CompositionPlayerTest {
listener.waitUntilPlayerEnded(); listener.waitUntilPlayerEnded();
long playbackRealTimeMs = SystemClock.DEFAULT.elapsedRealtime() - playbackStartTimeMs; long playbackRealTimeMs = SystemClock.DEFAULT.elapsedRealtime() - playbackStartTimeMs;
assertThat(playbackRealTimeMs).isAtLeast(1_000); // Video frames are not rendered exactly at the time corresponding to their presentation
// timestamp, and the differences accumulate.
assertThat(playbackRealTimeMs).isAtLeast(900);
} }
@Test @Test