Commit 28697b9b by ibaker Committed by kim-vde

Fix DefaultTrackSelector docs on select*Track methods

formatSupport is a 2-dimensional int array but it's documented as
being indexed by 3 things. This seems to be a copy-paste mistake in
https://github.com/google/ExoPlayer/commit/e97b8347eb190f12191c5b97d1c086326387f9bb

selectAllTracks() takes a 3-dimensional array with the same
3-indexed documentation, which makes sense there.

Also rename formatSupports -> formatSupport for consistency.

PiperOrigin-RevId: 325779435
parent 16d54f5e
...@@ -1776,8 +1776,8 @@ public class DefaultTrackSelector extends MappingTrackSelector { ...@@ -1776,8 +1776,8 @@ public class DefaultTrackSelector extends MappingTrackSelector {
* {@link TrackSelection} for a video renderer. * {@link TrackSelection} for a video renderer.
* *
* @param groups The {@link TrackGroupArray} mapped to the renderer. * @param groups The {@link TrackGroupArray} mapped to the renderer.
* @param formatSupports The {@link Capabilities} for each mapped track, indexed by renderer, * @param formatSupport The {@link Capabilities} for each mapped track, indexed by track group and
* track group and track (in that order). * track (in that order).
* @param mixedMimeTypeAdaptationSupports The {@link AdaptiveSupport} for mixed MIME type * @param mixedMimeTypeAdaptationSupports The {@link AdaptiveSupport} for mixed MIME type
* adaptation for the renderer. * adaptation for the renderer.
* @param params The selector's current constraint parameters. * @param params The selector's current constraint parameters.
...@@ -1789,7 +1789,7 @@ public class DefaultTrackSelector extends MappingTrackSelector { ...@@ -1789,7 +1789,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
@Nullable @Nullable
protected TrackSelection.Definition selectVideoTrack( protected TrackSelection.Definition selectVideoTrack(
TrackGroupArray groups, TrackGroupArray groups,
@Capabilities int[][] formatSupports, @Capabilities int[][] formatSupport,
@AdaptiveSupport int mixedMimeTypeAdaptationSupports, @AdaptiveSupport int mixedMimeTypeAdaptationSupports,
Parameters params, Parameters params,
boolean enableAdaptiveTrackSelection) boolean enableAdaptiveTrackSelection)
...@@ -1799,10 +1799,10 @@ public class DefaultTrackSelector extends MappingTrackSelector { ...@@ -1799,10 +1799,10 @@ public class DefaultTrackSelector extends MappingTrackSelector {
&& !params.forceLowestBitrate && !params.forceLowestBitrate
&& enableAdaptiveTrackSelection) { && enableAdaptiveTrackSelection) {
definition = definition =
selectAdaptiveVideoTrack(groups, formatSupports, mixedMimeTypeAdaptationSupports, params); selectAdaptiveVideoTrack(groups, formatSupport, mixedMimeTypeAdaptationSupports, params);
} }
if (definition == null) { if (definition == null) {
definition = selectFixedVideoTrack(groups, formatSupports, params); definition = selectFixedVideoTrack(groups, formatSupport, params);
} }
return definition; return definition;
} }
...@@ -2025,7 +2025,7 @@ public class DefaultTrackSelector extends MappingTrackSelector { ...@@ -2025,7 +2025,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
@Nullable @Nullable
private static TrackSelection.Definition selectFixedVideoTrack( private static TrackSelection.Definition selectFixedVideoTrack(
TrackGroupArray groups, @Capabilities int[][] formatSupports, Parameters params) { TrackGroupArray groups, @Capabilities int[][] formatSupport, Parameters params) {
int selectedTrackIndex = C.INDEX_UNSET; int selectedTrackIndex = C.INDEX_UNSET;
@Nullable TrackGroup selectedGroup = null; @Nullable TrackGroup selectedGroup = null;
@Nullable VideoTrackScore selectedTrackScore = null; @Nullable VideoTrackScore selectedTrackScore = null;
...@@ -2037,7 +2037,7 @@ public class DefaultTrackSelector extends MappingTrackSelector { ...@@ -2037,7 +2037,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
params.viewportWidth, params.viewportWidth,
params.viewportHeight, params.viewportHeight,
params.viewportOrientationMayChange); params.viewportOrientationMayChange);
@Capabilities int[] trackFormatSupport = formatSupports[groupIndex]; @Capabilities int[] trackFormatSupport = formatSupport[groupIndex];
for (int trackIndex = 0; trackIndex < trackGroup.length; trackIndex++) { for (int trackIndex = 0; trackIndex < trackGroup.length; trackIndex++) {
Format format = trackGroup.getFormat(trackIndex); Format format = trackGroup.getFormat(trackIndex);
if ((format.roleFlags & C.ROLE_FLAG_TRICK_PLAY) != 0) { if ((format.roleFlags & C.ROLE_FLAG_TRICK_PLAY) != 0) {
...@@ -2077,8 +2077,8 @@ public class DefaultTrackSelector extends MappingTrackSelector { ...@@ -2077,8 +2077,8 @@ public class DefaultTrackSelector extends MappingTrackSelector {
* {@link TrackSelection} for an audio renderer. * {@link TrackSelection} for an audio renderer.
* *
* @param groups The {@link TrackGroupArray} mapped to the renderer. * @param groups The {@link TrackGroupArray} mapped to the renderer.
* @param formatSupports The {@link Capabilities} for each mapped track, indexed by renderer, * @param formatSupport The {@link Capabilities} for each mapped track, indexed by track group and
* track group and track (in that order). * track (in that order).
* @param mixedMimeTypeAdaptationSupports The {@link AdaptiveSupport} for mixed MIME type * @param mixedMimeTypeAdaptationSupports The {@link AdaptiveSupport} for mixed MIME type
* adaptation for the renderer. * adaptation for the renderer.
* @param params The selector's current constraint parameters. * @param params The selector's current constraint parameters.
...@@ -2091,7 +2091,7 @@ public class DefaultTrackSelector extends MappingTrackSelector { ...@@ -2091,7 +2091,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
@Nullable @Nullable
protected Pair<TrackSelection.Definition, AudioTrackScore> selectAudioTrack( protected Pair<TrackSelection.Definition, AudioTrackScore> selectAudioTrack(
TrackGroupArray groups, TrackGroupArray groups,
@Capabilities int[][] formatSupports, @Capabilities int[][] formatSupport,
@AdaptiveSupport int mixedMimeTypeAdaptationSupports, @AdaptiveSupport int mixedMimeTypeAdaptationSupports,
Parameters params, Parameters params,
boolean enableAdaptiveTrackSelection) boolean enableAdaptiveTrackSelection)
...@@ -2101,7 +2101,7 @@ public class DefaultTrackSelector extends MappingTrackSelector { ...@@ -2101,7 +2101,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
@Nullable AudioTrackScore selectedTrackScore = null; @Nullable AudioTrackScore selectedTrackScore = null;
for (int groupIndex = 0; groupIndex < groups.length; groupIndex++) { for (int groupIndex = 0; groupIndex < groups.length; groupIndex++) {
TrackGroup trackGroup = groups.get(groupIndex); TrackGroup trackGroup = groups.get(groupIndex);
@Capabilities int[] trackFormatSupport = formatSupports[groupIndex]; @Capabilities int[] trackFormatSupport = formatSupport[groupIndex];
for (int trackIndex = 0; trackIndex < trackGroup.length; trackIndex++) { for (int trackIndex = 0; trackIndex < trackGroup.length; trackIndex++) {
if (isSupported(trackFormatSupport[trackIndex], if (isSupported(trackFormatSupport[trackIndex],
params.exceedRendererCapabilitiesIfNecessary)) { params.exceedRendererCapabilitiesIfNecessary)) {
...@@ -2135,7 +2135,7 @@ public class DefaultTrackSelector extends MappingTrackSelector { ...@@ -2135,7 +2135,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
int[] adaptiveTracks = int[] adaptiveTracks =
getAdaptiveAudioTracks( getAdaptiveAudioTracks(
selectedGroup, selectedGroup,
formatSupports[selectedGroupIndex], formatSupport[selectedGroupIndex],
selectedTrackIndex, selectedTrackIndex,
params.maxAudioBitrate, params.maxAudioBitrate,
params.allowAudioMixedMimeTypeAdaptiveness, params.allowAudioMixedMimeTypeAdaptiveness,
...@@ -2208,8 +2208,8 @@ public class DefaultTrackSelector extends MappingTrackSelector { ...@@ -2208,8 +2208,8 @@ public class DefaultTrackSelector extends MappingTrackSelector {
* {@link TrackSelection} for a text renderer. * {@link TrackSelection} for a text renderer.
* *
* @param groups The {@link TrackGroupArray} mapped to the renderer. * @param groups The {@link TrackGroupArray} mapped to the renderer.
* @param formatSupport The {@link Capabilities} for each mapped track, indexed by renderer, track * @param formatSupport The {@link Capabilities} for each mapped track, indexed by track group and
* group and track (in that order). * track (in that order).
* @param params The selector's current constraint parameters. * @param params The selector's current constraint parameters.
* @param selectedAudioLanguage The language of the selected audio track. May be null if the * @param selectedAudioLanguage The language of the selected audio track. May be null if the
* selected text track declares no language or no text track was selected. * selected text track declares no language or no text track was selected.
...@@ -2261,8 +2261,8 @@ public class DefaultTrackSelector extends MappingTrackSelector { ...@@ -2261,8 +2261,8 @@ public class DefaultTrackSelector extends MappingTrackSelector {
* *
* @param trackType The type of the renderer. * @param trackType The type of the renderer.
* @param groups The {@link TrackGroupArray} mapped to the renderer. * @param groups The {@link TrackGroupArray} mapped to the renderer.
* @param formatSupport The {@link Capabilities} for each mapped track, indexed by renderer, track * @param formatSupport The {@link Capabilities} for each mapped track, indexed by track group and
* group and track (in that order). * track (in that order).
* @param params The selector's current constraint parameters. * @param params The selector's current constraint parameters.
* @return The {@link TrackSelection} for the renderer, or null if no selection was made. * @return The {@link TrackSelection} for the renderer, or null if no selection was made.
* @throws ExoPlaybackException If an error occurs while selecting the tracks. * @throws ExoPlaybackException If an error occurs while selecting the tracks.
...@@ -2362,21 +2362,21 @@ public class DefaultTrackSelector extends MappingTrackSelector { ...@@ -2362,21 +2362,21 @@ public class DefaultTrackSelector extends MappingTrackSelector {
/** /**
* Returns whether a renderer supports tunneling for a {@link TrackSelection}. * Returns whether a renderer supports tunneling for a {@link TrackSelection}.
* *
* @param formatSupports The {@link Capabilities} for each track, indexed by group index and track * @param formatSupport The {@link Capabilities} for each track, indexed by group index and track
* index (in that order). * index (in that order).
* @param trackGroups The {@link TrackGroupArray}s for the renderer. * @param trackGroups The {@link TrackGroupArray}s for the renderer.
* @param selection The track selection. * @param selection The track selection.
* @return Whether the renderer supports tunneling for the {@link TrackSelection}. * @return Whether the renderer supports tunneling for the {@link TrackSelection}.
*/ */
private static boolean rendererSupportsTunneling( private static boolean rendererSupportsTunneling(
@Capabilities int[][] formatSupports, TrackGroupArray trackGroups, TrackSelection selection) { @Capabilities int[][] formatSupport, TrackGroupArray trackGroups, TrackSelection selection) {
if (selection == null) { if (selection == null) {
return false; return false;
} }
int trackGroupIndex = trackGroups.indexOf(selection.getTrackGroup()); int trackGroupIndex = trackGroups.indexOf(selection.getTrackGroup());
for (int i = 0; i < selection.length(); i++) { for (int i = 0; i < selection.length(); i++) {
@Capabilities @Capabilities
int trackFormatSupport = formatSupports[trackGroupIndex][selection.getIndexInTrackGroup(i)]; int trackFormatSupport = formatSupport[trackGroupIndex][selection.getIndexInTrackGroup(i)];
if (RendererCapabilities.getTunnelingSupport(trackFormatSupport) if (RendererCapabilities.getTunnelingSupport(trackFormatSupport)
!= RendererCapabilities.TUNNELING_SUPPORTED) { != RendererCapabilities.TUNNELING_SUPPORTED) {
return false; return false;
......
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