Use more realistic timeline window duration for playback unit tests.

100ms is unrealistically short and, for example, causes the player to buffer
many periods ahead when looping.

Previously this was not feasible, because ExoPlayerTest as instrumentation test
actually needed to wait for the realtime playback duration.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=183646772
This commit is contained in:
tonihei 2018-01-29 04:30:55 -08:00 committed by Oliver Woodman
parent 67a812c1c2
commit d32181e4e9
2 changed files with 7 additions and 5 deletions

View File

@ -165,7 +165,11 @@ public final class ExoPlayerTest {
*/ */
@Test @Test
public void testReadAheadToEndDoesNotResetRenderer() throws Exception { public void testReadAheadToEndDoesNotResetRenderer() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 3); // Use sufficiently short periods to ensure the player attempts to read all at once.
TimelineWindowDefinition windowDefinition =
new TimelineWindowDefinition(
/* isSeekable= */ false, /* isDynamic= */ false, /* durationUs= */ 100_000);
Timeline timeline = new FakeTimeline(windowDefinition, windowDefinition, windowDefinition);
final FakeRenderer videoRenderer = new FakeRenderer(Builder.VIDEO_FORMAT); final FakeRenderer videoRenderer = new FakeRenderer(Builder.VIDEO_FORMAT);
FakeMediaClockRenderer audioRenderer = FakeMediaClockRenderer audioRenderer =
new FakeMediaClockRenderer(Builder.AUDIO_FORMAT) { new FakeMediaClockRenderer(Builder.AUDIO_FORMAT) {

View File

@ -31,10 +31,8 @@ public final class FakeTimeline extends Timeline {
*/ */
public static final class TimelineWindowDefinition { public static final class TimelineWindowDefinition {
/** /** Default test window duration in microseconds. */
* Default test window duration in microseconds. public static final long DEFAULT_WINDOW_DURATION_US = 10 * C.MICROS_PER_SECOND;
*/
public static final int DEFAULT_WINDOW_DURATION_US = 100_000;
public final int periodCount; public final int periodCount;
public final Object id; public final Object id;