Fix HLS Timeline.isDynamic

- Also fix an issue that allowed blacklisting of all tracks,
due to incorrect index being used.
- Also fix an issue with track deselection for HLS.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=132882151
This commit is contained in:
olly 2016-09-12 09:28:46 -07:00 committed by Oliver Woodman
parent 2da35769ff
commit 26e1306639
2 changed files with 4 additions and 3 deletions

View file

@ -163,7 +163,8 @@ import java.util.List;
mayRetainStreamFlags, childStreams, streamResetFlags, !seenFirstTrackSelection);
boolean wrapperEnabled = false;
for (int j = 0; j < selections.length; j++) {
if (selectionChildIndices[j] == i) {
if (selectionChildIndices[j] == i
|| (selectionChildIndices[j] == C.INDEX_UNSET && streamChildIndices[j] == i)) {
streams[j] = childStreams[j];
if (childStreams[j] != null) {
wrapperEnabled = true;
@ -291,7 +292,7 @@ import java.util.List;
callback.onPrepared(this);
// TODO[playlists]: Calculate the window.
Timeline timeline = new SinglePeriodTimeline(durationUs, !isLive);
Timeline timeline = new SinglePeriodTimeline(durationUs, durationUs, 0, 0, !isLive, isLive);
sourceListener.onSourceInfoRefreshed(timeline, playlist);
}

View file

@ -138,7 +138,7 @@ public abstract class BaseTrackSelection implements TrackSelection {
long nowMs = SystemClock.elapsedRealtime();
boolean canBlacklist = isBlacklisted(index, nowMs);
for (int i = 0; i < length && !canBlacklist; i++) {
canBlacklist = i != index && !isBlacklisted(index, nowMs);
canBlacklist = i != index && !isBlacklisted(i, nowMs);
}
if (!canBlacklist) {
return false;