mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Sanitize MappedTrackInfo API
Issue: #3915 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=193897041
This commit is contained in:
parent
c116391fe2
commit
d3cdf52591
13 changed files with 266 additions and 195 deletions
|
|
@ -711,11 +711,11 @@ public class PlayerActivity extends Activity
|
||||||
if (trackGroups != lastSeenTrackGroupArray) {
|
if (trackGroups != lastSeenTrackGroupArray) {
|
||||||
MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo();
|
MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo();
|
||||||
if (mappedTrackInfo != null) {
|
if (mappedTrackInfo != null) {
|
||||||
if (mappedTrackInfo.getTrackTypeRendererSupport(C.TRACK_TYPE_VIDEO)
|
if (mappedTrackInfo.getTypeSupport(C.TRACK_TYPE_VIDEO)
|
||||||
== MappedTrackInfo.RENDERER_SUPPORT_UNSUPPORTED_TRACKS) {
|
== MappedTrackInfo.RENDERER_SUPPORT_UNSUPPORTED_TRACKS) {
|
||||||
showToast(R.string.error_unsupported_video);
|
showToast(R.string.error_unsupported_video);
|
||||||
}
|
}
|
||||||
if (mappedTrackInfo.getTrackTypeRendererSupport(C.TRACK_TYPE_AUDIO)
|
if (mappedTrackInfo.getTypeSupport(C.TRACK_TYPE_AUDIO)
|
||||||
== MappedTrackInfo.RENDERER_SUPPORT_UNSUPPORTED_TRACKS) {
|
== MappedTrackInfo.RENDERER_SUPPORT_UNSUPPORTED_TRACKS) {
|
||||||
showToast(R.string.error_unsupported_audio);
|
showToast(R.string.error_unsupported_audio);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ import java.util.Arrays;
|
||||||
trackViewLayoutId, root, false);
|
trackViewLayoutId, root, false);
|
||||||
trackView.setBackgroundResource(selectableItemBackgroundResourceId);
|
trackView.setBackgroundResource(selectableItemBackgroundResourceId);
|
||||||
trackView.setText(DemoUtil.buildTrackName(group.getFormat(trackIndex)));
|
trackView.setText(DemoUtil.buildTrackName(group.getFormat(trackIndex)));
|
||||||
if (trackInfo.getTrackFormatSupport(rendererIndex, groupIndex, trackIndex)
|
if (trackInfo.getTrackSupport(rendererIndex, groupIndex, trackIndex)
|
||||||
== RendererCapabilities.FORMAT_HANDLED) {
|
== RendererCapabilities.FORMAT_HANDLED) {
|
||||||
trackView.setFocusable(true);
|
trackView.setFocusable(true);
|
||||||
trackView.setTag(Pair.create(groupIndex, trackIndex));
|
trackView.setTag(Pair.create(groupIndex, trackIndex));
|
||||||
|
|
|
||||||
|
|
@ -931,11 +931,14 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected final Pair<RendererConfiguration[], TrackSelection[]> selectTracks(
|
protected final Pair<RendererConfiguration[], TrackSelection[]> selectTracks(
|
||||||
RendererCapabilities[] rendererCapabilities, MappedTrackInfo mappedTrackInfo)
|
MappedTrackInfo mappedTrackInfo,
|
||||||
|
int[][][] rendererFormatSupports,
|
||||||
|
int[] rendererMixedMimeTypeAdaptationSupports)
|
||||||
throws ExoPlaybackException {
|
throws ExoPlaybackException {
|
||||||
int rendererCount = rendererCapabilities.length;
|
int rendererCount = mappedTrackInfo.getRendererCount();
|
||||||
TrackSelection[] rendererTrackSelections =
|
TrackSelection[] rendererTrackSelections =
|
||||||
selectAllTracks(rendererCapabilities, mappedTrackInfo);
|
selectAllTracks(
|
||||||
|
mappedTrackInfo, rendererFormatSupports, rendererMixedMimeTypeAdaptationSupports);
|
||||||
|
|
||||||
// Apply track disabling and overriding.
|
// Apply track disabling and overriding.
|
||||||
for (int i = 0; i < rendererCount; i++) {
|
for (int i = 0; i < rendererCount; i++) {
|
||||||
|
|
@ -962,13 +965,12 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||||
|
|
||||||
// Initialize the renderer configurations to the default configuration for all renderers with
|
// Initialize the renderer configurations to the default configuration for all renderers with
|
||||||
// selections, and null otherwise.
|
// selections, and null otherwise.
|
||||||
RendererConfiguration[] rendererConfigurations =
|
RendererConfiguration[] rendererConfigurations = new RendererConfiguration[rendererCount];
|
||||||
new RendererConfiguration[rendererCapabilities.length];
|
|
||||||
for (int i = 0; i < rendererCount; i++) {
|
for (int i = 0; i < rendererCount; i++) {
|
||||||
boolean forceRendererDisabled = rendererDisabledFlags.get(i);
|
boolean forceRendererDisabled = rendererDisabledFlags.get(i);
|
||||||
boolean rendererEnabled =
|
boolean rendererEnabled =
|
||||||
!forceRendererDisabled
|
!forceRendererDisabled
|
||||||
&& (rendererCapabilities[i].getTrackType() == C.TRACK_TYPE_NONE
|
&& (mappedTrackInfo.getRendererType(i) == C.TRACK_TYPE_NONE
|
||||||
|| rendererTrackSelections[i] != null);
|
|| rendererTrackSelections[i] != null);
|
||||||
rendererConfigurations[i] = rendererEnabled ? RendererConfiguration.DEFAULT : null;
|
rendererConfigurations[i] = rendererEnabled ? RendererConfiguration.DEFAULT : null;
|
||||||
}
|
}
|
||||||
|
|
@ -976,7 +978,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||||
// Configure audio and video renderers to use tunneling if appropriate.
|
// Configure audio and video renderers to use tunneling if appropriate.
|
||||||
maybeConfigureRenderersForTunneling(
|
maybeConfigureRenderersForTunneling(
|
||||||
mappedTrackInfo,
|
mappedTrackInfo,
|
||||||
rendererCapabilities,
|
rendererFormatSupports,
|
||||||
rendererConfigurations,
|
rendererConfigurations,
|
||||||
rendererTrackSelections,
|
rendererTrackSelections,
|
||||||
tunnelingAudioSessionId);
|
tunnelingAudioSessionId);
|
||||||
|
|
@ -987,35 +989,40 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||||
// Track selection prior to overrides and disabled flags being applied.
|
// Track selection prior to overrides and disabled flags being applied.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called from {@link #selectTracks(RendererCapabilities[], MappedTrackInfo)} to make a track
|
* Called from {@link #selectTracks(MappedTrackInfo, int[][][], int[])} to make a track selection
|
||||||
* selection for each renderer, prior to overrides and disabled flags being applied.
|
* for each renderer, prior to overrides and disabled flags being applied.
|
||||||
*
|
*
|
||||||
* <p>The implementation should not account for overrides and disabled flags. Track selections
|
* <p>The implementation should not account for overrides and disabled flags. Track selections
|
||||||
* generated by this method will be overridden to account for these properties.
|
* generated by this method will be overridden to account for these properties.
|
||||||
*
|
*
|
||||||
* @param rendererCapabilities The {@link RendererCapabilities} of each renderer.
|
|
||||||
* @param mappedTrackInfo Mapped track information.
|
* @param mappedTrackInfo Mapped track information.
|
||||||
|
* @param rendererFormatSupports The result of {@link RendererCapabilities#supportsFormat} for
|
||||||
|
* each mapped track, indexed by renderer, track group and track (in that order).
|
||||||
|
* @param rendererMixedMimeTypeAdaptationSupports The result of {@link
|
||||||
|
* RendererCapabilities#supportsMixedMimeTypeAdaptation()} for each renderer.
|
||||||
* @return Track selections for each renderer. A null selection indicates the renderer should be
|
* @return Track selections for each renderer. A null selection indicates the renderer should be
|
||||||
* disabled, unless RendererCapabilities#getTrackType()} is {@link C#TRACK_TYPE_NONE}.
|
* disabled, unless RendererCapabilities#getTrackType()} is {@link C#TRACK_TYPE_NONE}.
|
||||||
* @throws ExoPlaybackException If an error occurs while selecting the tracks.
|
* @throws ExoPlaybackException If an error occurs while selecting the tracks.
|
||||||
*/
|
*/
|
||||||
protected TrackSelection[] selectAllTracks(
|
protected TrackSelection[] selectAllTracks(
|
||||||
RendererCapabilities[] rendererCapabilities, MappedTrackInfo mappedTrackInfo)
|
MappedTrackInfo mappedTrackInfo,
|
||||||
|
int[][][] rendererFormatSupports,
|
||||||
|
int[] rendererMixedMimeTypeAdaptationSupports)
|
||||||
throws ExoPlaybackException {
|
throws ExoPlaybackException {
|
||||||
int rendererCount = rendererCapabilities.length;
|
int rendererCount = mappedTrackInfo.getRendererCount();
|
||||||
TrackSelection[] rendererTrackSelections = new TrackSelection[rendererCount];
|
TrackSelection[] rendererTrackSelections = new TrackSelection[rendererCount];
|
||||||
Parameters params = paramsReference.get();
|
Parameters params = paramsReference.get();
|
||||||
|
|
||||||
boolean seenVideoRendererWithMappedTracks = false;
|
boolean seenVideoRendererWithMappedTracks = false;
|
||||||
boolean selectedVideoTracks = false;
|
boolean selectedVideoTracks = false;
|
||||||
for (int i = 0; i < rendererCount; i++) {
|
for (int i = 0; i < rendererCount; i++) {
|
||||||
if (C.TRACK_TYPE_VIDEO == rendererCapabilities[i].getTrackType()) {
|
if (C.TRACK_TYPE_VIDEO == mappedTrackInfo.getRendererType(i)) {
|
||||||
if (!selectedVideoTracks) {
|
if (!selectedVideoTracks) {
|
||||||
rendererTrackSelections[i] =
|
rendererTrackSelections[i] =
|
||||||
selectVideoTrack(
|
selectVideoTrack(
|
||||||
rendererCapabilities[i],
|
|
||||||
mappedTrackInfo.getTrackGroups(i),
|
mappedTrackInfo.getTrackGroups(i),
|
||||||
mappedTrackInfo.getRendererTrackSupport(i),
|
rendererFormatSupports[i],
|
||||||
|
rendererMixedMimeTypeAdaptationSupports[i],
|
||||||
params,
|
params,
|
||||||
adaptiveTrackSelectionFactory);
|
adaptiveTrackSelectionFactory);
|
||||||
selectedVideoTracks = rendererTrackSelections[i] != null;
|
selectedVideoTracks = rendererTrackSelections[i] != null;
|
||||||
|
|
@ -1027,7 +1034,8 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||||
boolean selectedAudioTracks = false;
|
boolean selectedAudioTracks = false;
|
||||||
boolean selectedTextTracks = false;
|
boolean selectedTextTracks = false;
|
||||||
for (int i = 0; i < rendererCount; i++) {
|
for (int i = 0; i < rendererCount; i++) {
|
||||||
switch (rendererCapabilities[i].getTrackType()) {
|
int trackType = mappedTrackInfo.getRendererType(i);
|
||||||
|
switch (trackType) {
|
||||||
case C.TRACK_TYPE_VIDEO:
|
case C.TRACK_TYPE_VIDEO:
|
||||||
// Already done. Do nothing.
|
// Already done. Do nothing.
|
||||||
break;
|
break;
|
||||||
|
|
@ -1036,7 +1044,8 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||||
rendererTrackSelections[i] =
|
rendererTrackSelections[i] =
|
||||||
selectAudioTrack(
|
selectAudioTrack(
|
||||||
mappedTrackInfo.getTrackGroups(i),
|
mappedTrackInfo.getTrackGroups(i),
|
||||||
mappedTrackInfo.getRendererTrackSupport(i),
|
rendererFormatSupports[i],
|
||||||
|
rendererMixedMimeTypeAdaptationSupports[i],
|
||||||
params,
|
params,
|
||||||
seenVideoRendererWithMappedTracks ? null : adaptiveTrackSelectionFactory);
|
seenVideoRendererWithMappedTracks ? null : adaptiveTrackSelectionFactory);
|
||||||
selectedAudioTracks = rendererTrackSelections[i] != null;
|
selectedAudioTracks = rendererTrackSelections[i] != null;
|
||||||
|
|
@ -1046,19 +1055,14 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||||
if (!selectedTextTracks) {
|
if (!selectedTextTracks) {
|
||||||
rendererTrackSelections[i] =
|
rendererTrackSelections[i] =
|
||||||
selectTextTrack(
|
selectTextTrack(
|
||||||
mappedTrackInfo.getTrackGroups(i),
|
mappedTrackInfo.getTrackGroups(i), rendererFormatSupports[i], params);
|
||||||
mappedTrackInfo.getRendererTrackSupport(i),
|
|
||||||
params);
|
|
||||||
selectedTextTracks = rendererTrackSelections[i] != null;
|
selectedTextTracks = rendererTrackSelections[i] != null;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
rendererTrackSelections[i] =
|
rendererTrackSelections[i] =
|
||||||
selectOtherTrack(
|
selectOtherTrack(
|
||||||
rendererCapabilities[i].getTrackType(),
|
trackType, mappedTrackInfo.getTrackGroups(i), rendererFormatSupports[i], params);
|
||||||
mappedTrackInfo.getTrackGroups(i),
|
|
||||||
mappedTrackInfo.getRendererTrackSupport(i),
|
|
||||||
params);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1069,13 +1073,14 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||||
// Video track selection implementation.
|
// Video track selection implementation.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by {@link #selectTracks(RendererCapabilities[], MappedTrackInfo)} to create a {@link
|
* Called by {@link #selectAllTracks(MappedTrackInfo, int[][][], int[])} to create a {@link
|
||||||
* TrackSelection} for a video renderer.
|
* TrackSelection} for a video renderer.
|
||||||
*
|
*
|
||||||
* @param rendererCapabilities The {@link RendererCapabilities} for the renderer.
|
|
||||||
* @param groups The {@link TrackGroupArray} mapped to the renderer.
|
* @param groups The {@link TrackGroupArray} mapped to the renderer.
|
||||||
* @param formatSupport The result of {@link RendererCapabilities#supportsFormat} for each mapped
|
* @param formatSupports The result of {@link RendererCapabilities#supportsFormat} for each mapped
|
||||||
* track, indexed by track group index and track index (in that order).
|
* track, indexed by track group index and track index (in that order).
|
||||||
|
* @param mixedMimeTypeAdaptationSupports The result of {@link
|
||||||
|
* RendererCapabilities#supportsMixedMimeTypeAdaptation()} for the renderer.
|
||||||
* @param params The selector's current constraint parameters.
|
* @param params The selector's current constraint parameters.
|
||||||
* @param adaptiveTrackSelectionFactory A factory for generating adaptive track selections, or
|
* @param adaptiveTrackSelectionFactory A factory for generating adaptive track selections, or
|
||||||
* null if a fixed track selection is required.
|
* null if a fixed track selection is required.
|
||||||
|
|
@ -1083,31 +1088,41 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||||
* @throws ExoPlaybackException If an error occurs while selecting the tracks.
|
* @throws ExoPlaybackException If an error occurs while selecting the tracks.
|
||||||
*/
|
*/
|
||||||
protected TrackSelection selectVideoTrack(
|
protected TrackSelection selectVideoTrack(
|
||||||
RendererCapabilities rendererCapabilities,
|
|
||||||
TrackGroupArray groups,
|
TrackGroupArray groups,
|
||||||
int[][] formatSupport,
|
int[][] formatSupports,
|
||||||
|
int mixedMimeTypeAdaptationSupports,
|
||||||
Parameters params,
|
Parameters params,
|
||||||
TrackSelection.Factory adaptiveTrackSelectionFactory)
|
TrackSelection.Factory adaptiveTrackSelectionFactory)
|
||||||
throws ExoPlaybackException {
|
throws ExoPlaybackException {
|
||||||
TrackSelection selection = null;
|
TrackSelection selection = null;
|
||||||
if (!params.forceLowestBitrate && adaptiveTrackSelectionFactory != null) {
|
if (!params.forceLowestBitrate && adaptiveTrackSelectionFactory != null) {
|
||||||
selection = selectAdaptiveVideoTrack(rendererCapabilities, groups, formatSupport,
|
selection =
|
||||||
params, adaptiveTrackSelectionFactory);
|
selectAdaptiveVideoTrack(
|
||||||
|
groups,
|
||||||
|
formatSupports,
|
||||||
|
mixedMimeTypeAdaptationSupports,
|
||||||
|
params,
|
||||||
|
adaptiveTrackSelectionFactory);
|
||||||
}
|
}
|
||||||
if (selection == null) {
|
if (selection == null) {
|
||||||
selection = selectFixedVideoTrack(groups, formatSupport, params);
|
selection = selectFixedVideoTrack(groups, formatSupports, params);
|
||||||
}
|
}
|
||||||
return selection;
|
return selection;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TrackSelection selectAdaptiveVideoTrack(RendererCapabilities rendererCapabilities,
|
private static TrackSelection selectAdaptiveVideoTrack(
|
||||||
TrackGroupArray groups, int[][] formatSupport, Parameters params,
|
TrackGroupArray groups,
|
||||||
TrackSelection.Factory adaptiveTrackSelectionFactory) throws ExoPlaybackException {
|
int[][] formatSupport,
|
||||||
|
int mixedMimeTypeAdaptationSupports,
|
||||||
|
Parameters params,
|
||||||
|
TrackSelection.Factory adaptiveTrackSelectionFactory)
|
||||||
|
throws ExoPlaybackException {
|
||||||
int requiredAdaptiveSupport = params.allowNonSeamlessAdaptiveness
|
int requiredAdaptiveSupport = params.allowNonSeamlessAdaptiveness
|
||||||
? (RendererCapabilities.ADAPTIVE_NOT_SEAMLESS | RendererCapabilities.ADAPTIVE_SEAMLESS)
|
? (RendererCapabilities.ADAPTIVE_NOT_SEAMLESS | RendererCapabilities.ADAPTIVE_SEAMLESS)
|
||||||
: RendererCapabilities.ADAPTIVE_SEAMLESS;
|
: RendererCapabilities.ADAPTIVE_SEAMLESS;
|
||||||
boolean allowMixedMimeTypes = params.allowMixedMimeAdaptiveness
|
boolean allowMixedMimeTypes =
|
||||||
&& (rendererCapabilities.supportsMixedMimeTypeAdaptation() & requiredAdaptiveSupport) != 0;
|
params.allowMixedMimeAdaptiveness
|
||||||
|
&& (mixedMimeTypeAdaptationSupports & requiredAdaptiveSupport) != 0;
|
||||||
for (int i = 0; i < groups.length; i++) {
|
for (int i = 0; i < groups.length; i++) {
|
||||||
TrackGroup group = groups.get(i);
|
TrackGroup group = groups.get(i);
|
||||||
int[] adaptiveTracks = getAdaptiveVideoTracksForGroup(group, formatSupport[i],
|
int[] adaptiveTracks = getAdaptiveVideoTracksForGroup(group, formatSupport[i],
|
||||||
|
|
@ -1200,8 +1215,8 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||||
&& (format.bitrate == Format.NO_VALUE || format.bitrate <= maxVideoBitrate);
|
&& (format.bitrate == Format.NO_VALUE || format.bitrate <= maxVideoBitrate);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TrackSelection selectFixedVideoTrack(TrackGroupArray groups,
|
private static TrackSelection selectFixedVideoTrack(
|
||||||
int[][] formatSupport, Parameters params) {
|
TrackGroupArray groups, int[][] formatSupports, Parameters params) {
|
||||||
TrackGroup selectedGroup = null;
|
TrackGroup selectedGroup = null;
|
||||||
int selectedTrackIndex = 0;
|
int selectedTrackIndex = 0;
|
||||||
int selectedTrackScore = 0;
|
int selectedTrackScore = 0;
|
||||||
|
|
@ -1211,7 +1226,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||||
TrackGroup trackGroup = groups.get(groupIndex);
|
TrackGroup trackGroup = groups.get(groupIndex);
|
||||||
List<Integer> selectedTrackIndices = getViewportFilteredTrackIndices(trackGroup,
|
List<Integer> selectedTrackIndices = getViewportFilteredTrackIndices(trackGroup,
|
||||||
params.viewportWidth, params.viewportHeight, params.viewportOrientationMayChange);
|
params.viewportWidth, params.viewportHeight, params.viewportOrientationMayChange);
|
||||||
int[] trackFormatSupport = formatSupport[groupIndex];
|
int[] trackFormatSupport = formatSupports[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)) {
|
||||||
|
|
@ -1264,12 +1279,14 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||||
// Audio track selection implementation.
|
// Audio track selection implementation.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by {@link #selectTracks(RendererCapabilities[], MappedTrackInfo)} to create a {@link
|
* Called by {@link #selectAllTracks(MappedTrackInfo, int[][][], int[])} to create a {@link
|
||||||
* TrackSelection} for an audio renderer.
|
* TrackSelection} for an audio renderer.
|
||||||
*
|
*
|
||||||
* @param groups The {@link TrackGroupArray} mapped to the renderer.
|
* @param groups The {@link TrackGroupArray} mapped to the renderer.
|
||||||
* @param formatSupport The result of {@link RendererCapabilities#supportsFormat} for each mapped
|
* @param formatSupports The result of {@link RendererCapabilities#supportsFormat} for each mapped
|
||||||
* track, indexed by track group index and track index (in that order).
|
* track, indexed by track group index and track index (in that order).
|
||||||
|
* @param mixedMimeTypeAdaptationSupports The result of {@link
|
||||||
|
* RendererCapabilities#supportsMixedMimeTypeAdaptation()} for the renderer.
|
||||||
* @param params The selector's current constraint parameters.
|
* @param params The selector's current constraint parameters.
|
||||||
* @param adaptiveTrackSelectionFactory A factory for generating adaptive track selections, or
|
* @param adaptiveTrackSelectionFactory A factory for generating adaptive track selections, or
|
||||||
* null if a fixed track selection is required.
|
* null if a fixed track selection is required.
|
||||||
|
|
@ -1278,7 +1295,8 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||||
*/
|
*/
|
||||||
protected TrackSelection selectAudioTrack(
|
protected TrackSelection selectAudioTrack(
|
||||||
TrackGroupArray groups,
|
TrackGroupArray groups,
|
||||||
int[][] formatSupport,
|
int[][] formatSupports,
|
||||||
|
int mixedMimeTypeAdaptationSupports,
|
||||||
Parameters params,
|
Parameters params,
|
||||||
TrackSelection.Factory adaptiveTrackSelectionFactory)
|
TrackSelection.Factory adaptiveTrackSelectionFactory)
|
||||||
throws ExoPlaybackException {
|
throws ExoPlaybackException {
|
||||||
|
|
@ -1287,7 +1305,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||||
AudioTrackScore selectedTrackScore = null;
|
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);
|
||||||
int[] trackFormatSupport = formatSupport[groupIndex];
|
int[] trackFormatSupport = formatSupports[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)) {
|
||||||
|
|
@ -1310,8 +1328,9 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||||
TrackGroup selectedGroup = groups.get(selectedGroupIndex);
|
TrackGroup selectedGroup = groups.get(selectedGroupIndex);
|
||||||
if (!params.forceLowestBitrate && adaptiveTrackSelectionFactory != null) {
|
if (!params.forceLowestBitrate && adaptiveTrackSelectionFactory != null) {
|
||||||
// If the group of the track with the highest score allows it, try to enable adaptation.
|
// If the group of the track with the highest score allows it, try to enable adaptation.
|
||||||
int[] adaptiveTracks = getAdaptiveAudioTracks(selectedGroup,
|
int[] adaptiveTracks =
|
||||||
formatSupport[selectedGroupIndex], params.allowMixedMimeAdaptiveness);
|
getAdaptiveAudioTracks(
|
||||||
|
selectedGroup, formatSupports[selectedGroupIndex], params.allowMixedMimeAdaptiveness);
|
||||||
if (adaptiveTracks.length > 0) {
|
if (adaptiveTracks.length > 0) {
|
||||||
return adaptiveTrackSelectionFactory.createTrackSelection(selectedGroup,
|
return adaptiveTrackSelectionFactory.createTrackSelection(selectedGroup,
|
||||||
adaptiveTracks);
|
adaptiveTracks);
|
||||||
|
|
@ -1375,7 +1394,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||||
// Text track selection implementation.
|
// Text track selection implementation.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by {@link #selectTracks(RendererCapabilities[], MappedTrackInfo)} to create a {@link
|
* Called by {@link #selectAllTracks(MappedTrackInfo, int[][][], int[])} to create a {@link
|
||||||
* TrackSelection} for a text renderer.
|
* TrackSelection} for a text renderer.
|
||||||
*
|
*
|
||||||
* @param groups The {@link TrackGroupArray} mapped to the renderer.
|
* @param groups The {@link TrackGroupArray} mapped to the renderer.
|
||||||
|
|
@ -1447,7 +1466,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||||
// General track selection methods.
|
// General track selection methods.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by {@link #selectTracks(RendererCapabilities[], MappedTrackInfo)} to create a {@link
|
* Called by {@link #selectAllTracks(MappedTrackInfo, int[][][], int[])} to create a {@link
|
||||||
* TrackSelection} for a renderer whose type is neither video, audio or text.
|
* TrackSelection} for a renderer whose type is neither video, audio or text.
|
||||||
*
|
*
|
||||||
* @param trackType The type of the renderer.
|
* @param trackType The type of the renderer.
|
||||||
|
|
@ -1495,8 +1514,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||||
* {@code rendererConfigurations} with configurations that enable tunneling on the appropriate
|
* {@code rendererConfigurations} with configurations that enable tunneling on the appropriate
|
||||||
* renderers if so.
|
* renderers if so.
|
||||||
*
|
*
|
||||||
* @param rendererCapabilities The {@link RendererCapabilities} of the renderers for which {@link
|
* @param mappedTrackInfo Mapped track information.
|
||||||
* TrackSelection}s are to be generated.
|
|
||||||
* @param rendererConfigurations The renderer configurations. Configurations may be replaced with
|
* @param rendererConfigurations The renderer configurations. Configurations may be replaced with
|
||||||
* ones that enable tunneling as a result of this call.
|
* ones that enable tunneling as a result of this call.
|
||||||
* @param trackSelections The renderer track selections.
|
* @param trackSelections The renderer track selections.
|
||||||
|
|
@ -1505,7 +1523,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||||
*/
|
*/
|
||||||
private static void maybeConfigureRenderersForTunneling(
|
private static void maybeConfigureRenderersForTunneling(
|
||||||
MappedTrackInfo mappedTrackInfo,
|
MappedTrackInfo mappedTrackInfo,
|
||||||
RendererCapabilities[] rendererCapabilities,
|
int[][][] renderererFormatSupports,
|
||||||
RendererConfiguration[] rendererConfigurations,
|
RendererConfiguration[] rendererConfigurations,
|
||||||
TrackSelection[] trackSelections,
|
TrackSelection[] trackSelections,
|
||||||
int tunnelingAudioSessionId) {
|
int tunnelingAudioSessionId) {
|
||||||
|
|
@ -1517,15 +1535,13 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||||
int tunnelingAudioRendererIndex = -1;
|
int tunnelingAudioRendererIndex = -1;
|
||||||
int tunnelingVideoRendererIndex = -1;
|
int tunnelingVideoRendererIndex = -1;
|
||||||
boolean enableTunneling = true;
|
boolean enableTunneling = true;
|
||||||
for (int i = 0; i < rendererCapabilities.length; i++) {
|
for (int i = 0; i < mappedTrackInfo.getRendererCount(); i++) {
|
||||||
int rendererType = rendererCapabilities[i].getTrackType();
|
int rendererType = mappedTrackInfo.getRendererType(i);
|
||||||
TrackSelection trackSelection = trackSelections[i];
|
TrackSelection trackSelection = trackSelections[i];
|
||||||
if ((rendererType == C.TRACK_TYPE_AUDIO || rendererType == C.TRACK_TYPE_VIDEO)
|
if ((rendererType == C.TRACK_TYPE_AUDIO || rendererType == C.TRACK_TYPE_VIDEO)
|
||||||
&& trackSelection != null) {
|
&& trackSelection != null) {
|
||||||
if (rendererSupportsTunneling(
|
if (rendererSupportsTunneling(
|
||||||
mappedTrackInfo.getRendererTrackSupport(i),
|
renderererFormatSupports[i], mappedTrackInfo.getTrackGroups(i), trackSelection)) {
|
||||||
mappedTrackInfo.getTrackGroups(i),
|
|
||||||
trackSelection)) {
|
|
||||||
if (rendererType == C.TRACK_TYPE_AUDIO) {
|
if (rendererType == C.TRACK_TYPE_AUDIO) {
|
||||||
if (tunnelingAudioRendererIndex != -1) {
|
if (tunnelingAudioRendererIndex != -1) {
|
||||||
enableTunneling = false;
|
enableTunneling = false;
|
||||||
|
|
@ -1556,20 +1572,20 @@ 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 formatSupport The result of {@link RendererCapabilities#supportsFormat} for each track,
|
* @param formatSupports The result of {@link RendererCapabilities#supportsFormat} for each track,
|
||||||
* indexed by group index and track index (in that order).
|
* indexed by group index and track 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(
|
||||||
int[][] formatSupport, TrackGroupArray trackGroups, TrackSelection selection) {
|
int[][] formatSupports, 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++) {
|
||||||
int trackFormatSupport = formatSupport[trackGroupIndex][selection.getIndexInTrackGroup(i)];
|
int trackFormatSupport = formatSupports[trackGroupIndex][selection.getIndexInTrackGroup(i)];
|
||||||
if ((trackFormatSupport & RendererCapabilities.TUNNELING_SUPPORT_MASK)
|
if ((trackFormatSupport & RendererCapabilities.TUNNELING_SUPPORT_MASK)
|
||||||
!= RendererCapabilities.TUNNELING_SUPPORTED) {
|
!= RendererCapabilities.TUNNELING_SUPPORTED) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -52,46 +52,76 @@ public abstract class MappingTrackSelector extends TrackSelector {
|
||||||
@interface RendererSupport {}
|
@interface RendererSupport {}
|
||||||
/** The renderer does not have any associated tracks. */
|
/** The renderer does not have any associated tracks. */
|
||||||
public static final int RENDERER_SUPPORT_NO_TRACKS = 0;
|
public static final int RENDERER_SUPPORT_NO_TRACKS = 0;
|
||||||
/** The renderer has associated tracks, but all are of unsupported types. */
|
/**
|
||||||
|
* The renderer has tracks mapped to it, but all are unsupported. In other words, {@link
|
||||||
|
* #getTrackSupport(int, int, int)} returns {@link RendererCapabilities#FORMAT_UNSUPPORTED_DRM},
|
||||||
|
* {@link RendererCapabilities#FORMAT_UNSUPPORTED_SUBTYPE} or {@link
|
||||||
|
* RendererCapabilities#FORMAT_UNSUPPORTED_TYPE} for all tracks mapped to the renderer.
|
||||||
|
*/
|
||||||
public static final int RENDERER_SUPPORT_UNSUPPORTED_TRACKS = 1;
|
public static final int RENDERER_SUPPORT_UNSUPPORTED_TRACKS = 1;
|
||||||
/**
|
/**
|
||||||
* The renderer has associated tracks and at least one is of a supported type, but all of the
|
* The renderer has tracks mapped to it and at least one is of a supported type, but all such
|
||||||
* tracks whose types are supported exceed the renderer's capabilities.
|
* tracks exceed the renderer's capabilities. In other words, {@link #getTrackSupport(int, int,
|
||||||
|
* int)} returns {@link RendererCapabilities##FORMAT_EXCEEDS_CAPABILITIES} for at least one
|
||||||
|
* track mapped to the renderer, but does not return {@link
|
||||||
|
* RendererCapabilities##FORMAT_HANDLED} for any tracks mapped to the renderer.
|
||||||
*/
|
*/
|
||||||
public static final int RENDERER_SUPPORT_EXCEEDS_CAPABILITIES_TRACKS = 2;
|
public static final int RENDERER_SUPPORT_EXCEEDS_CAPABILITIES_TRACKS = 2;
|
||||||
/** The renderer has associated tracks and can play at least one of them. */
|
/**
|
||||||
|
* The renderer has tracks mapped to it, and at least one such track is playable. In other
|
||||||
|
* words, {@link #getTrackSupport(int, int, int)} returns {@link
|
||||||
|
* RendererCapabilities##FORMAT_HANDLED} for at least one track mapped to the renderer.
|
||||||
|
*/
|
||||||
public static final int RENDERER_SUPPORT_PLAYABLE_TRACKS = 3;
|
public static final int RENDERER_SUPPORT_PLAYABLE_TRACKS = 3;
|
||||||
|
|
||||||
/**
|
/** @deprecated Use {@link #getRendererCount()}. */
|
||||||
* The number of renderers to which tracks are mapped.
|
@Deprecated public final int length;
|
||||||
*/
|
|
||||||
public final int length;
|
|
||||||
|
|
||||||
|
private final int rendererCount;
|
||||||
private final int[] rendererTrackTypes;
|
private final int[] rendererTrackTypes;
|
||||||
private final TrackGroupArray[] trackGroups;
|
private final TrackGroupArray[] rendererTrackGroups;
|
||||||
private final int[] mixedMimeTypeAdaptiveSupport;
|
private final int[] rendererMixedMimeTypeAdaptiveSupports;
|
||||||
private final int[][][] formatSupport;
|
private final int[][][] rendererFormatSupports;
|
||||||
private final TrackGroupArray unassociatedTrackGroups;
|
private final TrackGroupArray unmappedTrackGroups;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param rendererTrackTypes The track type supported by each renderer.
|
* @param rendererTrackTypes The track type handled by each renderer.
|
||||||
* @param trackGroups The {@link TrackGroup}s mapped to each renderer.
|
* @param rendererTrackGroups The {@link TrackGroup}s mapped to each renderer.
|
||||||
* @param mixedMimeTypeAdaptiveSupport The result of
|
* @param rendererMixedMimeTypeAdaptiveSupports The result of {@link
|
||||||
* {@link RendererCapabilities#supportsMixedMimeTypeAdaptation()} for each renderer.
|
* RendererCapabilities#supportsMixedMimeTypeAdaptation()} for each renderer.
|
||||||
* @param formatSupport The result of {@link RendererCapabilities#supportsFormat} for each
|
* @param rendererFormatSupports The result of {@link RendererCapabilities#supportsFormat} for
|
||||||
* mapped track, indexed by renderer index, track group index and track index (in that
|
* each mapped track, indexed by renderer, track group and track (in that order).
|
||||||
* order).
|
* @param unmappedTrackGroups {@link TrackGroup}s not mapped to any renderer.
|
||||||
* @param unassociatedTrackGroups Any {@link TrackGroup}s not mapped to any renderer.
|
|
||||||
*/
|
*/
|
||||||
/* package */ MappedTrackInfo(int[] rendererTrackTypes,
|
/* package */ MappedTrackInfo(
|
||||||
TrackGroupArray[] trackGroups, int[] mixedMimeTypeAdaptiveSupport,
|
int[] rendererTrackTypes,
|
||||||
int[][][] formatSupport, TrackGroupArray unassociatedTrackGroups) {
|
TrackGroupArray[] rendererTrackGroups,
|
||||||
|
int[] rendererMixedMimeTypeAdaptiveSupports,
|
||||||
|
int[][][] rendererFormatSupports,
|
||||||
|
TrackGroupArray unmappedTrackGroups) {
|
||||||
this.rendererTrackTypes = rendererTrackTypes;
|
this.rendererTrackTypes = rendererTrackTypes;
|
||||||
this.trackGroups = trackGroups;
|
this.rendererTrackGroups = rendererTrackGroups;
|
||||||
this.formatSupport = formatSupport;
|
this.rendererFormatSupports = rendererFormatSupports;
|
||||||
this.mixedMimeTypeAdaptiveSupport = mixedMimeTypeAdaptiveSupport;
|
this.rendererMixedMimeTypeAdaptiveSupports = rendererMixedMimeTypeAdaptiveSupports;
|
||||||
this.unassociatedTrackGroups = unassociatedTrackGroups;
|
this.unmappedTrackGroups = unmappedTrackGroups;
|
||||||
this.length = trackGroups.length;
|
this.rendererCount = rendererTrackTypes.length;
|
||||||
|
this.length = rendererCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns the number of renderers. */
|
||||||
|
public int getRendererCount() {
|
||||||
|
return rendererCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the track type that the renderer at a given index handles.
|
||||||
|
*
|
||||||
|
* @see Renderer#getTrackType()
|
||||||
|
* @param rendererIndex The renderer index.
|
||||||
|
* @return One of the {@code TRACK_TYPE_*} constants defined in {@link C}.
|
||||||
|
*/
|
||||||
|
public int getRendererType(int rendererIndex) {
|
||||||
|
return rendererTrackTypes[rendererIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -101,23 +131,11 @@ public abstract class MappingTrackSelector extends TrackSelector {
|
||||||
* @return The corresponding {@link TrackGroup}s.
|
* @return The corresponding {@link TrackGroup}s.
|
||||||
*/
|
*/
|
||||||
public TrackGroupArray getTrackGroups(int rendererIndex) {
|
public TrackGroupArray getTrackGroups(int rendererIndex) {
|
||||||
return trackGroups[rendererIndex];
|
return rendererTrackGroups[rendererIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the extent to which a renderer can play each of the tracks in the track groups mapped
|
* Returns the extent to which a renderer can play the tracks that are mapped to it.
|
||||||
* to it.
|
|
||||||
*
|
|
||||||
* @param rendererIndex The renderer index.
|
|
||||||
* @return The result of {@link RendererCapabilities#supportsFormat} for each track mapped to
|
|
||||||
* the renderer, indexed by track group and track index (in that order).
|
|
||||||
*/
|
|
||||||
public int[][] getRendererTrackSupport(int rendererIndex) {
|
|
||||||
return formatSupport[rendererIndex];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the extent to which a renderer can play the tracks in the track groups mapped to it.
|
|
||||||
*
|
*
|
||||||
* @param rendererIndex The renderer index.
|
* @param rendererIndex The renderer index.
|
||||||
* @return One of {@link #RENDERER_SUPPORT_PLAYABLE_TRACKS}, {@link
|
* @return One of {@link #RENDERER_SUPPORT_PLAYABLE_TRACKS}, {@link
|
||||||
|
|
@ -126,7 +144,7 @@ public abstract class MappingTrackSelector extends TrackSelector {
|
||||||
*/
|
*/
|
||||||
public @RendererSupport int getRendererSupport(int rendererIndex) {
|
public @RendererSupport int getRendererSupport(int rendererIndex) {
|
||||||
int bestRendererSupport = RENDERER_SUPPORT_NO_TRACKS;
|
int bestRendererSupport = RENDERER_SUPPORT_NO_TRACKS;
|
||||||
int[][] rendererFormatSupport = formatSupport[rendererIndex];
|
int[][] rendererFormatSupport = rendererFormatSupports[rendererIndex];
|
||||||
for (int i = 0; i < rendererFormatSupport.length; i++) {
|
for (int i = 0; i < rendererFormatSupport.length; i++) {
|
||||||
for (int j = 0; j < rendererFormatSupport[i].length; j++) {
|
for (int j = 0; j < rendererFormatSupport[i].length; j++) {
|
||||||
int trackRendererSupport;
|
int trackRendererSupport;
|
||||||
|
|
@ -146,19 +164,26 @@ public abstract class MappingTrackSelector extends TrackSelector {
|
||||||
return bestRendererSupport;
|
return bestRendererSupport;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @deprecated Use {@link #getTypeSupport(int)}. */
|
||||||
|
@Deprecated
|
||||||
|
public @RendererSupport int getTrackTypeRendererSupport(int trackType) {
|
||||||
|
return getTypeSupport(trackType);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the best level of support obtained from {@link #getRendererSupport(int)} for all
|
* Returns the extent to which tracks of a specified type are supported. This is the best level
|
||||||
* renderers of the specified track type. If no renderers exist for the specified type then
|
* of support obtained from {@link #getRendererSupport(int)} for all renderers that handle the
|
||||||
* {@link #RENDERER_SUPPORT_NO_TRACKS} is returned.
|
* specified type. If no such renderers exist then {@link #RENDERER_SUPPORT_NO_TRACKS} is
|
||||||
|
* returned.
|
||||||
*
|
*
|
||||||
* @param trackType The track type. One of the {@link C} {@code TRACK_TYPE_*} constants.
|
* @param trackType The track type. One of the {@link C} {@code TRACK_TYPE_*} constants.
|
||||||
* @return One of {@link #RENDERER_SUPPORT_PLAYABLE_TRACKS},
|
* @return One of {@link #RENDERER_SUPPORT_PLAYABLE_TRACKS}, {@link
|
||||||
* {@link #RENDERER_SUPPORT_EXCEEDS_CAPABILITIES_TRACKS},
|
* #RENDERER_SUPPORT_EXCEEDS_CAPABILITIES_TRACKS}, {@link
|
||||||
* {@link #RENDERER_SUPPORT_UNSUPPORTED_TRACKS} and {@link #RENDERER_SUPPORT_NO_TRACKS}.
|
* #RENDERER_SUPPORT_UNSUPPORTED_TRACKS} and {@link #RENDERER_SUPPORT_NO_TRACKS}.
|
||||||
*/
|
*/
|
||||||
public int getTrackTypeRendererSupport(int trackType) {
|
public @RendererSupport int getTypeSupport(int trackType) {
|
||||||
int bestRendererSupport = RENDERER_SUPPORT_NO_TRACKS;
|
int bestRendererSupport = RENDERER_SUPPORT_NO_TRACKS;
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < rendererCount; i++) {
|
||||||
if (rendererTrackTypes[i] == trackType) {
|
if (rendererTrackTypes[i] == trackType) {
|
||||||
bestRendererSupport = Math.max(bestRendererSupport, getRendererSupport(i));
|
bestRendererSupport = Math.max(bestRendererSupport, getRendererSupport(i));
|
||||||
}
|
}
|
||||||
|
|
@ -166,53 +191,58 @@ public abstract class MappingTrackSelector extends TrackSelector {
|
||||||
return bestRendererSupport;
|
return bestRendererSupport;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @deprecated Use {@link #getTrackSupport(int, int, int)}. */
|
||||||
|
@Deprecated
|
||||||
|
public int getTrackFormatSupport(int rendererIndex, int groupIndex, int trackIndex) {
|
||||||
|
return getTrackSupport(rendererIndex, groupIndex, trackIndex);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the extent to which an individual track is supported by the renderer.
|
* Returns the extent to which an individual track is supported by the renderer.
|
||||||
*
|
*
|
||||||
* @param rendererIndex The renderer index.
|
* @param rendererIndex The renderer index.
|
||||||
* @param groupIndex The index of the track group to which the track belongs.
|
* @param groupIndex The index of the track group to which the track belongs.
|
||||||
* @param trackIndex The index of the track within the track group.
|
* @param trackIndex The index of the track within the track group.
|
||||||
* @return One of {@link RendererCapabilities#FORMAT_HANDLED},
|
* @return One of {@link RendererCapabilities#FORMAT_HANDLED}, {@link
|
||||||
* {@link RendererCapabilities#FORMAT_EXCEEDS_CAPABILITIES},
|
* RendererCapabilities#FORMAT_EXCEEDS_CAPABILITIES}, {@link
|
||||||
* {@link RendererCapabilities#FORMAT_UNSUPPORTED_DRM},
|
* RendererCapabilities#FORMAT_UNSUPPORTED_DRM}, {@link
|
||||||
* {@link RendererCapabilities#FORMAT_UNSUPPORTED_SUBTYPE} and
|
* RendererCapabilities#FORMAT_UNSUPPORTED_SUBTYPE} and {@link
|
||||||
* {@link RendererCapabilities#FORMAT_UNSUPPORTED_TYPE}.
|
* RendererCapabilities#FORMAT_UNSUPPORTED_TYPE}.
|
||||||
*/
|
*/
|
||||||
public int getTrackFormatSupport(int rendererIndex, int groupIndex, int trackIndex) {
|
public int getTrackSupport(int rendererIndex, int groupIndex, int trackIndex) {
|
||||||
return formatSupport[rendererIndex][groupIndex][trackIndex]
|
return rendererFormatSupports[rendererIndex][groupIndex][trackIndex]
|
||||||
& RendererCapabilities.FORMAT_SUPPORT_MASK;
|
& RendererCapabilities.FORMAT_SUPPORT_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the extent to which a renderer supports adaptation between supported tracks in a
|
* Returns the extent to which a renderer supports adaptation between supported tracks in a
|
||||||
* specified {@link TrackGroup}.
|
* specified {@link TrackGroup}.
|
||||||
* <p>
|
*
|
||||||
* Tracks for which {@link #getTrackFormatSupport(int, int, int)} returns
|
* <p>Tracks for which {@link #getTrackSupport(int, int, int)} returns {@link
|
||||||
* {@link RendererCapabilities#FORMAT_HANDLED} are always considered.
|
* RendererCapabilities#FORMAT_HANDLED} are always considered. Tracks for which {@link
|
||||||
* Tracks for which {@link #getTrackFormatSupport(int, int, int)} returns
|
* #getTrackSupport(int, int, int)} returns {@link
|
||||||
* {@link RendererCapabilities#FORMAT_UNSUPPORTED_DRM},
|
* RendererCapabilities#FORMAT_EXCEEDS_CAPABILITIES} are also considered if {@code
|
||||||
* {@link RendererCapabilities#FORMAT_UNSUPPORTED_TYPE} or
|
* includeCapabilitiesExceededTracks} is set to {@code true}. Tracks for which {@link
|
||||||
* {@link RendererCapabilities#FORMAT_UNSUPPORTED_SUBTYPE} are never considered.
|
* #getTrackSupport(int, int, int)} returns {@link RendererCapabilities#FORMAT_UNSUPPORTED_DRM},
|
||||||
* Tracks for which {@link #getTrackFormatSupport(int, int, int)} returns
|
* {@link RendererCapabilities#FORMAT_UNSUPPORTED_TYPE} or {@link
|
||||||
* {@link RendererCapabilities#FORMAT_EXCEEDS_CAPABILITIES} are considered only if
|
* RendererCapabilities#FORMAT_UNSUPPORTED_SUBTYPE} are never considered.
|
||||||
* {@code includeCapabilitiesExceededTracks} is set to {@code true}.
|
|
||||||
*
|
*
|
||||||
* @param rendererIndex The renderer index.
|
* @param rendererIndex The renderer index.
|
||||||
* @param groupIndex The index of the track group.
|
* @param groupIndex The index of the track group.
|
||||||
* @param includeCapabilitiesExceededTracks True if formats that exceed the capabilities of the
|
* @param includeCapabilitiesExceededTracks Whether tracks that exceed the capabilities of the
|
||||||
* renderer should be included when determining support. False otherwise.
|
* renderer are included when determining support.
|
||||||
* @return One of {@link RendererCapabilities#ADAPTIVE_SEAMLESS},
|
* @return One of {@link RendererCapabilities#ADAPTIVE_SEAMLESS}, {@link
|
||||||
* {@link RendererCapabilities#ADAPTIVE_NOT_SEAMLESS} and
|
* RendererCapabilities#ADAPTIVE_NOT_SEAMLESS} and {@link
|
||||||
* {@link RendererCapabilities#ADAPTIVE_NOT_SUPPORTED}.
|
* RendererCapabilities#ADAPTIVE_NOT_SUPPORTED}.
|
||||||
*/
|
*/
|
||||||
public int getAdaptiveSupport(int rendererIndex, int groupIndex,
|
public int getAdaptiveSupport(
|
||||||
boolean includeCapabilitiesExceededTracks) {
|
int rendererIndex, int groupIndex, boolean includeCapabilitiesExceededTracks) {
|
||||||
int trackCount = trackGroups[rendererIndex].get(groupIndex).length;
|
int trackCount = rendererTrackGroups[rendererIndex].get(groupIndex).length;
|
||||||
// Iterate over the tracks in the group, recording the indices of those to consider.
|
// Iterate over the tracks in the group, recording the indices of those to consider.
|
||||||
int[] trackIndices = new int[trackCount];
|
int[] trackIndices = new int[trackCount];
|
||||||
int trackIndexCount = 0;
|
int trackIndexCount = 0;
|
||||||
for (int i = 0; i < trackCount; i++) {
|
for (int i = 0; i < trackCount; i++) {
|
||||||
int fixedSupport = getTrackFormatSupport(rendererIndex, groupIndex, i);
|
int fixedSupport = getTrackSupport(rendererIndex, groupIndex, i);
|
||||||
if (fixedSupport == RendererCapabilities.FORMAT_HANDLED
|
if (fixedSupport == RendererCapabilities.FORMAT_HANDLED
|
||||||
|| (includeCapabilitiesExceededTracks
|
|| (includeCapabilitiesExceededTracks
|
||||||
&& fixedSupport == RendererCapabilities.FORMAT_EXCEEDS_CAPABILITIES)) {
|
&& fixedSupport == RendererCapabilities.FORMAT_EXCEEDS_CAPABILITIES)) {
|
||||||
|
|
@ -224,14 +254,14 @@ public abstract class MappingTrackSelector extends TrackSelector {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the extent to which a renderer supports adaptation between specified tracks within
|
* Returns the extent to which a renderer supports adaptation between specified tracks within a
|
||||||
* a {@link TrackGroup}.
|
* {@link TrackGroup}.
|
||||||
*
|
*
|
||||||
* @param rendererIndex The renderer index.
|
* @param rendererIndex The renderer index.
|
||||||
* @param groupIndex The index of the track group.
|
* @param groupIndex The index of the track group.
|
||||||
* @return One of {@link RendererCapabilities#ADAPTIVE_SEAMLESS},
|
* @return One of {@link RendererCapabilities#ADAPTIVE_SEAMLESS}, {@link
|
||||||
* {@link RendererCapabilities#ADAPTIVE_NOT_SEAMLESS} and
|
* RendererCapabilities#ADAPTIVE_NOT_SEAMLESS} and {@link
|
||||||
* {@link RendererCapabilities#ADAPTIVE_NOT_SUPPORTED}.
|
* RendererCapabilities#ADAPTIVE_NOT_SUPPORTED}.
|
||||||
*/
|
*/
|
||||||
public int getAdaptiveSupport(int rendererIndex, int groupIndex, int[] trackIndices) {
|
public int getAdaptiveSupport(int rendererIndex, int groupIndex, int[] trackIndices) {
|
||||||
int handledTrackCount = 0;
|
int handledTrackCount = 0;
|
||||||
|
|
@ -240,26 +270,33 @@ public abstract class MappingTrackSelector extends TrackSelector {
|
||||||
String firstSampleMimeType = null;
|
String firstSampleMimeType = null;
|
||||||
for (int i = 0; i < trackIndices.length; i++) {
|
for (int i = 0; i < trackIndices.length; i++) {
|
||||||
int trackIndex = trackIndices[i];
|
int trackIndex = trackIndices[i];
|
||||||
String sampleMimeType = trackGroups[rendererIndex].get(groupIndex).getFormat(trackIndex)
|
String sampleMimeType =
|
||||||
.sampleMimeType;
|
rendererTrackGroups[rendererIndex].get(groupIndex).getFormat(trackIndex).sampleMimeType;
|
||||||
if (handledTrackCount++ == 0) {
|
if (handledTrackCount++ == 0) {
|
||||||
firstSampleMimeType = sampleMimeType;
|
firstSampleMimeType = sampleMimeType;
|
||||||
} else {
|
} else {
|
||||||
multipleMimeTypes |= !Util.areEqual(firstSampleMimeType, sampleMimeType);
|
multipleMimeTypes |= !Util.areEqual(firstSampleMimeType, sampleMimeType);
|
||||||
}
|
}
|
||||||
adaptiveSupport = Math.min(adaptiveSupport, formatSupport[rendererIndex][groupIndex][i]
|
adaptiveSupport =
|
||||||
& RendererCapabilities.ADAPTIVE_SUPPORT_MASK);
|
Math.min(
|
||||||
|
adaptiveSupport,
|
||||||
|
rendererFormatSupports[rendererIndex][groupIndex][i]
|
||||||
|
& RendererCapabilities.ADAPTIVE_SUPPORT_MASK);
|
||||||
}
|
}
|
||||||
return multipleMimeTypes
|
return multipleMimeTypes
|
||||||
? Math.min(adaptiveSupport, mixedMimeTypeAdaptiveSupport[rendererIndex])
|
? Math.min(adaptiveSupport, rendererMixedMimeTypeAdaptiveSupports[rendererIndex])
|
||||||
: adaptiveSupport;
|
: adaptiveSupport;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @deprecated Use {@link #getUnmappedTrackGroups()}. */
|
||||||
* Returns {@link TrackGroup}s not mapped to any renderer.
|
@Deprecated
|
||||||
*/
|
|
||||||
public TrackGroupArray getUnassociatedTrackGroups() {
|
public TrackGroupArray getUnassociatedTrackGroups() {
|
||||||
return unassociatedTrackGroups;
|
return getUnmappedTrackGroups();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns {@link TrackGroup}s not mapped to any renderer. */
|
||||||
|
public TrackGroupArray getUnmappedTrackGroups() {
|
||||||
|
return unmappedTrackGroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -296,7 +333,8 @@ public abstract class MappingTrackSelector extends TrackSelector {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine the extent to which each renderer supports mixed mimeType adaptation.
|
// Determine the extent to which each renderer supports mixed mimeType adaptation.
|
||||||
int[] mixedMimeTypeAdaptationSupport = getMixedMimeTypeAdaptationSupport(rendererCapabilities);
|
int[] rendererMixedMimeTypeAdaptationSupports =
|
||||||
|
getMixedMimeTypeAdaptationSupports(rendererCapabilities);
|
||||||
|
|
||||||
// Associate each track group to a preferred renderer, and evaluate the support that the
|
// Associate each track group to a preferred renderer, and evaluate the support that the
|
||||||
// renderer provides for each track in the group.
|
// renderer provides for each track in the group.
|
||||||
|
|
@ -325,30 +363,36 @@ public abstract class MappingTrackSelector extends TrackSelector {
|
||||||
rendererTrackTypes[i] = rendererCapabilities[i].getTrackType();
|
rendererTrackTypes[i] = rendererCapabilities[i].getTrackType();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a track group array for track groups not associated with a renderer.
|
// Create a track group array for track groups not mapped to a renderer.
|
||||||
int unassociatedTrackGroupCount = rendererTrackGroupCounts[rendererCapabilities.length];
|
int unmappedTrackGroupCount = rendererTrackGroupCounts[rendererCapabilities.length];
|
||||||
TrackGroupArray unassociatedTrackGroupArray = new TrackGroupArray(Arrays.copyOf(
|
TrackGroupArray unmappedTrackGroupArray =
|
||||||
rendererTrackGroups[rendererCapabilities.length], unassociatedTrackGroupCount));
|
new TrackGroupArray(
|
||||||
|
Arrays.copyOf(
|
||||||
|
rendererTrackGroups[rendererCapabilities.length], unmappedTrackGroupCount));
|
||||||
|
|
||||||
// Package up the track information and selections.
|
// Package up the track information and selections.
|
||||||
MappedTrackInfo mappedTrackInfo =
|
MappedTrackInfo mappedTrackInfo =
|
||||||
new MappedTrackInfo(
|
new MappedTrackInfo(
|
||||||
rendererTrackTypes,
|
rendererTrackTypes,
|
||||||
rendererTrackGroupArrays,
|
rendererTrackGroupArrays,
|
||||||
mixedMimeTypeAdaptationSupport,
|
rendererMixedMimeTypeAdaptationSupports,
|
||||||
rendererFormatSupports,
|
rendererFormatSupports,
|
||||||
unassociatedTrackGroupArray);
|
unmappedTrackGroupArray);
|
||||||
|
|
||||||
Pair<RendererConfiguration[], TrackSelection[]> result =
|
Pair<RendererConfiguration[], TrackSelection[]> result =
|
||||||
selectTracks(rendererCapabilities, mappedTrackInfo);
|
selectTracks(
|
||||||
|
mappedTrackInfo, rendererFormatSupports, rendererMixedMimeTypeAdaptationSupports);
|
||||||
return new TrackSelectorResult(result.first, result.second, mappedTrackInfo);
|
return new TrackSelectorResult(result.first, result.second, mappedTrackInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given mapped track information, returns a track selection and configuration for each renderer.
|
* Given mapped track information, returns a track selection and configuration for each renderer.
|
||||||
*
|
*
|
||||||
* @param rendererCapabilities The {@link RendererCapabilities} of each renderer.
|
|
||||||
* @param mappedTrackInfo Mapped track information.
|
* @param mappedTrackInfo Mapped track information.
|
||||||
|
* @param rendererFormatSupports The result of {@link RendererCapabilities#supportsFormat} for
|
||||||
|
* each mapped track, indexed by renderer, track group and track (in that order).
|
||||||
|
* @param rendererMixedMimeTypeAdaptationSupport The result of {@link
|
||||||
|
* RendererCapabilities#supportsMixedMimeTypeAdaptation()} for each renderer.
|
||||||
* @return A pair consisting of the track selections and configurations for each renderer. A null
|
* @return A pair consisting of the track selections and configurations for each renderer. A null
|
||||||
* configuration indicates the renderer should be disabled, in which case the track selection
|
* configuration indicates the renderer should be disabled, in which case the track selection
|
||||||
* will also be null. A track selection may also be null for a non-disabled renderer if {@link
|
* will also be null. A track selection may also be null for a non-disabled renderer if {@link
|
||||||
|
|
@ -356,7 +400,9 @@ public abstract class MappingTrackSelector extends TrackSelector {
|
||||||
* @throws ExoPlaybackException If an error occurs while selecting the tracks.
|
* @throws ExoPlaybackException If an error occurs while selecting the tracks.
|
||||||
*/
|
*/
|
||||||
protected abstract Pair<RendererConfiguration[], TrackSelection[]> selectTracks(
|
protected abstract Pair<RendererConfiguration[], TrackSelection[]> selectTracks(
|
||||||
RendererCapabilities[] rendererCapabilities, MappedTrackInfo mappedTrackInfo)
|
MappedTrackInfo mappedTrackInfo,
|
||||||
|
int[][][] rendererFormatSupports,
|
||||||
|
int[] rendererMixedMimeTypeAdaptationSupport)
|
||||||
throws ExoPlaybackException;
|
throws ExoPlaybackException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -425,11 +471,11 @@ public abstract class MappingTrackSelector extends TrackSelector {
|
||||||
* returning the results in an array.
|
* returning the results in an array.
|
||||||
*
|
*
|
||||||
* @param rendererCapabilities The {@link RendererCapabilities} of the renderers.
|
* @param rendererCapabilities The {@link RendererCapabilities} of the renderers.
|
||||||
* @return An array containing the result of calling
|
* @return An array containing the result of calling {@link
|
||||||
* {@link RendererCapabilities#supportsMixedMimeTypeAdaptation()} for each renderer.
|
* RendererCapabilities#supportsMixedMimeTypeAdaptation()} for each renderer.
|
||||||
* @throws ExoPlaybackException If an error occurs determining the adaptation support.
|
* @throws ExoPlaybackException If an error occurs determining the adaptation support.
|
||||||
*/
|
*/
|
||||||
private static int[] getMixedMimeTypeAdaptationSupport(
|
private static int[] getMixedMimeTypeAdaptationSupports(
|
||||||
RendererCapabilities[] rendererCapabilities) throws ExoPlaybackException {
|
RendererCapabilities[] rendererCapabilities) throws ExoPlaybackException {
|
||||||
int[] mixedMimeTypeAdaptationSupport = new int[rendererCapabilities.length];
|
int[] mixedMimeTypeAdaptationSupport = new int[rendererCapabilities.length];
|
||||||
for (int i = 0; i < mixedMimeTypeAdaptationSupport.length; i++) {
|
for (int i = 0; i < mixedMimeTypeAdaptationSupport.length; i++) {
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,8 @@ public class EventLogger
|
||||||
}
|
}
|
||||||
logd("Tracks [");
|
logd("Tracks [");
|
||||||
// Log tracks associated to renderers.
|
// Log tracks associated to renderers.
|
||||||
for (int rendererIndex = 0; rendererIndex < mappedTrackInfo.length; rendererIndex++) {
|
int rendererCount = mappedTrackInfo.getRendererCount();
|
||||||
|
for (int rendererIndex = 0; rendererIndex < rendererCount; rendererIndex++) {
|
||||||
TrackGroupArray rendererTrackGroups = mappedTrackInfo.getTrackGroups(rendererIndex);
|
TrackGroupArray rendererTrackGroups = mappedTrackInfo.getTrackGroups(rendererIndex);
|
||||||
TrackSelection trackSelection = trackSelections.get(rendererIndex);
|
TrackSelection trackSelection = trackSelections.get(rendererIndex);
|
||||||
if (rendererTrackGroups.length > 0) {
|
if (rendererTrackGroups.length > 0) {
|
||||||
|
|
@ -186,7 +187,7 @@ public class EventLogger
|
||||||
String status = getTrackStatusString(trackSelection, trackGroup, trackIndex);
|
String status = getTrackStatusString(trackSelection, trackGroup, trackIndex);
|
||||||
String formatSupport =
|
String formatSupport =
|
||||||
getFormatSupportString(
|
getFormatSupportString(
|
||||||
mappedTrackInfo.getTrackFormatSupport(rendererIndex, groupIndex, trackIndex));
|
mappedTrackInfo.getTrackSupport(rendererIndex, groupIndex, trackIndex));
|
||||||
logd(
|
logd(
|
||||||
" "
|
" "
|
||||||
+ status
|
+ status
|
||||||
|
|
@ -215,7 +216,7 @@ public class EventLogger
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Log tracks not associated with a renderer.
|
// Log tracks not associated with a renderer.
|
||||||
TrackGroupArray unassociatedTrackGroups = mappedTrackInfo.getUnassociatedTrackGroups();
|
TrackGroupArray unassociatedTrackGroups = mappedTrackInfo.getUnmappedTrackGroups();
|
||||||
if (unassociatedTrackGroups.length > 0) {
|
if (unassociatedTrackGroups.length > 0) {
|
||||||
logd(" Renderer:None [");
|
logd(" Renderer:None [");
|
||||||
for (int groupIndex = 0; groupIndex < unassociatedTrackGroups.length; groupIndex++) {
|
for (int groupIndex = 0; groupIndex < unassociatedTrackGroups.length; groupIndex++) {
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ public final class MappingTrackSelectorTest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link MappingTrackSelector} that stashes the {@link MappedTrackInfo} passed to {@link
|
* A {@link MappingTrackSelector} that stashes the {@link MappedTrackInfo} passed to {@link
|
||||||
* #selectTracks(RendererCapabilities[], MappedTrackInfo)}.
|
* #selectTracks(MappedTrackInfo, int[][][], int[])}.
|
||||||
*/
|
*/
|
||||||
private static final class FakeMappingTrackSelector extends MappingTrackSelector {
|
private static final class FakeMappingTrackSelector extends MappingTrackSelector {
|
||||||
|
|
||||||
|
|
@ -101,12 +101,14 @@ public final class MappingTrackSelectorTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Pair<RendererConfiguration[], TrackSelection[]> selectTracks(
|
protected Pair<RendererConfiguration[], TrackSelection[]> selectTracks(
|
||||||
RendererCapabilities[] rendererCapabilities, MappedTrackInfo mappedTrackInfo)
|
MappedTrackInfo mappedTrackInfo,
|
||||||
|
int[][][] rendererFormatSupports,
|
||||||
|
int[] rendererMixedMimeTypeAdaptationSupports)
|
||||||
throws ExoPlaybackException {
|
throws ExoPlaybackException {
|
||||||
|
int rendererCount = mappedTrackInfo.getRendererCount();
|
||||||
lastMappedTrackInfo = mappedTrackInfo;
|
lastMappedTrackInfo = mappedTrackInfo;
|
||||||
return Pair.create(
|
return Pair.create(
|
||||||
new RendererConfiguration[rendererCapabilities.length],
|
new RendererConfiguration[rendererCount], new TrackSelection[rendererCount]);
|
||||||
new TrackSelection[rendererCapabilities.length]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void assertMappedTrackGroups(int rendererIndex, TrackGroup... expected) {
|
public void assertMappedTrackGroups(int rendererIndex, TrackGroup... expected) {
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,6 @@
|
||||||
<string name="exo_downloading">Изтегля се</string>
|
<string name="exo_downloading">Изтегля се</string>
|
||||||
<string name="exo_download_completed">Изтеглянето завърши</string>
|
<string name="exo_download_completed">Изтеглянето завърши</string>
|
||||||
<string name="exo_download_failed">Изтеглянето не бе успешно</string>
|
<string name="exo_download_failed">Изтеглянето не бе успешно</string>
|
||||||
<string name="exo_track_selection_none">None</string>
|
<string name="exo_track_selection_none">Нищо</string>
|
||||||
<string name="exo_track_selection_auto">Auto</string>
|
<string name="exo_track_selection_auto">Автоматично</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,6 @@
|
||||||
<string name="exo_downloading">Mendownload</string>
|
<string name="exo_downloading">Mendownload</string>
|
||||||
<string name="exo_download_completed">Download selesai</string>
|
<string name="exo_download_completed">Download selesai</string>
|
||||||
<string name="exo_download_failed">Download gagal</string>
|
<string name="exo_download_failed">Download gagal</string>
|
||||||
<string name="exo_track_selection_none">None</string>
|
<string name="exo_track_selection_none">Tidak ada</string>
|
||||||
<string name="exo_track_selection_auto">Auto</string>
|
<string name="exo_track_selection_auto">Otomatis</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,6 @@
|
||||||
<string name="exo_downloading">ဒေါင်းလုဒ်လုပ်နေသည်</string>
|
<string name="exo_downloading">ဒေါင်းလုဒ်လုပ်နေသည်</string>
|
||||||
<string name="exo_download_completed">ဒေါင်းလုဒ်လုပ်ပြီးပါပြီ</string>
|
<string name="exo_download_completed">ဒေါင်းလုဒ်လုပ်ပြီးပါပြီ</string>
|
||||||
<string name="exo_download_failed">ဒေါင်းလုဒ်လုပ်၍ မရပါ</string>
|
<string name="exo_download_failed">ဒေါင်းလုဒ်လုပ်၍ မရပါ</string>
|
||||||
<string name="exo_track_selection_none">None</string>
|
<string name="exo_track_selection_none">မရှိ</string>
|
||||||
<string name="exo_track_selection_auto">Auto</string>
|
<string name="exo_track_selection_auto">အလိုအလျောက်</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,6 @@
|
||||||
<string name="exo_downloading">Se descarcă</string>
|
<string name="exo_downloading">Se descarcă</string>
|
||||||
<string name="exo_download_completed">Descărcarea a fost finalizată</string>
|
<string name="exo_download_completed">Descărcarea a fost finalizată</string>
|
||||||
<string name="exo_download_failed">Descărcarea nu a reușit</string>
|
<string name="exo_download_failed">Descărcarea nu a reușit</string>
|
||||||
<string name="exo_track_selection_none">None</string>
|
<string name="exo_track_selection_none">Fără</string>
|
||||||
<string name="exo_track_selection_auto">Auto</string>
|
<string name="exo_track_selection_auto">Automat</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,6 @@
|
||||||
<string name="exo_downloading">බාගනිමින්</string>
|
<string name="exo_downloading">බාගනිමින්</string>
|
||||||
<string name="exo_download_completed">බාගැනීම සම්පූර්ණ කරන ලදී</string>
|
<string name="exo_download_completed">බාගැනීම සම්පූර්ණ කරන ලදී</string>
|
||||||
<string name="exo_download_failed">බාගැනීම අසමත් විය</string>
|
<string name="exo_download_failed">බාගැනීම අසමත් විය</string>
|
||||||
<string name="exo_track_selection_none">None</string>
|
<string name="exo_track_selection_none">කිසිවක් නැත</string>
|
||||||
<string name="exo_track_selection_auto">Auto</string>
|
<string name="exo_track_selection_auto">ස්වයං</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -395,23 +395,25 @@ public final class DashTestRunner {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected TrackSelection[] selectAllTracks(
|
protected TrackSelection[] selectAllTracks(
|
||||||
RendererCapabilities[] rendererCapabilities, MappedTrackInfo mappedTrackInfo)
|
MappedTrackInfo mappedTrackInfo,
|
||||||
|
int[][][] rendererFormatSupports,
|
||||||
|
int[] rendererMixedMimeTypeAdaptationSupports)
|
||||||
throws ExoPlaybackException {
|
throws ExoPlaybackException {
|
||||||
Assertions.checkState(rendererCapabilities[VIDEO_RENDERER_INDEX].getTrackType()
|
Assertions.checkState(
|
||||||
== C.TRACK_TYPE_VIDEO);
|
mappedTrackInfo.getRendererType(VIDEO_RENDERER_INDEX) == C.TRACK_TYPE_VIDEO);
|
||||||
Assertions.checkState(rendererCapabilities[AUDIO_RENDERER_INDEX].getTrackType()
|
Assertions.checkState(
|
||||||
== C.TRACK_TYPE_AUDIO);
|
mappedTrackInfo.getRendererType(AUDIO_RENDERER_INDEX) == C.TRACK_TYPE_AUDIO);
|
||||||
TrackGroupArray videoTrackGroups = mappedTrackInfo.getTrackGroups(VIDEO_RENDERER_INDEX);
|
TrackGroupArray videoTrackGroups = mappedTrackInfo.getTrackGroups(VIDEO_RENDERER_INDEX);
|
||||||
TrackGroupArray audioTrackGroups = mappedTrackInfo.getTrackGroups(AUDIO_RENDERER_INDEX);
|
TrackGroupArray audioTrackGroups = mappedTrackInfo.getTrackGroups(AUDIO_RENDERER_INDEX);
|
||||||
Assertions.checkState(videoTrackGroups.length == 1);
|
Assertions.checkState(videoTrackGroups.length == 1);
|
||||||
Assertions.checkState(audioTrackGroups.length == 1);
|
Assertions.checkState(audioTrackGroups.length == 1);
|
||||||
TrackSelection[] selections = new TrackSelection[rendererCapabilities.length];
|
TrackSelection[] selections = new TrackSelection[mappedTrackInfo.getRendererCount()];
|
||||||
selections[VIDEO_RENDERER_INDEX] =
|
selections[VIDEO_RENDERER_INDEX] =
|
||||||
new RandomTrackSelection(
|
new RandomTrackSelection(
|
||||||
videoTrackGroups.get(0),
|
videoTrackGroups.get(0),
|
||||||
getVideoTrackIndices(
|
getVideoTrackIndices(
|
||||||
videoTrackGroups.get(0),
|
videoTrackGroups.get(0),
|
||||||
mappedTrackInfo.getRendererTrackSupport(VIDEO_RENDERER_INDEX)[0],
|
rendererFormatSupports[VIDEO_RENDERER_INDEX][0],
|
||||||
videoFormatIds,
|
videoFormatIds,
|
||||||
canIncludeAdditionalVideoFormats),
|
canIncludeAdditionalVideoFormats),
|
||||||
0 /* seed */);
|
0 /* seed */);
|
||||||
|
|
@ -423,8 +425,11 @@ public final class DashTestRunner {
|
||||||
return selections;
|
return selections;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int[] getVideoTrackIndices(TrackGroup trackGroup, int[] formatSupport,
|
private int[] getVideoTrackIndices(
|
||||||
String[] formatIds, boolean canIncludeAdditionalFormats) {
|
TrackGroup trackGroup,
|
||||||
|
int[] formatSupports,
|
||||||
|
String[] formatIds,
|
||||||
|
boolean canIncludeAdditionalFormats) {
|
||||||
List<Integer> trackIndices = new ArrayList<>();
|
List<Integer> trackIndices = new ArrayList<>();
|
||||||
|
|
||||||
// Always select explicitly listed representations.
|
// Always select explicitly listed representations.
|
||||||
|
|
@ -438,7 +443,7 @@ public final class DashTestRunner {
|
||||||
// Select additional video representations, if supported by the device.
|
// Select additional video representations, if supported by the device.
|
||||||
if (canIncludeAdditionalFormats) {
|
if (canIncludeAdditionalFormats) {
|
||||||
for (int i = 0; i < trackGroup.length; i++) {
|
for (int i = 0; i < trackGroup.length; i++) {
|
||||||
if (!trackIndices.contains(i) && isFormatHandled(formatSupport[i])) {
|
if (!trackIndices.contains(i) && isFormatHandled(formatSupports[i])) {
|
||||||
Log.d(tag, "Adding extra video format: "
|
Log.d(tag, "Adding extra video format: "
|
||||||
+ Format.toLogString(trackGroup.getFormat(i)));
|
+ Format.toLogString(trackGroup.getFormat(i)));
|
||||||
trackIndices.add(i);
|
trackIndices.add(i);
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ package com.google.android.exoplayer2.testutil;
|
||||||
|
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import com.google.android.exoplayer2.ExoPlaybackException;
|
import com.google.android.exoplayer2.ExoPlaybackException;
|
||||||
import com.google.android.exoplayer2.RendererCapabilities;
|
|
||||||
import com.google.android.exoplayer2.source.TrackGroup;
|
import com.google.android.exoplayer2.source.TrackGroup;
|
||||||
import com.google.android.exoplayer2.source.TrackGroupArray;
|
import com.google.android.exoplayer2.source.TrackGroupArray;
|
||||||
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
|
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
|
||||||
|
|
@ -47,7 +46,9 @@ public class FakeTrackSelector extends DefaultTrackSelector {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected TrackSelection[] selectAllTracks(
|
protected TrackSelection[] selectAllTracks(
|
||||||
RendererCapabilities[] rendererCapabilities, MappedTrackInfo mappedTrackInfo)
|
MappedTrackInfo mappedTrackInfo,
|
||||||
|
int[][][] rendererFormatSupports,
|
||||||
|
int[] rendererMixedMimeTypeAdaptationSupports)
|
||||||
throws ExoPlaybackException {
|
throws ExoPlaybackException {
|
||||||
TrackSelection[] selections = new TrackSelection[mappedTrackInfo.length];
|
TrackSelection[] selections = new TrackSelection[mappedTrackInfo.length];
|
||||||
for (int i = 0; i < mappedTrackInfo.length; i++) {
|
for (int i = 0; i < mappedTrackInfo.length; i++) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue