Wait until playback started in certain action schedules.

Some action schedules (especially those for real media with potentially
long initial buffering times) don't wait until the playback started
before executing the rest of the schedule.

Added waitForPlaybackStateChanged(STATE_READY) to all applicable action schedules.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171009434
This commit is contained in:
tonihei 2017-10-04 07:59:09 -07:00 committed by Oliver Woodman
parent d7b4f8a645
commit 331c179a88
3 changed files with 9 additions and 2 deletions

View file

@ -16,6 +16,7 @@
package com.google.android.exoplayer2.playbacktests.gts;
import android.test.ActivityInstrumentationTestCase2;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.testutil.ActionSchedule;
import com.google.android.exoplayer2.testutil.HostActivity;
import com.google.android.exoplayer2.util.MimeTypes;
@ -39,8 +40,9 @@ public final class CommonEncryptionDrmTest extends ActivityInstrumentationTestCa
// Seeks help reproduce playback issues in certain devices.
private static final ActionSchedule ACTION_SCHEDULE_WITH_SEEKS = new ActionSchedule.Builder(TAG)
.delay(30000).seekAndWait(300000).delay(10000).seekAndWait(270000).delay(10000)
.seekAndWait(200000).delay(10000).seekAndWait(732000).build();
.waitForPlaybackState(Player.STATE_READY).delay(30000).seekAndWait(300000).delay(10000)
.seekAndWait(270000).delay(10000).seekAndWait(200000).delay(10000).seekAndWait(732000)
.build();
private DashTestRunner testRunner;

View file

@ -17,6 +17,7 @@ package com.google.android.exoplayer2.playbacktests.gts;
import android.test.ActivityInstrumentationTestCase2;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.mediacodec.MediaCodecInfo;
import com.google.android.exoplayer2.mediacodec.MediaCodecUtil;
import com.google.android.exoplayer2.mediacodec.MediaCodecUtil.DecoderQueryException;
@ -33,12 +34,14 @@ public final class DashStreamingTest extends ActivityInstrumentationTestCase2<Ho
private static final String TAG = "DashStreamingTest";
private static final ActionSchedule SEEKING_SCHEDULE = new ActionSchedule.Builder(TAG)
.waitForPlaybackState(Player.STATE_READY)
.delay(10000).seekAndWait(15000)
.delay(10000).seek(30000).seek(31000).seek(32000).seek(33000).seekAndWait(34000)
.delay(1000).pause().delay(1000).play()
.delay(1000).pause().seekAndWait(120000).delay(1000).play()
.build();
private static final ActionSchedule RENDERER_DISABLING_SCHEDULE = new ActionSchedule.Builder(TAG)
.waitForPlaybackState(Player.STATE_READY)
// Wait 10 seconds, disable the video renderer, wait another 10 seconds and enable it again.
.delay(10000).disableRenderer(DashTestRunner.VIDEO_RENDERER_INDEX)
.delay(10000).enableRenderer(DashTestRunner.VIDEO_RENDERER_INDEX)

View file

@ -19,6 +19,7 @@ import android.media.MediaDrm.MediaDrmStateException;
import android.net.Uri;
import android.test.ActivityInstrumentationTestCase2;
import android.util.Pair;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.drm.DrmInitData;
import com.google.android.exoplayer2.drm.DrmSession.DrmSessionException;
import com.google.android.exoplayer2.drm.FrameworkMediaCrypto;
@ -162,6 +163,7 @@ public final class DashWidevineOfflineTest extends ActivityInstrumentationTestCa
assertTrue("License duration should be less than 30 sec. "
+ "Server settings might have changed.", licenseDuration < 30);
ActionSchedule schedule = new ActionSchedule.Builder(TAG)
.waitForPlaybackState(Player.STATE_READY)
.delay(3000).pause().delay(licenseDuration * 1000 + 2000).play().build();
// DefaultDrmSessionManager should renew the license and stream play fine