Skip to content

Commit

Permalink
Use more realistic timeline window duration for playback unit tests.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tonihei authored and ojw28 committed Feb 1, 2018
1 parent 67a812c commit d32181e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@ public void testPlayShortDurationPeriods() throws Exception {
*/
@Test
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);
FakeMediaClockRenderer audioRenderer =
new FakeMediaClockRenderer(Builder.AUDIO_FORMAT) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ public final class FakeTimeline extends Timeline {
*/
public static final class TimelineWindowDefinition {

/**
* Default test window duration in microseconds.
*/
public static final int DEFAULT_WINDOW_DURATION_US = 100_000;
/** Default test window duration in microseconds. */
public static final long DEFAULT_WINDOW_DURATION_US = 10 * C.MICROS_PER_SECOND;

public final int periodCount;
public final Object id;
Expand Down

0 comments on commit d32181e

Please sign in to comment.