Don't invoke adaptiveTrack with 0 or 1 representations.

0 will crash. 1 is pointless.
This commit is contained in:
Oliver Woodman 2015-09-28 12:34:19 +01:00
parent e8895c8746
commit 979fd083b4
2 changed files with 10 additions and 4 deletions

View file

@ -84,8 +84,11 @@ public final class DefaultDashTrackSelector implements DashTrackSelector {
} else {
representations = Util.firstIntegersArray(adaptationSet.representations.size());
}
output.adaptiveTrack(manifest, periodIndex, i, representations);
for (int j = 0; j < representations.length; j++) {
int representationCount = representations.length;
if (representationCount > 1) {
output.adaptiveTrack(manifest, periodIndex, i, representations);
}
for (int j = 0; j < representationCount; j++) {
output.fixedTrack(manifest, periodIndex, i, representations[j]);
}
} else {

View file

@ -50,8 +50,11 @@ public final class DefaultSmoothStreamingTrackSelector implements SmoothStreamin
if (streamElementType == StreamElement.TYPE_VIDEO) {
int[] trackIndices = VideoFormatSelectorUtil.selectVideoFormatsForDefaultDisplay(
context, Arrays.asList(manifest.streamElements[i].tracks), null, false);
output.adaptiveTrack(manifest, i, trackIndices);
for (int j = 0; j < trackIndices.length; j++) {
int trackCount = trackIndices.length;
if (trackCount > 1) {
output.adaptiveTrack(manifest, i, trackIndices);
}
for (int j = 0; j < trackCount; j++) {
output.fixedTrack(manifest, i, trackIndices[j]);
}
} else {