Commit 9f017d71 by aquilescanta Committed by Oliver Woodman

Add HD content filtering to DefaultTrackSelectionPolicy

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=126324788
parent a476e090
...@@ -27,6 +27,7 @@ public class DefaultTrackSelectionPolicy extends TrackSelectionPolicy { ...@@ -27,6 +27,7 @@ public class DefaultTrackSelectionPolicy extends TrackSelectionPolicy {
private String preferredLanguage; private String preferredLanguage;
private boolean allowMixedMimeAdaptiveness; private boolean allowMixedMimeAdaptiveness;
private boolean allowNonSeamlessAdaptiveness; private boolean allowNonSeamlessAdaptiveness;
private boolean filterHdFormats;
private int maxVideoWidth; private int maxVideoWidth;
private int maxVideoHeight; private int maxVideoHeight;
...@@ -43,6 +44,13 @@ public class DefaultTrackSelectionPolicy extends TrackSelectionPolicy { ...@@ -43,6 +44,13 @@ public class DefaultTrackSelectionPolicy extends TrackSelectionPolicy {
} }
} }
public void setFilterHdFormats(boolean filterHdFormats) {
if (this.filterHdFormats != filterHdFormats) {
this.filterHdFormats = filterHdFormats;
invalidate();
}
}
public void allowMixedMimeAdaptiveness(boolean allowMixedMimeAdaptiveness) { public void allowMixedMimeAdaptiveness(boolean allowMixedMimeAdaptiveness) {
if (this.allowMixedMimeAdaptiveness != allowMixedMimeAdaptiveness) { if (this.allowMixedMimeAdaptiveness != allowMixedMimeAdaptiveness) {
this.allowMixedMimeAdaptiveness = allowMixedMimeAdaptiveness; this.allowMixedMimeAdaptiveness = allowMixedMimeAdaptiveness;
...@@ -99,6 +107,8 @@ public class DefaultTrackSelectionPolicy extends TrackSelectionPolicy { ...@@ -99,6 +107,8 @@ public class DefaultTrackSelectionPolicy extends TrackSelectionPolicy {
int requiredAdaptiveSupport = allowNonSeamlessAdaptiveness int requiredAdaptiveSupport = allowNonSeamlessAdaptiveness
? TrackRenderer.ADAPTIVE_NOT_SEAMLESS | TrackRenderer.ADAPTIVE_SEAMLESS ? TrackRenderer.ADAPTIVE_NOT_SEAMLESS | TrackRenderer.ADAPTIVE_SEAMLESS
: TrackRenderer.ADAPTIVE_SEAMLESS; : TrackRenderer.ADAPTIVE_SEAMLESS;
int maxVideoWidth = Math.min(this.maxVideoWidth, filterHdFormats ? 1279 : Integer.MAX_VALUE);
int maxVideoHeight = Math.min(this.maxVideoHeight, filterHdFormats ? 719 : Integer.MAX_VALUE);
boolean allowMixedMimeTypes = allowMixedMimeAdaptiveness boolean allowMixedMimeTypes = allowMixedMimeAdaptiveness
&& (renderer.supportsMixedMimeTypeAdaptation() & requiredAdaptiveSupport) != 0; && (renderer.supportsMixedMimeTypeAdaptation() & requiredAdaptiveSupport) != 0;
int largestAdaptiveGroup = -1; int largestAdaptiveGroup = -1;
......
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