Rename DEFAULT_WITHOUT_VIEWPORT to DEFAULT_WITHOUT_CONTEXT.

PiperOrigin-RevId: 270227069
This commit is contained in:
tonihei 2019-09-20 10:29:47 +01:00 committed by Toni
parent 852c3a53e7
commit 531c5638a2
2 changed files with 50 additions and 18 deletions

View File

@ -83,17 +83,32 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
*/
public final class DownloadHelper {
/** Default track selection parameters for downloading, but without any viewport constraints. */
public static final Parameters DEFAULT_TRACK_SELECTOR_PARAMETERS_WITHOUT_VIEWPORT =
Parameters.DEFAULT_WITHOUT_VIEWPORT.buildUpon().setForceHighestSupportedBitrate(true).build();
/**
* Default track selection parameters for downloading, but without any {@link Context}
* constraints.
*
* <p>If possible, use {@link #getDefaultTrackSelectorParameters(Context)} instead.
*
* @see DefaultTrackSelector.Parameters#DEFAULT_WITHOUT_CONTEXT
*/
public static final Parameters DEFAULT_TRACK_SELECTOR_PARAMETERS_WITHOUT_CONTEXT =
Parameters.DEFAULT_WITHOUT_CONTEXT.buildUpon().setForceHighestSupportedBitrate(true).build();
/**
* @deprecated This instance does not have viewport constraints configured for the primary
* display. Use {@link #getDefaultTrackSelectorParameters(Context)} instead.
* @deprecated This instance does not have {@link Context} constraints. Use {@link
* #getDefaultTrackSelectorParameters(Context)} instead.
*/
@Deprecated
public static final Parameters DEFAULT_TRACK_SELECTOR_PARAMETERS_WITHOUT_VIEWPORT =
DEFAULT_TRACK_SELECTOR_PARAMETERS_WITHOUT_CONTEXT;
/**
* @deprecated This instance does not have {@link Context} constraints. Use {@link
* #getDefaultTrackSelectorParameters(Context)} instead.
*/
@Deprecated
public static final DefaultTrackSelector.Parameters DEFAULT_TRACK_SELECTOR_PARAMETERS =
DEFAULT_TRACK_SELECTOR_PARAMETERS_WITHOUT_VIEWPORT;
DEFAULT_TRACK_SELECTOR_PARAMETERS_WITHOUT_CONTEXT;
/** Returns the default parameters used for track selection for downloading. */
public static DefaultTrackSelector.Parameters getDefaultTrackSelectorParameters(Context context) {
@ -606,7 +621,7 @@ public final class DownloadHelper {
assertPreparedWithMedia();
for (int periodIndex = 0; periodIndex < mappedTrackInfos.length; periodIndex++) {
DefaultTrackSelector.ParametersBuilder parametersBuilder =
DEFAULT_TRACK_SELECTOR_PARAMETERS.buildUpon();
DEFAULT_TRACK_SELECTOR_PARAMETERS_WITHOUT_CONTEXT.buildUpon();
MappedTrackInfo mappedTrackInfo = mappedTrackInfos[periodIndex];
int rendererCount = mappedTrackInfo.getRendererCount();
for (int rendererIndex = 0; rendererIndex < rendererCount; rendererIndex++) {
@ -636,7 +651,7 @@ public final class DownloadHelper {
assertPreparedWithMedia();
for (int periodIndex = 0; periodIndex < mappedTrackInfos.length; periodIndex++) {
DefaultTrackSelector.ParametersBuilder parametersBuilder =
DEFAULT_TRACK_SELECTOR_PARAMETERS.buildUpon();
DEFAULT_TRACK_SELECTOR_PARAMETERS_WITHOUT_CONTEXT.buildUpon();
MappedTrackInfo mappedTrackInfo = mappedTrackInfos[periodIndex];
int rendererCount = mappedTrackInfo.getRendererCount();
for (int rendererIndex = 0; rendererIndex < rendererCount; rendererIndex++) {

View File

@ -187,12 +187,12 @@ public class DefaultTrackSelector extends MappingTrackSelector {
private final SparseBooleanArray rendererDisabledFlags;
/**
* @deprecated Initial viewport constraints will not be set based on the primary display when
* using this constructor. Use {@link #ParametersBuilder(Context)} instead.
* @deprecated {@link Context} constraints will not be set using this constructor. Use {@link
* #ParametersBuilder(Context)} instead.
*/
@Deprecated
public ParametersBuilder() {
this(Parameters.DEFAULT_WITHOUT_VIEWPORT);
this(Parameters.DEFAULT_WITHOUT_CONTEXT);
}
/**
@ -747,18 +747,35 @@ public class DefaultTrackSelector extends MappingTrackSelector {
*/
public static final class Parameters extends TrackSelectionParameters {
/** An instance with default values, except without any viewport constraints. */
public static final Parameters DEFAULT_WITHOUT_VIEWPORT = new Parameters();
/**
* An instance with default values, except those obtained from the {@link Context}.
*
* <p>If possible, use {@link #getDefaults(Context)} instead.
*
* <p>This instance will not have the following settings:
*
* <ul>
* <li>{@link ParametersBuilder#setViewportSizeToPhysicalDisplaySize(Context, boolean)
* Viewport constraints} configured for the primary display.
* </ul>
*/
public static final Parameters DEFAULT_WITHOUT_CONTEXT = new Parameters();
/**
* @deprecated This instance does not have viewport constraints configured for the primary
* display. Use {@link #getDefaults(Context)} instead.
* @deprecated This instance does not have {@link Context} constraints configured. Use {@link
* #getDefaults(Context)} instead.
*/
@Deprecated public static final Parameters DEFAULT = DEFAULT_WITHOUT_VIEWPORT;
@Deprecated public static final Parameters DEFAULT_WITHOUT_VIEWPORT = DEFAULT_WITHOUT_CONTEXT;
/**
* @deprecated This instance does not have {@link Context} constraints configured. Use {@link
* #getDefaults(Context)} instead.
*/
@Deprecated public static final Parameters DEFAULT = DEFAULT_WITHOUT_CONTEXT;
/** Returns an instance configured with default values. */
public static Parameters getDefaults(Context context) {
return DEFAULT_WITHOUT_VIEWPORT
return DEFAULT_WITHOUT_CONTEXT
.buildUpon()
.setViewportSizeToPhysicalDisplaySize(context, /* viewportOrientationMayChange= */ true)
.build();
@ -1429,7 +1446,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
/** @deprecated Use {@link #DefaultTrackSelector(Context, TrackSelection.Factory)}. */
@Deprecated
public DefaultTrackSelector(TrackSelection.Factory trackSelectionFactory) {
this(Parameters.DEFAULT_WITHOUT_VIEWPORT, trackSelectionFactory);
this(Parameters.DEFAULT_WITHOUT_CONTEXT, trackSelectionFactory);
}
/** @param context Any {@link Context}. */