Commit c1bfab3c by hoangtc Committed by Oliver Woodman

Fix a minor bug with AdaptiveTrackSelection.

When updating track selection, we should only revert back from ideal
track selection to current track selection if the currently selected
track is not black-listed.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=158135644
parent 5c2c3c5c
...@@ -156,13 +156,13 @@ public class AdaptiveTrackSelection extends BaseTrackSelection { ...@@ -156,13 +156,13 @@ public class AdaptiveTrackSelection extends BaseTrackSelection {
long nowMs = SystemClock.elapsedRealtime(); long nowMs = SystemClock.elapsedRealtime();
// Get the current and ideal selections. // Get the current and ideal selections.
int currentSelectedIndex = selectedIndex; int currentSelectedIndex = selectedIndex;
Format currentFormat = getSelectedFormat();
int idealSelectedIndex = determineIdealSelectedIndex(nowMs); int idealSelectedIndex = determineIdealSelectedIndex(nowMs);
Format idealFormat = getFormat(idealSelectedIndex);
// Assume we can switch to the ideal selection. // Assume we can switch to the ideal selection.
selectedIndex = idealSelectedIndex; selectedIndex = idealSelectedIndex;
// Revert back to the current selection if conditions are not suitable for switching. // Revert back to the current selection if conditions are not suitable for switching.
if (currentFormat != null && !isBlacklisted(selectedIndex, nowMs)) { if (!isBlacklisted(currentSelectedIndex, nowMs)) {
Format currentFormat = getFormat(currentSelectedIndex);
Format idealFormat = getFormat(idealSelectedIndex);
if (idealFormat.bitrate > currentFormat.bitrate if (idealFormat.bitrate > currentFormat.bitrate
&& bufferedDurationUs < minDurationForQualityIncreaseUs) { && bufferedDurationUs < minDurationForQualityIncreaseUs) {
// The ideal track is a higher quality, but we have insufficient buffer to safely switch // The ideal track is a higher quality, but we have insufficient buffer to safely switch
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment