Commit 331c179a by tonihei Committed by Oliver Woodman

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
parent d7b4f8a6
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
package com.google.android.exoplayer2.playbacktests.gts; package com.google.android.exoplayer2.playbacktests.gts;
import android.test.ActivityInstrumentationTestCase2; import android.test.ActivityInstrumentationTestCase2;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.testutil.ActionSchedule; import com.google.android.exoplayer2.testutil.ActionSchedule;
import com.google.android.exoplayer2.testutil.HostActivity; import com.google.android.exoplayer2.testutil.HostActivity;
import com.google.android.exoplayer2.util.MimeTypes; import com.google.android.exoplayer2.util.MimeTypes;
...@@ -39,8 +40,9 @@ public final class CommonEncryptionDrmTest extends ActivityInstrumentationTestCa ...@@ -39,8 +40,9 @@ public final class CommonEncryptionDrmTest extends ActivityInstrumentationTestCa
// Seeks help reproduce playback issues in certain devices. // Seeks help reproduce playback issues in certain devices.
private static final ActionSchedule ACTION_SCHEDULE_WITH_SEEKS = new ActionSchedule.Builder(TAG) private static final ActionSchedule ACTION_SCHEDULE_WITH_SEEKS = new ActionSchedule.Builder(TAG)
.delay(30000).seekAndWait(300000).delay(10000).seekAndWait(270000).delay(10000) .waitForPlaybackState(Player.STATE_READY).delay(30000).seekAndWait(300000).delay(10000)
.seekAndWait(200000).delay(10000).seekAndWait(732000).build(); .seekAndWait(270000).delay(10000).seekAndWait(200000).delay(10000).seekAndWait(732000)
.build();
private DashTestRunner testRunner; private DashTestRunner testRunner;
......
...@@ -17,6 +17,7 @@ package com.google.android.exoplayer2.playbacktests.gts; ...@@ -17,6 +17,7 @@ package com.google.android.exoplayer2.playbacktests.gts;
import android.test.ActivityInstrumentationTestCase2; import android.test.ActivityInstrumentationTestCase2;
import com.google.android.exoplayer2.ExoPlayer; 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.MediaCodecInfo;
import com.google.android.exoplayer2.mediacodec.MediaCodecUtil; import com.google.android.exoplayer2.mediacodec.MediaCodecUtil;
import com.google.android.exoplayer2.mediacodec.MediaCodecUtil.DecoderQueryException; import com.google.android.exoplayer2.mediacodec.MediaCodecUtil.DecoderQueryException;
...@@ -33,12 +34,14 @@ public final class DashStreamingTest extends ActivityInstrumentationTestCase2<Ho ...@@ -33,12 +34,14 @@ public final class DashStreamingTest extends ActivityInstrumentationTestCase2<Ho
private static final String TAG = "DashStreamingTest"; private static final String TAG = "DashStreamingTest";
private static final ActionSchedule SEEKING_SCHEDULE = new ActionSchedule.Builder(TAG) private static final ActionSchedule SEEKING_SCHEDULE = new ActionSchedule.Builder(TAG)
.waitForPlaybackState(Player.STATE_READY)
.delay(10000).seekAndWait(15000) .delay(10000).seekAndWait(15000)
.delay(10000).seek(30000).seek(31000).seek(32000).seek(33000).seekAndWait(34000) .delay(10000).seek(30000).seek(31000).seek(32000).seek(33000).seekAndWait(34000)
.delay(1000).pause().delay(1000).play() .delay(1000).pause().delay(1000).play()
.delay(1000).pause().seekAndWait(120000).delay(1000).play() .delay(1000).pause().seekAndWait(120000).delay(1000).play()
.build(); .build();
private static final ActionSchedule RENDERER_DISABLING_SCHEDULE = new ActionSchedule.Builder(TAG) 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. // Wait 10 seconds, disable the video renderer, wait another 10 seconds and enable it again.
.delay(10000).disableRenderer(DashTestRunner.VIDEO_RENDERER_INDEX) .delay(10000).disableRenderer(DashTestRunner.VIDEO_RENDERER_INDEX)
.delay(10000).enableRenderer(DashTestRunner.VIDEO_RENDERER_INDEX) .delay(10000).enableRenderer(DashTestRunner.VIDEO_RENDERER_INDEX)
......
...@@ -19,6 +19,7 @@ import android.media.MediaDrm.MediaDrmStateException; ...@@ -19,6 +19,7 @@ import android.media.MediaDrm.MediaDrmStateException;
import android.net.Uri; import android.net.Uri;
import android.test.ActivityInstrumentationTestCase2; import android.test.ActivityInstrumentationTestCase2;
import android.util.Pair; import android.util.Pair;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.drm.DrmInitData; import com.google.android.exoplayer2.drm.DrmInitData;
import com.google.android.exoplayer2.drm.DrmSession.DrmSessionException; import com.google.android.exoplayer2.drm.DrmSession.DrmSessionException;
import com.google.android.exoplayer2.drm.FrameworkMediaCrypto; import com.google.android.exoplayer2.drm.FrameworkMediaCrypto;
...@@ -162,6 +163,7 @@ public final class DashWidevineOfflineTest extends ActivityInstrumentationTestCa ...@@ -162,6 +163,7 @@ public final class DashWidevineOfflineTest extends ActivityInstrumentationTestCa
assertTrue("License duration should be less than 30 sec. " assertTrue("License duration should be less than 30 sec. "
+ "Server settings might have changed.", licenseDuration < 30); + "Server settings might have changed.", licenseDuration < 30);
ActionSchedule schedule = new ActionSchedule.Builder(TAG) ActionSchedule schedule = new ActionSchedule.Builder(TAG)
.waitForPlaybackState(Player.STATE_READY)
.delay(3000).pause().delay(licenseDuration * 1000 + 2000).play().build(); .delay(3000).pause().delay(licenseDuration * 1000 + 2000).play().build();
// DefaultDrmSessionManager should renew the license and stream play fine // DefaultDrmSessionManager should renew the license and stream play fine
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment