Use the current overrides of the player as preset

Issue: google/ExoPlayer#10429
PiperOrigin-RevId: 461577039
This commit is contained in:
bachinger 2022-07-18 10:36:01 +00:00 committed by Rohit Singh
parent 604ab7fcda
commit 5c2aabca66
2 changed files with 7 additions and 4 deletions

View File

@ -47,6 +47,9 @@ This release corresponds to the
* Ensure TalkBack announces the currently active speed option in the * Ensure TalkBack announces the currently active speed option in the
playback controls menu playback controls menu
([#10298](https://github.com/google/ExoPlayer/issues/10298)). ([#10298](https://github.com/google/ExoPlayer/issues/10298)).
* Use current overrides of the player as preset in
`TrackSelectionDialogBuilder`
([#10429](https://github.com/google/ExoPlayer/issues/10429)).
* RTSP: * RTSP:
* Add RTP reader for H263 * Add RTP reader for H263
([#63](https://github.com/androidx/media/pull/63)). ([#63](https://github.com/androidx/media/pull/63)).

View File

@ -67,7 +67,7 @@ public final class TrackSelectionDialogBuilder {
private boolean showDisableOption; private boolean showDisableOption;
@Nullable private TrackNameProvider trackNameProvider; @Nullable private TrackNameProvider trackNameProvider;
private boolean isDisabled; private boolean isDisabled;
private Map<TrackGroup, TrackSelectionOverride> overrides; private ImmutableMap<TrackGroup, TrackSelectionOverride> overrides;
@Nullable private Comparator<Format> trackFormatComparator; @Nullable private Comparator<Format> trackFormatComparator;
/** /**
@ -87,7 +87,7 @@ public final class TrackSelectionDialogBuilder {
this.title = title; this.title = title;
this.trackGroups = ImmutableList.copyOf(trackGroups); this.trackGroups = ImmutableList.copyOf(trackGroups);
this.callback = callback; this.callback = callback;
overrides = Collections.emptyMap(); overrides = ImmutableMap.of();
} }
/** /**
@ -110,7 +110,7 @@ public final class TrackSelectionDialogBuilder {
trackGroups.add(trackGroup); trackGroups.add(trackGroup);
} }
} }
overrides = Collections.emptyMap(); overrides = player.getTrackSelectionParameters().overrides;
callback = callback =
(isDisabled, overrides) -> { (isDisabled, overrides) -> {
TrackSelectionParameters.Builder parametersBuilder = TrackSelectionParameters.Builder parametersBuilder =
@ -171,7 +171,7 @@ public final class TrackSelectionDialogBuilder {
*/ */
public TrackSelectionDialogBuilder setOverrides( public TrackSelectionDialogBuilder setOverrides(
Map<TrackGroup, TrackSelectionOverride> overrides) { Map<TrackGroup, TrackSelectionOverride> overrides) {
this.overrides = overrides; this.overrides = ImmutableMap.copyOf(overrides);
return this; return this;
} }