Improve track index adjustment logic by adding index comparison.

This commit is contained in:
jaeholee104 2023-06-03 04:47:17 +09:00 committed by Tianyi Feng
parent cf21add916
commit 43d1bfe11a

View File

@ -457,7 +457,8 @@ public class AdaptiveTrackSelection extends BaseTrackSelection {
previousReason = Iterables.getLast(queue).trackSelectionReason;
}
int newSelectedIndex = determineIdealSelectedIndex(nowMs, chunkDurationUs);
if (!isTrackExcluded(previousSelectedIndex, nowMs)) {
if (newSelectedIndex != previousSelectedIndex
&& !isTrackExcluded(previousSelectedIndex, nowMs)) {
// Revert back to the previous selection if conditions are not suitable for switching.
Format currentFormat = getFormat(previousSelectedIndex);
Format selectedFormat = getFormat(newSelectedIndex);