From 26e1306639c7f98825972cdcc4e573050a1f4ea8 Mon Sep 17 00:00:00 2001 From: olly Date: Mon, 12 Sep 2016 09:28:46 -0700 Subject: [PATCH] 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 --- .../google/android/exoplayer2/source/hls/HlsMediaPeriod.java | 5 +++-- .../exoplayer2/trackselection/BaseTrackSelection.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/library/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaPeriod.java b/library/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaPeriod.java index 2530a18629..288412ccbb 100644 --- a/library/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaPeriod.java +++ b/library/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaPeriod.java @@ -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); } diff --git a/library/src/main/java/com/google/android/exoplayer2/trackselection/BaseTrackSelection.java b/library/src/main/java/com/google/android/exoplayer2/trackselection/BaseTrackSelection.java index 57811efef5..c81ffb441f 100644 --- a/library/src/main/java/com/google/android/exoplayer2/trackselection/BaseTrackSelection.java +++ b/library/src/main/java/com/google/android/exoplayer2/trackselection/BaseTrackSelection.java @@ -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;