diff --git a/library/core/src/main/java/com/google/android/exoplayer2/trackselection/DefaultTrackSelector.java b/library/core/src/main/java/com/google/android/exoplayer2/trackselection/DefaultTrackSelector.java index 006c281ec7..762e0a98b4 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/trackselection/DefaultTrackSelector.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/trackselection/DefaultTrackSelector.java @@ -249,8 +249,10 @@ public class DefaultTrackSelector extends MappingTrackSelector { } /** - * See {@link Parameters#maxVideoWidth} and {@link Parameters#maxVideoHeight}. + * Sets the maximum allowed video width and height. * + * @param maxVideoWidth Maximum allowed video width in pixels. + * @param maxVideoHeight Maximum allowed video height in pixels. * @return This builder. */ public ParametersBuilder setMaxVideoSize(int maxVideoWidth, int maxVideoHeight) { @@ -260,8 +262,9 @@ public class DefaultTrackSelector extends MappingTrackSelector { } /** - * See {@link Parameters#maxVideoFrameRate}. + * Sets the maximum allowed video frame rate. * + * @param maxVideoFrameRate Maximum allowed video frame rate in hertz. * @return This builder. */ public ParametersBuilder setMaxVideoFrameRate(int maxVideoFrameRate) { @@ -270,8 +273,9 @@ public class DefaultTrackSelector extends MappingTrackSelector { } /** - * See {@link Parameters#maxVideoBitrate}. + * Sets the maximum allowed video bitrate. * + * @param maxVideoBitrate Maximum allowed video bitrate in bits per second. * @return This builder. */ public ParametersBuilder setMaxVideoBitrate(int maxVideoBitrate) { @@ -280,8 +284,11 @@ public class DefaultTrackSelector extends MappingTrackSelector { } /** - * See {@link Parameters#exceedVideoConstraintsIfNecessary}. + * Sets whether to exceed the {@link #setMaxVideoSize(int, int)} and {@link + * #setMaxAudioBitrate(int)} constraints when no selection can be made otherwise. * + * @param exceedVideoConstraintsIfNecessary Whether to exceed video constraints when no + * selection can be made otherwise. * @return This builder. */ public ParametersBuilder setExceedVideoConstraintsIfNecessary( @@ -291,8 +298,14 @@ public class DefaultTrackSelector extends MappingTrackSelector { } /** - * See {@link Parameters#allowVideoMixedMimeTypeAdaptiveness}. + * Sets whether to allow adaptive video selections containing mixed MIME types. * + *
Adaptations between different MIME types may not be completely seamless, in which case + * {@link #setAllowVideoNonSeamlessAdaptiveness(boolean)} also needs to be {@code true} for + * mixed MIME type selections to be made. + * + * @param allowVideoMixedMimeTypeAdaptiveness Whether to allow adaptive video selections + * containing mixed MIME types. * @return This builder. */ public ParametersBuilder setAllowVideoMixedMimeTypeAdaptiveness( @@ -302,8 +315,11 @@ public class DefaultTrackSelector extends MappingTrackSelector { } /** - * See {@link Parameters#allowVideoNonSeamlessAdaptiveness}. + * Sets whether to allow adaptive video selections where adaptation may not be completely + * seamless. * + * @param allowVideoNonSeamlessAdaptiveness Whether to allow adaptive video selections where + * adaptation may not be completely seamless. * @return This builder. */ public ParametersBuilder setAllowVideoNonSeamlessAdaptiveness( @@ -317,7 +333,8 @@ public class DefaultTrackSelector extends MappingTrackSelector { * obtained from {@link Util#getPhysicalDisplaySize(Context)}. * * @param context Any context. - * @param viewportOrientationMayChange See {@link Parameters#viewportOrientationMayChange}. + * @param viewportOrientationMayChange Whether the viewport orientation may change during + * playback. * @return This builder. */ public ParametersBuilder setViewportSizeToPhysicalDisplaySize( @@ -338,12 +355,13 @@ public class DefaultTrackSelector extends MappingTrackSelector { } /** - * See {@link Parameters#viewportWidth}, {@link Parameters#maxVideoHeight} and {@link - * Parameters#viewportOrientationMayChange}. + * Sets the viewport size to constrain adaptive video selections so that only tracks suitable + * for the viewport are selected. * - * @param viewportWidth See {@link Parameters#viewportWidth}. - * @param viewportHeight See {@link Parameters#viewportHeight}. - * @param viewportOrientationMayChange See {@link Parameters#viewportOrientationMayChange}. + * @param viewportWidth Viewport width in pixels. + * @param viewportHeight Viewport height in pixels. + * @param viewportOrientationMayChange Whether the viewport orientation may change during + * playback. * @return This builder. */ public ParametersBuilder setViewportSize( @@ -363,8 +381,9 @@ public class DefaultTrackSelector extends MappingTrackSelector { } /** - * See {@link Parameters#maxAudioChannelCount}. + * Sets the maximum allowed audio channel count. * + * @param maxAudioChannelCount Maximum allowed audio channel count. * @return This builder. */ public ParametersBuilder setMaxAudioChannelCount(int maxAudioChannelCount) { @@ -373,8 +392,9 @@ public class DefaultTrackSelector extends MappingTrackSelector { } /** - * See {@link Parameters#maxAudioBitrate}. + * Sets the maximum allowed audio bitrate. * + * @param maxAudioBitrate Maximum allowed audio bitrate in bits per second. * @return This builder. */ public ParametersBuilder setMaxAudioBitrate(int maxAudioBitrate) { @@ -383,8 +403,11 @@ public class DefaultTrackSelector extends MappingTrackSelector { } /** - * See {@link Parameters#exceedAudioConstraintsIfNecessary}. + * Sets whether to exceed the {@link #setMaxAudioChannelCount(int)} and {@link + * #setMaxAudioBitrate(int)} constraints when no selection can be made otherwise. * + * @param exceedAudioConstraintsIfNecessary Whether to exceed audio constraints when no + * selection can be made otherwise. * @return This builder. */ public ParametersBuilder setExceedAudioConstraintsIfNecessary( @@ -394,8 +417,12 @@ public class DefaultTrackSelector extends MappingTrackSelector { } /** - * See {@link Parameters#allowAudioMixedMimeTypeAdaptiveness}. + * Sets whether to allow adaptive audio selections containing mixed MIME types. * + *
Adaptations between different MIME types may not be completely seamless. + * + * @param allowAudioMixedMimeTypeAdaptiveness Whether to allow adaptive audio selections + * containing mixed MIME types. * @return This builder. */ public ParametersBuilder setAllowAudioMixedMimeTypeAdaptiveness( @@ -405,8 +432,12 @@ public class DefaultTrackSelector extends MappingTrackSelector { } /** - * See {@link Parameters#allowAudioMixedSampleRateAdaptiveness}. + * Sets whether to allow adaptive audio selections containing mixed sample rates. * + *
Adaptations between different sample rates may not be completely seamless. + * + * @param allowAudioMixedSampleRateAdaptiveness Whether to allow adaptive audio selections + * containing mixed sample rates. * @return This builder. */ public ParametersBuilder setAllowAudioMixedSampleRateAdaptiveness( @@ -416,8 +447,12 @@ public class DefaultTrackSelector extends MappingTrackSelector { } /** - * See {@link Parameters#allowAudioMixedChannelCountAdaptiveness}. + * Sets whether to allow adaptive audio selections containing mixed channel counts. * + *
Adaptations between different channel counts may not be completely seamless. + * + * @param allowAudioMixedChannelCountAdaptiveness Whether to allow adaptive audio selections + * containing mixed channel counts. * @return This builder. */ public ParametersBuilder setAllowAudioMixedChannelCountAdaptiveness( @@ -450,8 +485,11 @@ public class DefaultTrackSelector extends MappingTrackSelector { // General /** - * See {@link Parameters#forceLowestBitrate}. + * Sets whether to force selection of the single lowest bitrate audio and video tracks that + * comply with all other constraints. * + * @param forceLowestBitrate Whether to force selection of the single lowest bitrate audio and + * video tracks. * @return This builder. */ public ParametersBuilder setForceLowestBitrate(boolean forceLowestBitrate) { @@ -460,8 +498,11 @@ public class DefaultTrackSelector extends MappingTrackSelector { } /** - * See {@link Parameters#forceHighestSupportedBitrate}. + * Sets whether to force selection of the highest bitrate audio and video tracks that comply + * with all other constraints. * + * @param forceHighestSupportedBitrate Whether to force selection of the highest bitrate audio + * and video tracks. * @return This builder. */ public ParametersBuilder setForceHighestSupportedBitrate(boolean forceHighestSupportedBitrate) { @@ -487,8 +528,15 @@ public class DefaultTrackSelector extends MappingTrackSelector { } /** - * See {@link Parameters#exceedRendererCapabilitiesIfNecessary}. + * Sets whether to exceed renderer capabilities when no selection can be made otherwise. * + *
This parameter applies when all of the tracks available for a renderer exceed the + * renderer's reported capabilities. If the parameter is {@code true} then the lowest quality + * track will still be selected. Playback may succeed if the renderer has under-reported its + * true capabilities. If {@code false} then no track will be selected. + * + * @param exceedRendererCapabilitiesIfNecessary Whether to exceed renderer capabilities when no + * selection can be made otherwise. * @return This builder. */ public ParametersBuilder setExceedRendererCapabilitiesIfNecessary( @@ -498,7 +546,7 @@ public class DefaultTrackSelector extends MappingTrackSelector { } /** - * See {@link Parameters#tunnelingAudioSessionId}. + * Sets the audio session id to use when tunneling. * *
Enables or disables tunneling. To enable tunneling, pass an audio session id to use when
* in tunneling mode. Session ids can be generated using {@link
@@ -508,6 +556,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
*
* @param tunnelingAudioSessionId The audio session id to use when tunneling, or {@link
* C#AUDIO_SESSION_ID_UNSET} to disable tunneling.
+ * @return This builder.
*/
public ParametersBuilder setTunnelingAudioSessionId(int tunnelingAudioSessionId) {
this.tunnelingAudioSessionId = tunnelingAudioSessionId;
@@ -522,6 +571,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
*
* @param rendererIndex The renderer index.
* @param disabled Whether the renderer is disabled.
+ * @return This builder.
*/
public final ParametersBuilder setRendererDisabled(int rendererIndex, boolean disabled) {
if (rendererDisabledFlags.get(rendererIndex) == disabled) {
@@ -558,6 +608,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
* @param rendererIndex The renderer index.
* @param groups The {@link TrackGroupArray} for which the override should be applied.
* @param override The override.
+ * @return This builder.
*/
public final ParametersBuilder setSelectionOverride(
int rendererIndex, TrackGroupArray groups, SelectionOverride override) {
@@ -579,6 +630,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
*
* @param rendererIndex The renderer index.
* @param groups The {@link TrackGroupArray} for which the override should be cleared.
+ * @return This builder.
*/
public final ParametersBuilder clearSelectionOverride(
int rendererIndex, TrackGroupArray groups) {
@@ -598,6 +650,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
* Clears all track selection overrides for the specified renderer.
*
* @param rendererIndex The renderer index.
+ * @return This builder.
*/
public final ParametersBuilder clearSelectionOverrides(int rendererIndex) {
Map To constrain adaptive video track selections to be suitable for a given viewport (the
* region of the display within which video will be played), use ({@link #viewportWidth}, {@link
@@ -686,8 +743,8 @@ public class DefaultTrackSelector extends MappingTrackSelector {
*/
public final int maxVideoWidth;
/**
- * Maximum allowed video height. The default value is {@link Integer#MAX_VALUE} (i.e. no
- * constraint).
+ * Maximum allowed video height in pixels. The default value is {@link Integer#MAX_VALUE} (i.e.
+ * no constraint).
*
* To constrain adaptive video track selections to be suitable for a given viewport (the
* region of the display within which video will be played), use ({@link #viewportWidth}, {@link
@@ -695,12 +752,13 @@ public class DefaultTrackSelector extends MappingTrackSelector {
*/
public final int maxVideoHeight;
/**
- * Maximum allowed video frame rate. The default value is {@link Integer#MAX_VALUE} (i.e. no
- * constraint).
+ * Maximum allowed video frame rate in hertz. The default value is {@link Integer#MAX_VALUE}
+ * (i.e. no constraint).
*/
public final int maxVideoFrameRate;
/**
- * Maximum video bitrate. The default value is {@link Integer#MAX_VALUE} (i.e. no constraint).
+ * Maximum allowed video bitrate in bits per second. The default value is {@link
+ * Integer#MAX_VALUE} (i.e. no constraint).
*/
public final int maxVideoBitrate;
/**
@@ -710,9 +768,9 @@ public class DefaultTrackSelector extends MappingTrackSelector {
*/
public final boolean exceedVideoConstraintsIfNecessary;
/**
- * Whether to allow adaptive video selections containing mixed mime types. Adaptations between
- * different mime types may not be completely seamless, in which case {@link
- * #allowVideoNonSeamlessAdaptiveness} also needs to be {@code true} for mixed mime type
+ * Whether to allow adaptive video selections containing mixed MIME types. Adaptations between
+ * different MIME types may not be completely seamless, in which case {@link
+ * #allowVideoNonSeamlessAdaptiveness} also needs to be {@code true} for mixed MIME type
* selections to be made. The default value is {@code false}.
*/
public final boolean allowVideoMixedMimeTypeAdaptiveness;
@@ -746,7 +804,8 @@ public class DefaultTrackSelector extends MappingTrackSelector {
*/
public final int maxAudioChannelCount;
/**
- * Maximum audio bitrate. The default value is {@link Integer#MAX_VALUE} (i.e. no constraint).
+ * Maximum allowed audio bitrate in bits per second. The default value is {@link
+ * Integer#MAX_VALUE} (i.e. no constraint).
*/
public final int maxAudioBitrate;
/**
@@ -755,8 +814,8 @@ public class DefaultTrackSelector extends MappingTrackSelector {
*/
public final boolean exceedAudioConstraintsIfNecessary;
/**
- * Whether to allow adaptive audio selections containing mixed mime types. Adaptations between
- * different mime types may not be completely seamless. The default value is {@code false}.
+ * Whether to allow adaptive audio selections containing mixed MIME types. Adaptations between
+ * different MIME types may not be completely seamless. The default value is {@code false}.
*/
public final boolean allowAudioMixedMimeTypeAdaptiveness;
/**
diff --git a/library/core/src/main/java/com/google/android/exoplayer2/trackselection/TrackSelectionParameters.java b/library/core/src/main/java/com/google/android/exoplayer2/trackselection/TrackSelectionParameters.java
index 66a4707496..f10b2befaf 100644
--- a/library/core/src/main/java/com/google/android/exoplayer2/trackselection/TrackSelectionParameters.java
+++ b/library/core/src/main/java/com/google/android/exoplayer2/trackselection/TrackSelectionParameters.java
@@ -57,9 +57,10 @@ public class TrackSelectionParameters implements Parcelable {
}
/**
- * See {@link TrackSelectionParameters#preferredAudioLanguage}.
+ * Sets the preferred language for audio and forced text tracks.
*
- * @param preferredAudioLanguage Preferred audio language as an IETF BCP 47 conformant tag.
+ * @param preferredAudioLanguage Preferred audio language as an IETF BCP 47 conformant tag, or
+ * {@code null} to select the default track, or the first track if there's no default.
* @return This builder.
*/
public Builder setPreferredAudioLanguage(@Nullable String preferredAudioLanguage) {
@@ -70,9 +71,10 @@ public class TrackSelectionParameters implements Parcelable {
// Text
/**
- * See {@link TrackSelectionParameters#preferredTextLanguage}.
+ * Sets the preferred language for text tracks.
*
- * @param preferredTextLanguage Preferred text language as an IETF BCP 47 conformant tag.
+ * @param preferredTextLanguage Preferred text language as an IETF BCP 47 conformant tag, or
+ * {@code null} to select the default track if there is one, or no track otherwise.
* @return This builder.
*/
public Builder setPreferredTextLanguage(@Nullable String preferredTextLanguage) {
@@ -81,8 +83,12 @@ public class TrackSelectionParameters implements Parcelable {
}
/**
- * See {@link TrackSelectionParameters#selectUndeterminedTextLanguage}.
+ * Sets whether a text track with undetermined language should be selected if no track with
+ * {@link #setPreferredTextLanguage(String)} is available, or if the preferred language is
+ * unset.
*
+ * @param selectUndeterminedTextLanguage Whether a text track with undetermined language should
+ * be selected if no preferred language track is available.
* @return This builder.
*/
public Builder setSelectUndeterminedTextLanguage(boolean selectUndeterminedTextLanguage) {
@@ -91,8 +97,10 @@ public class TrackSelectionParameters implements Parcelable {
}
/**
- * See {@link TrackSelectionParameters#disabledTextTrackSelectionFlags}.
+ * Sets a bitmask of selection flags that are disabled for text track selections.
*
+ * @param disabledTextTrackSelectionFlags A bitmask of {@link C.SelectionFlags} that are
+ * disabled for text track selections.
* @return This builder.
*/
public Builder setDisabledTextTrackSelectionFlags(