diff --git a/playbacktests/src/main/java/com/google/android/exoplayer/playbacktests/gts/DashTest.java b/playbacktests/src/main/java/com/google/android/exoplayer/playbacktests/gts/DashTest.java index e4dbb62d95..153a16f247 100644 --- a/playbacktests/src/main/java/com/google/android/exoplayer/playbacktests/gts/DashTest.java +++ b/playbacktests/src/main/java/com/google/android/exoplayer/playbacktests/gts/DashTest.java @@ -25,6 +25,7 @@ import com.google.android.exoplayer.TrackRenderer; import com.google.android.exoplayer.chunk.ChunkSampleSource; import com.google.android.exoplayer.chunk.ChunkSource; import com.google.android.exoplayer.chunk.FormatEvaluator; +import com.google.android.exoplayer.chunk.VideoFormatSelectorUtil; import com.google.android.exoplayer.dash.DashChunkSource; import com.google.android.exoplayer.dash.DashTrackSelector; import com.google.android.exoplayer.dash.mpd.AdaptationSet; @@ -48,9 +49,11 @@ import android.annotation.TargetApi; import android.media.MediaCodec; import android.os.Handler; import android.test.ActivityInstrumentationTestCase2; +import android.util.Log; import android.view.Surface; import java.io.IOException; +import java.util.ArrayList; import java.util.List; /** @@ -68,21 +71,40 @@ public final class DashTest extends ActivityInstrumentationTestCase2= 21; + private static final ActionSchedule SEEKING_SCHEDULE = new ActionSchedule.Builder(TAG) .delay(10000).seek(15000) .delay(10000).seek(30000).seek(31000).seek(32000).seek(33000).seek(34000) @@ -124,84 +146,48 @@ public final class DashTest extends ActivityInstrumentationTestCase2 representations = adaptationSet.representations; - int[] representationIndices = new int[representationIds.length]; + private static int[] getRepresentationIndices(AdaptationSet adaptationSet, + String[] representationIds, boolean includeAdditionalVideoRepresentations) + throws IOException { + List availableRepresentations = adaptationSet.representations; + List selectedRepresentationIndices = new ArrayList<>(); + + // Always select explicitly listed representations, failing if they're missing. for (int i = 0; i < representationIds.length; i++) { String representationId = representationIds[i]; boolean foundIndex = false; - for (int j = 0; j < representations.size() && !foundIndex; j++) { - if (representations.get(j).format.id.equals(representationId)) { - representationIndices[i] = j; + for (int j = 0; j < availableRepresentations.size() && !foundIndex; j++) { + if (availableRepresentations.get(j).format.id.equals(representationId)) { + selectedRepresentationIndices.add(j); foundIndex = true; } } @@ -433,11 +439,25 @@ public final class DashTest extends ActivityInstrumentationTestCase2