Skip to content

Commit

Permalink
Improve track index adjustment logic by adding index comparison.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaeho-lee104 authored and tianyif committed Jun 16, 2023
1 parent cf21add commit 43d1bfe
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,8 @@ public void updateSelectedTrack(
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);
Expand Down

0 comments on commit 43d1bfe

Please sign in to comment.