Commit 979fd083 by Oliver Woodman

Don't invoke adaptiveTrack with 0 or 1 representations.

0 will crash. 1 is pointless.
parent e8895c87
...@@ -84,8 +84,11 @@ public final class DefaultDashTrackSelector implements DashTrackSelector { ...@@ -84,8 +84,11 @@ public final class DefaultDashTrackSelector implements DashTrackSelector {
} else { } else {
representations = Util.firstIntegersArray(adaptationSet.representations.size()); representations = Util.firstIntegersArray(adaptationSet.representations.size());
} }
output.adaptiveTrack(manifest, periodIndex, i, representations); int representationCount = representations.length;
for (int j = 0; j < representations.length; j++) { if (representationCount > 1) {
output.adaptiveTrack(manifest, periodIndex, i, representations);
}
for (int j = 0; j < representationCount; j++) {
output.fixedTrack(manifest, periodIndex, i, representations[j]); output.fixedTrack(manifest, periodIndex, i, representations[j]);
} }
} else { } else {
......
...@@ -50,8 +50,11 @@ public final class DefaultSmoothStreamingTrackSelector implements SmoothStreamin ...@@ -50,8 +50,11 @@ public final class DefaultSmoothStreamingTrackSelector implements SmoothStreamin
if (streamElementType == StreamElement.TYPE_VIDEO) { if (streamElementType == StreamElement.TYPE_VIDEO) {
int[] trackIndices = VideoFormatSelectorUtil.selectVideoFormatsForDefaultDisplay( int[] trackIndices = VideoFormatSelectorUtil.selectVideoFormatsForDefaultDisplay(
context, Arrays.asList(manifest.streamElements[i].tracks), null, false); context, Arrays.asList(manifest.streamElements[i].tracks), null, false);
output.adaptiveTrack(manifest, i, trackIndices); int trackCount = trackIndices.length;
for (int j = 0; j < trackIndices.length; j++) { if (trackCount > 1) {
output.adaptiveTrack(manifest, i, trackIndices);
}
for (int j = 0; j < trackCount; j++) {
output.fixedTrack(manifest, i, trackIndices[j]); output.fixedTrack(manifest, i, trackIndices[j]);
} }
} else { } else {
......
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