mirror of
https://github.com/androidx/media.git
synced 2025-05-10 00:59:51 +08:00
Add HD content filtering to DefaultTrackSelectionPolicy
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=126324788
This commit is contained in:
parent
a476e090bc
commit
9f017d71ef
@ -27,6 +27,7 @@ public class DefaultTrackSelectionPolicy extends TrackSelectionPolicy {
|
||||
private String preferredLanguage;
|
||||
private boolean allowMixedMimeAdaptiveness;
|
||||
private boolean allowNonSeamlessAdaptiveness;
|
||||
private boolean filterHdFormats;
|
||||
private int maxVideoWidth;
|
||||
private int maxVideoHeight;
|
||||
|
||||
@ -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) {
|
||||
if (this.allowMixedMimeAdaptiveness != allowMixedMimeAdaptiveness) {
|
||||
this.allowMixedMimeAdaptiveness = allowMixedMimeAdaptiveness;
|
||||
@ -99,6 +107,8 @@ public class DefaultTrackSelectionPolicy extends TrackSelectionPolicy {
|
||||
int requiredAdaptiveSupport = allowNonSeamlessAdaptiveness
|
||||
? TrackRenderer.ADAPTIVE_NOT_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
|
||||
&& (renderer.supportsMixedMimeTypeAdaptation() & requiredAdaptiveSupport) != 0;
|
||||
int largestAdaptiveGroup = -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user