Commit 2cb2f6de by olly Committed by Ian Baker

DownloadHelper: Accept generic TrackSelectionParameters

DownloadHelper is in the ExoPlayer module, so there's no reason
why it can't use ExoPlayer specific track selections. That said,
we want our UI components to operate on generic
TrackSelectionParameters, and we want such UI components to be
useful for selecting tracks for download. To keep this interop,
it's necessary to have DownloadHelper accept generic
TrackSelectionParameters, or to require application code to
convert them. The first approach seems preferable!

PiperOrigin-RevId: 432158846
parent 733cd609
...@@ -31,6 +31,11 @@ ...@@ -31,6 +31,11 @@
instead. You can also continue to use `ExoPlayer.getCurrentTrackGroups` instead. You can also continue to use `ExoPlayer.getCurrentTrackGroups`
and `ExoPlayer.getCurrentTrackSelections`, although these methods remain and `ExoPlayer.getCurrentTrackSelections`, although these methods remain
deprecated. deprecated.
* Remove `DownloadHelper`
`DEFAULT_TRACK_SELECTOR_PARAMETERS_WITHOUT_VIEWPORT` and
`DEFAULT_TRACK_SELECTOR_PARAMETERS` constants. Use
`getDefaultTrackSelectorParameters(Context)` instead when possible, and
`DEFAULT_TRACK_SELECTOR_PARAMETERS_WITHOUT_CONTEXT` otherwise.
### 2.17.0 (2022-02-24) ### 2.17.0 (2022-02-24)
......
...@@ -1516,13 +1516,17 @@ public class DefaultTrackSelector extends MappingTrackSelector { ...@@ -1516,13 +1516,17 @@ public class DefaultTrackSelector extends MappingTrackSelector {
} }
/** /**
* @param parameters Initial {@link Parameters}. * @param parameters Initial {@link TrackSelectionParameters}.
* @param trackSelectionFactory A factory for {@link ExoTrackSelection}s. * @param trackSelectionFactory A factory for {@link ExoTrackSelection}s.
*/ */
public DefaultTrackSelector( public DefaultTrackSelector(
Parameters parameters, ExoTrackSelection.Factory trackSelectionFactory) { TrackSelectionParameters parameters, ExoTrackSelection.Factory trackSelectionFactory) {
this.trackSelectionFactory = trackSelectionFactory; this.trackSelectionFactory = trackSelectionFactory;
parametersReference = new AtomicReference<>(parameters); parametersReference =
new AtomicReference<>(
parameters instanceof Parameters
? (Parameters) parameters
: Parameters.DEFAULT_WITHOUT_CONTEXT.buildUpon().set(parameters).build());
} }
@Override @Override
......
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