Remove TrackGroups from TrackSelectorResult
They don't really belong there; it was basically a convenience thing where one of the arguments to the track selector was being packaged up in the result to avoid having to hold a separate reference to it. This change is being made as a precursor to a subsequent change where creating the TrackSelectorResult will move from MappingTrackSelector to DefaultTrackSelector. DefaultTrackSelector doesn't currently have access to the un-mapped tracks, and so is unable to create a TrackSelectorResult. It's IMO preferable to keep it that way rather than passing them down just so they can be included in the result. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=190640594
This commit is contained in:
parent
0a4ea1cd3e
commit
18df028ce2
@ -92,7 +92,6 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
|||||||
this.listeners = new CopyOnWriteArraySet<>();
|
this.listeners = new CopyOnWriteArraySet<>();
|
||||||
emptyTrackSelectorResult =
|
emptyTrackSelectorResult =
|
||||||
new TrackSelectorResult(
|
new TrackSelectorResult(
|
||||||
TrackGroupArray.EMPTY,
|
|
||||||
new boolean[renderers.length],
|
new boolean[renderers.length],
|
||||||
new TrackSelectionArray(new TrackSelection[renderers.length]),
|
new TrackSelectionArray(new TrackSelection[renderers.length]),
|
||||||
null,
|
null,
|
||||||
@ -108,7 +107,11 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
playbackInfo =
|
playbackInfo =
|
||||||
new PlaybackInfo(Timeline.EMPTY, /* startPositionUs= */ 0, emptyTrackSelectorResult);
|
new PlaybackInfo(
|
||||||
|
Timeline.EMPTY,
|
||||||
|
/* startPositionUs= */ 0,
|
||||||
|
TrackGroupArray.EMPTY,
|
||||||
|
emptyTrackSelectorResult);
|
||||||
internalPlayer =
|
internalPlayer =
|
||||||
new ExoPlayerImplInternal(
|
new ExoPlayerImplInternal(
|
||||||
renderers,
|
renderers,
|
||||||
@ -512,7 +515,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TrackGroupArray getCurrentTrackGroups() {
|
public TrackGroupArray getCurrentTrackGroups() {
|
||||||
return playbackInfo.trackSelectorResult.groups;
|
return playbackInfo.trackGroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -616,6 +619,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
|||||||
playbackInfo.contentPositionUs,
|
playbackInfo.contentPositionUs,
|
||||||
playbackState,
|
playbackState,
|
||||||
/* isLoading= */ false,
|
/* isLoading= */ false,
|
||||||
|
resetState ? TrackGroupArray.EMPTY : playbackInfo.trackGroups,
|
||||||
resetState ? emptyTrackSelectorResult : playbackInfo.trackSelectorResult);
|
resetState ? emptyTrackSelectorResult : playbackInfo.trackSelectorResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -648,7 +652,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
|||||||
trackSelector.onSelectionActivated(playbackInfo.trackSelectorResult.info);
|
trackSelector.onSelectionActivated(playbackInfo.trackSelectorResult.info);
|
||||||
for (Player.EventListener listener : listeners) {
|
for (Player.EventListener listener : listeners) {
|
||||||
listener.onTracksChanged(
|
listener.onTracksChanged(
|
||||||
playbackInfo.trackSelectorResult.groups, playbackInfo.trackSelectorResult.selections);
|
playbackInfo.trackGroups, playbackInfo.trackSelectorResult.selections);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isLoadingChanged) {
|
if (isLoadingChanged) {
|
||||||
|
@ -31,6 +31,7 @@ import com.google.android.exoplayer2.source.MediaPeriod;
|
|||||||
import com.google.android.exoplayer2.source.MediaSource;
|
import com.google.android.exoplayer2.source.MediaSource;
|
||||||
import com.google.android.exoplayer2.source.MediaSource.MediaPeriodId;
|
import com.google.android.exoplayer2.source.MediaSource.MediaPeriodId;
|
||||||
import com.google.android.exoplayer2.source.SampleStream;
|
import com.google.android.exoplayer2.source.SampleStream;
|
||||||
|
import com.google.android.exoplayer2.source.TrackGroupArray;
|
||||||
import com.google.android.exoplayer2.trackselection.TrackSelection;
|
import com.google.android.exoplayer2.trackselection.TrackSelection;
|
||||||
import com.google.android.exoplayer2.trackselection.TrackSelector;
|
import com.google.android.exoplayer2.trackselection.TrackSelector;
|
||||||
import com.google.android.exoplayer2.trackselection.TrackSelectorResult;
|
import com.google.android.exoplayer2.trackselection.TrackSelectorResult;
|
||||||
@ -146,7 +147,10 @@ import java.util.Collections;
|
|||||||
seekParameters = SeekParameters.DEFAULT;
|
seekParameters = SeekParameters.DEFAULT;
|
||||||
playbackInfo =
|
playbackInfo =
|
||||||
new PlaybackInfo(
|
new PlaybackInfo(
|
||||||
Timeline.EMPTY, /* startPositionUs= */ C.TIME_UNSET, emptyTrackSelectorResult);
|
Timeline.EMPTY,
|
||||||
|
/* startPositionUs= */ C.TIME_UNSET,
|
||||||
|
TrackGroupArray.EMPTY,
|
||||||
|
emptyTrackSelectorResult);
|
||||||
playbackInfoUpdate = new PlaybackInfoUpdate();
|
playbackInfoUpdate = new PlaybackInfoUpdate();
|
||||||
rendererCapabilities = new RendererCapabilities[renderers.length];
|
rendererCapabilities = new RendererCapabilities[renderers.length];
|
||||||
for (int i = 0; i < renderers.length; i++) {
|
for (int i = 0; i < renderers.length; i++) {
|
||||||
@ -791,6 +795,7 @@ import java.util.Collections;
|
|||||||
resetPosition ? C.TIME_UNSET : playbackInfo.contentPositionUs,
|
resetPosition ? C.TIME_UNSET : playbackInfo.contentPositionUs,
|
||||||
playbackInfo.playbackState,
|
playbackInfo.playbackState,
|
||||||
/* isLoading= */ false,
|
/* isLoading= */ false,
|
||||||
|
resetState ? TrackGroupArray.EMPTY : playbackInfo.trackGroups,
|
||||||
resetState ? emptyTrackSelectorResult : playbackInfo.trackSelectorResult);
|
resetState ? emptyTrackSelectorResult : playbackInfo.trackSelectorResult);
|
||||||
if (releaseMediaSource) {
|
if (releaseMediaSource) {
|
||||||
if (mediaSource != null) {
|
if (mediaSource != null) {
|
||||||
@ -999,7 +1004,8 @@ import java.util.Collections;
|
|||||||
long periodPositionUs =
|
long periodPositionUs =
|
||||||
playingPeriodHolder.applyTrackSelection(
|
playingPeriodHolder.applyTrackSelection(
|
||||||
playbackInfo.positionUs, recreateStreams, streamResetFlags);
|
playbackInfo.positionUs, recreateStreams, streamResetFlags);
|
||||||
updateLoadControlTrackSelection(playingPeriodHolder.trackSelectorResult);
|
updateLoadControlTrackSelection(
|
||||||
|
playingPeriodHolder.trackGroups, playingPeriodHolder.trackSelectorResult);
|
||||||
if (playbackInfo.playbackState != Player.STATE_ENDED
|
if (playbackInfo.playbackState != Player.STATE_ENDED
|
||||||
&& periodPositionUs != playbackInfo.positionUs) {
|
&& periodPositionUs != playbackInfo.positionUs) {
|
||||||
playbackInfo = playbackInfo.fromNewPosition(playbackInfo.periodId, periodPositionUs,
|
playbackInfo = playbackInfo.fromNewPosition(playbackInfo.periodId, periodPositionUs,
|
||||||
@ -1028,7 +1034,8 @@ import java.util.Collections;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
playbackInfo =
|
playbackInfo =
|
||||||
playbackInfo.copyWithTrackSelectorResult(playingPeriodHolder.trackSelectorResult);
|
playbackInfo.copyWithTrackInfo(
|
||||||
|
playingPeriodHolder.trackGroups, playingPeriodHolder.trackSelectorResult);
|
||||||
enableRenderers(rendererWasEnabledFlags, enabledRendererCount);
|
enableRenderers(rendererWasEnabledFlags, enabledRendererCount);
|
||||||
} else {
|
} else {
|
||||||
// Release and re-prepare/buffer periods after the one whose selection changed.
|
// Release and re-prepare/buffer periods after the one whose selection changed.
|
||||||
@ -1038,7 +1045,7 @@ import java.util.Collections;
|
|||||||
Math.max(
|
Math.max(
|
||||||
periodHolder.info.startPositionUs, periodHolder.toPeriodTime(rendererPositionUs));
|
periodHolder.info.startPositionUs, periodHolder.toPeriodTime(rendererPositionUs));
|
||||||
periodHolder.applyTrackSelection(loadingPeriodPositionUs, false);
|
periodHolder.applyTrackSelection(loadingPeriodPositionUs, false);
|
||||||
updateLoadControlTrackSelection(periodHolder.trackSelectorResult);
|
updateLoadControlTrackSelection(periodHolder.trackGroups, periodHolder.trackSelectorResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (playbackInfo.playbackState != Player.STATE_ENDED) {
|
if (playbackInfo.playbackState != Player.STATE_ENDED) {
|
||||||
@ -1048,9 +1055,9 @@ import java.util.Collections;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateLoadControlTrackSelection(TrackSelectorResult trackSelectorResult) {
|
private void updateLoadControlTrackSelection(
|
||||||
loadControl.onTracksSelected(
|
TrackGroupArray trackGroups, TrackSelectorResult trackSelectorResult) {
|
||||||
renderers, trackSelectorResult.groups, trackSelectorResult.selections);
|
loadControl.onTracksSelected(renderers, trackGroups, trackSelectorResult.selections);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTrackSelectionPlaybackSpeed(float playbackSpeed) {
|
private void updateTrackSelectionPlaybackSpeed(float playbackSpeed) {
|
||||||
@ -1493,9 +1500,10 @@ import java.util.Collections;
|
|||||||
// Stale event.
|
// Stale event.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TrackSelectorResult trackSelectorResult =
|
MediaPeriodHolder loadingPeriodHolder = queue.getLoadingPeriod();
|
||||||
queue.handleLoadingPeriodPrepared(mediaClock.getPlaybackParameters().speed);
|
loadingPeriodHolder.handlePrepared(mediaClock.getPlaybackParameters().speed);
|
||||||
updateLoadControlTrackSelection(trackSelectorResult);
|
updateLoadControlTrackSelection(
|
||||||
|
loadingPeriodHolder.trackGroups, loadingPeriodHolder.trackSelectorResult);
|
||||||
if (!queue.hasPlayingPeriod()) {
|
if (!queue.hasPlayingPeriod()) {
|
||||||
// This is the first prepared period, so start playing it.
|
// This is the first prepared period, so start playing it.
|
||||||
MediaPeriodHolder playingPeriodHolder = queue.advancePlayingPeriod();
|
MediaPeriodHolder playingPeriodHolder = queue.advancePlayingPeriod();
|
||||||
@ -1557,7 +1565,8 @@ import java.util.Collections;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
playbackInfo =
|
playbackInfo =
|
||||||
playbackInfo.copyWithTrackSelectorResult(newPlayingPeriodHolder.trackSelectorResult);
|
playbackInfo.copyWithTrackInfo(
|
||||||
|
newPlayingPeriodHolder.trackGroups, newPlayingPeriodHolder.trackSelectorResult);
|
||||||
enableRenderers(rendererWasEnabledFlags, enabledRendererCount);
|
enableRenderers(rendererWasEnabledFlags, enabledRendererCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ import com.google.android.exoplayer2.source.EmptySampleStream;
|
|||||||
import com.google.android.exoplayer2.source.MediaPeriod;
|
import com.google.android.exoplayer2.source.MediaPeriod;
|
||||||
import com.google.android.exoplayer2.source.MediaSource;
|
import com.google.android.exoplayer2.source.MediaSource;
|
||||||
import com.google.android.exoplayer2.source.SampleStream;
|
import com.google.android.exoplayer2.source.SampleStream;
|
||||||
|
import com.google.android.exoplayer2.source.TrackGroupArray;
|
||||||
import com.google.android.exoplayer2.trackselection.TrackSelection;
|
import com.google.android.exoplayer2.trackselection.TrackSelection;
|
||||||
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
|
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
|
||||||
import com.google.android.exoplayer2.trackselection.TrackSelector;
|
import com.google.android.exoplayer2.trackselection.TrackSelector;
|
||||||
@ -43,6 +44,7 @@ import com.google.android.exoplayer2.util.Assertions;
|
|||||||
public boolean hasEnabledTracks;
|
public boolean hasEnabledTracks;
|
||||||
public MediaPeriodInfo info;
|
public MediaPeriodInfo info;
|
||||||
public MediaPeriodHolder next;
|
public MediaPeriodHolder next;
|
||||||
|
public TrackGroupArray trackGroups;
|
||||||
public TrackSelectorResult trackSelectorResult;
|
public TrackSelectorResult trackSelectorResult;
|
||||||
|
|
||||||
private final RendererCapabilities[] rendererCapabilities;
|
private final RendererCapabilities[] rendererCapabilities;
|
||||||
@ -132,13 +134,13 @@ import com.google.android.exoplayer2.util.Assertions;
|
|||||||
return !prepared ? 0 : mediaPeriod.getNextLoadPositionUs();
|
return !prepared ? 0 : mediaPeriod.getNextLoadPositionUs();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TrackSelectorResult handlePrepared(float playbackSpeed) throws ExoPlaybackException {
|
public void handlePrepared(float playbackSpeed) throws ExoPlaybackException {
|
||||||
prepared = true;
|
prepared = true;
|
||||||
|
trackGroups = mediaPeriod.getTrackGroups();
|
||||||
selectTracks(playbackSpeed);
|
selectTracks(playbackSpeed);
|
||||||
long newStartPositionUs = applyTrackSelection(info.startPositionUs, false);
|
long newStartPositionUs = applyTrackSelection(info.startPositionUs, false);
|
||||||
rendererPositionOffsetUs += info.startPositionUs - newStartPositionUs;
|
rendererPositionOffsetUs += info.startPositionUs - newStartPositionUs;
|
||||||
info = info.copyWithStartPositionUs(newStartPositionUs);
|
info = info.copyWithStartPositionUs(newStartPositionUs);
|
||||||
return trackSelectorResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reevaluateBuffer(long rendererPositionUs) {
|
public void reevaluateBuffer(long rendererPositionUs) {
|
||||||
@ -154,7 +156,7 @@ import com.google.android.exoplayer2.util.Assertions;
|
|||||||
|
|
||||||
public boolean selectTracks(float playbackSpeed) throws ExoPlaybackException {
|
public boolean selectTracks(float playbackSpeed) throws ExoPlaybackException {
|
||||||
TrackSelectorResult selectorResult =
|
TrackSelectorResult selectorResult =
|
||||||
trackSelector.selectTracks(rendererCapabilities, mediaPeriod.getTrackGroups());
|
trackSelector.selectTracks(rendererCapabilities, trackGroups);
|
||||||
if (selectorResult.isEquivalent(periodTrackSelectorResult)) {
|
if (selectorResult.isEquivalent(periodTrackSelectorResult)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@ import com.google.android.exoplayer2.source.MediaPeriod;
|
|||||||
import com.google.android.exoplayer2.source.MediaSource;
|
import com.google.android.exoplayer2.source.MediaSource;
|
||||||
import com.google.android.exoplayer2.source.MediaSource.MediaPeriodId;
|
import com.google.android.exoplayer2.source.MediaSource.MediaPeriodId;
|
||||||
import com.google.android.exoplayer2.trackselection.TrackSelector;
|
import com.google.android.exoplayer2.trackselection.TrackSelector;
|
||||||
import com.google.android.exoplayer2.trackselection.TrackSelectorResult;
|
|
||||||
import com.google.android.exoplayer2.upstream.Allocator;
|
import com.google.android.exoplayer2.upstream.Allocator;
|
||||||
import com.google.android.exoplayer2.util.Assertions;
|
import com.google.android.exoplayer2.util.Assertions;
|
||||||
|
|
||||||
@ -168,17 +167,6 @@ import com.google.android.exoplayer2.util.Assertions;
|
|||||||
return newPeriodHolder.mediaPeriod;
|
return newPeriodHolder.mediaPeriod;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles the loading media period being prepared.
|
|
||||||
*
|
|
||||||
* @param playbackSpeed The current playback speed.
|
|
||||||
* @return The result of selecting tracks on the newly prepared loading media period.
|
|
||||||
*/
|
|
||||||
public TrackSelectorResult handleLoadingPeriodPrepared(float playbackSpeed)
|
|
||||||
throws ExoPlaybackException {
|
|
||||||
return loading.handlePrepared(playbackSpeed);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the loading period holder which is at the end of the queue, or null if the queue is
|
* Returns the loading period holder which is at the end of the queue, or null if the queue is
|
||||||
* empty.
|
* empty.
|
||||||
|
@ -13,10 +13,11 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.google.android.exoplayer2;
|
package com.google.android.exoplayer2;
|
||||||
|
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import com.google.android.exoplayer2.source.MediaSource.MediaPeriodId;
|
import com.google.android.exoplayer2.source.MediaSource.MediaPeriodId;
|
||||||
|
import com.google.android.exoplayer2.source.TrackGroupArray;
|
||||||
import com.google.android.exoplayer2.trackselection.TrackSelectorResult;
|
import com.google.android.exoplayer2.trackselection.TrackSelectorResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,13 +32,17 @@ import com.google.android.exoplayer2.trackselection.TrackSelectorResult;
|
|||||||
public final long contentPositionUs;
|
public final long contentPositionUs;
|
||||||
public final int playbackState;
|
public final int playbackState;
|
||||||
public final boolean isLoading;
|
public final boolean isLoading;
|
||||||
|
public final TrackGroupArray trackGroups;
|
||||||
public final TrackSelectorResult trackSelectorResult;
|
public final TrackSelectorResult trackSelectorResult;
|
||||||
|
|
||||||
public volatile long positionUs;
|
public volatile long positionUs;
|
||||||
public volatile long bufferedPositionUs;
|
public volatile long bufferedPositionUs;
|
||||||
|
|
||||||
public PlaybackInfo(
|
public PlaybackInfo(
|
||||||
Timeline timeline, long startPositionUs, TrackSelectorResult trackSelectorResult) {
|
Timeline timeline,
|
||||||
|
long startPositionUs,
|
||||||
|
TrackGroupArray trackGroups,
|
||||||
|
TrackSelectorResult trackSelectorResult) {
|
||||||
this(
|
this(
|
||||||
timeline,
|
timeline,
|
||||||
/* manifest= */ null,
|
/* manifest= */ null,
|
||||||
@ -46,6 +51,7 @@ import com.google.android.exoplayer2.trackselection.TrackSelectorResult;
|
|||||||
/* contentPositionUs =*/ C.TIME_UNSET,
|
/* contentPositionUs =*/ C.TIME_UNSET,
|
||||||
Player.STATE_IDLE,
|
Player.STATE_IDLE,
|
||||||
/* isLoading= */ false,
|
/* isLoading= */ false,
|
||||||
|
trackGroups,
|
||||||
trackSelectorResult);
|
trackSelectorResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,6 +63,7 @@ import com.google.android.exoplayer2.trackselection.TrackSelectorResult;
|
|||||||
long contentPositionUs,
|
long contentPositionUs,
|
||||||
int playbackState,
|
int playbackState,
|
||||||
boolean isLoading,
|
boolean isLoading,
|
||||||
|
TrackGroupArray trackGroups,
|
||||||
TrackSelectorResult trackSelectorResult) {
|
TrackSelectorResult trackSelectorResult) {
|
||||||
this.timeline = timeline;
|
this.timeline = timeline;
|
||||||
this.manifest = manifest;
|
this.manifest = manifest;
|
||||||
@ -67,11 +74,12 @@ import com.google.android.exoplayer2.trackselection.TrackSelectorResult;
|
|||||||
this.bufferedPositionUs = startPositionUs;
|
this.bufferedPositionUs = startPositionUs;
|
||||||
this.playbackState = playbackState;
|
this.playbackState = playbackState;
|
||||||
this.isLoading = isLoading;
|
this.isLoading = isLoading;
|
||||||
|
this.trackGroups = trackGroups;
|
||||||
this.trackSelectorResult = trackSelectorResult;
|
this.trackSelectorResult = trackSelectorResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlaybackInfo fromNewPosition(MediaPeriodId periodId, long startPositionUs,
|
public PlaybackInfo fromNewPosition(
|
||||||
long contentPositionUs) {
|
MediaPeriodId periodId, long startPositionUs, long contentPositionUs) {
|
||||||
return new PlaybackInfo(
|
return new PlaybackInfo(
|
||||||
timeline,
|
timeline,
|
||||||
manifest,
|
manifest,
|
||||||
@ -80,6 +88,7 @@ import com.google.android.exoplayer2.trackselection.TrackSelectorResult;
|
|||||||
periodId.isAd() ? contentPositionUs : C.TIME_UNSET,
|
periodId.isAd() ? contentPositionUs : C.TIME_UNSET,
|
||||||
playbackState,
|
playbackState,
|
||||||
isLoading,
|
isLoading,
|
||||||
|
trackGroups,
|
||||||
trackSelectorResult);
|
trackSelectorResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,6 +102,7 @@ import com.google.android.exoplayer2.trackselection.TrackSelectorResult;
|
|||||||
contentPositionUs,
|
contentPositionUs,
|
||||||
playbackState,
|
playbackState,
|
||||||
isLoading,
|
isLoading,
|
||||||
|
trackGroups,
|
||||||
trackSelectorResult);
|
trackSelectorResult);
|
||||||
copyMutablePositions(this, playbackInfo);
|
copyMutablePositions(this, playbackInfo);
|
||||||
return playbackInfo;
|
return playbackInfo;
|
||||||
@ -108,6 +118,7 @@ import com.google.android.exoplayer2.trackselection.TrackSelectorResult;
|
|||||||
contentPositionUs,
|
contentPositionUs,
|
||||||
playbackState,
|
playbackState,
|
||||||
isLoading,
|
isLoading,
|
||||||
|
trackGroups,
|
||||||
trackSelectorResult);
|
trackSelectorResult);
|
||||||
copyMutablePositions(this, playbackInfo);
|
copyMutablePositions(this, playbackInfo);
|
||||||
return playbackInfo;
|
return playbackInfo;
|
||||||
@ -123,6 +134,7 @@ import com.google.android.exoplayer2.trackselection.TrackSelectorResult;
|
|||||||
contentPositionUs,
|
contentPositionUs,
|
||||||
playbackState,
|
playbackState,
|
||||||
isLoading,
|
isLoading,
|
||||||
|
trackGroups,
|
||||||
trackSelectorResult);
|
trackSelectorResult);
|
||||||
copyMutablePositions(this, playbackInfo);
|
copyMutablePositions(this, playbackInfo);
|
||||||
return playbackInfo;
|
return playbackInfo;
|
||||||
@ -138,12 +150,14 @@ import com.google.android.exoplayer2.trackselection.TrackSelectorResult;
|
|||||||
contentPositionUs,
|
contentPositionUs,
|
||||||
playbackState,
|
playbackState,
|
||||||
isLoading,
|
isLoading,
|
||||||
|
trackGroups,
|
||||||
trackSelectorResult);
|
trackSelectorResult);
|
||||||
copyMutablePositions(this, playbackInfo);
|
copyMutablePositions(this, playbackInfo);
|
||||||
return playbackInfo;
|
return playbackInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlaybackInfo copyWithTrackSelectorResult(TrackSelectorResult trackSelectorResult) {
|
public PlaybackInfo copyWithTrackInfo(
|
||||||
|
TrackGroupArray trackGroups, TrackSelectorResult trackSelectorResult) {
|
||||||
PlaybackInfo playbackInfo =
|
PlaybackInfo playbackInfo =
|
||||||
new PlaybackInfo(
|
new PlaybackInfo(
|
||||||
timeline,
|
timeline,
|
||||||
@ -153,6 +167,7 @@ import com.google.android.exoplayer2.trackselection.TrackSelectorResult;
|
|||||||
contentPositionUs,
|
contentPositionUs,
|
||||||
playbackState,
|
playbackState,
|
||||||
isLoading,
|
isLoading,
|
||||||
|
trackGroups,
|
||||||
trackSelectorResult);
|
trackSelectorResult);
|
||||||
copyMutablePositions(this, playbackInfo);
|
copyMutablePositions(this, playbackInfo);
|
||||||
return playbackInfo;
|
return playbackInfo;
|
||||||
|
@ -597,8 +597,11 @@ public abstract class MappingTrackSelector extends TrackSelector {
|
|||||||
maybeConfigureRenderersForTunneling(rendererCapabilities, rendererTrackGroupArrays,
|
maybeConfigureRenderersForTunneling(rendererCapabilities, rendererTrackGroupArrays,
|
||||||
rendererFormatSupports, rendererConfigurations, trackSelections, tunnelingAudioSessionId);
|
rendererFormatSupports, rendererConfigurations, trackSelections, tunnelingAudioSessionId);
|
||||||
|
|
||||||
return new TrackSelectorResult(trackGroups, rendererEnabled,
|
return new TrackSelectorResult(
|
||||||
new TrackSelectionArray(trackSelections), mappedTrackInfo, rendererConfigurations);
|
rendererEnabled,
|
||||||
|
new TrackSelectionArray(trackSelections),
|
||||||
|
mappedTrackInfo,
|
||||||
|
rendererConfigurations);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean[] determineEnabledRenderers(RendererCapabilities[] rendererCapabilities,
|
private boolean[] determineEnabledRenderers(RendererCapabilities[] rendererCapabilities,
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
package com.google.android.exoplayer2.trackselection;
|
package com.google.android.exoplayer2.trackselection;
|
||||||
|
|
||||||
import com.google.android.exoplayer2.RendererConfiguration;
|
import com.google.android.exoplayer2.RendererConfiguration;
|
||||||
import com.google.android.exoplayer2.source.TrackGroupArray;
|
|
||||||
import com.google.android.exoplayer2.util.Util;
|
import com.google.android.exoplayer2.util.Util;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -24,10 +23,6 @@ import com.google.android.exoplayer2.util.Util;
|
|||||||
*/
|
*/
|
||||||
public final class TrackSelectorResult {
|
public final class TrackSelectorResult {
|
||||||
|
|
||||||
/**
|
|
||||||
* The track groups that were provided to the {@link TrackSelector}.
|
|
||||||
*/
|
|
||||||
public final TrackGroupArray groups;
|
|
||||||
/**
|
/**
|
||||||
* An array containing whether each renderer is enabled after the track selection operation.
|
* An array containing whether each renderer is enabled after the track selection operation.
|
||||||
*/
|
*/
|
||||||
@ -47,19 +42,19 @@ public final class TrackSelectorResult {
|
|||||||
public final RendererConfiguration[] rendererConfigurations;
|
public final RendererConfiguration[] rendererConfigurations;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param groups The track groups provided to the {@link TrackSelector}.
|
|
||||||
* @param renderersEnabled An array containing whether each renderer is enabled after the track
|
* @param renderersEnabled An array containing whether each renderer is enabled after the track
|
||||||
* selection operation.
|
* selection operation.
|
||||||
* @param selections A {@link TrackSelectionArray} containing the selection for each renderer.
|
* @param selections A {@link TrackSelectionArray} containing the selection for each renderer.
|
||||||
* @param info An opaque object that will be returned to
|
* @param info An opaque object that will be returned to {@link
|
||||||
* {@link TrackSelector#onSelectionActivated(Object)} should the selection be activated.
|
* TrackSelector#onSelectionActivated(Object)} should the selection be activated.
|
||||||
* @param rendererConfigurations A {@link RendererConfiguration} for each enabled renderer,
|
* @param rendererConfigurations A {@link RendererConfiguration} for each enabled renderer, to be
|
||||||
* to be used with the selections.
|
* used with the selections.
|
||||||
*/
|
*/
|
||||||
public TrackSelectorResult(TrackGroupArray groups, boolean[] renderersEnabled,
|
public TrackSelectorResult(
|
||||||
TrackSelectionArray selections, Object info,
|
boolean[] renderersEnabled,
|
||||||
|
TrackSelectionArray selections,
|
||||||
|
Object info,
|
||||||
RendererConfiguration[] rendererConfigurations) {
|
RendererConfiguration[] rendererConfigurations) {
|
||||||
this.groups = groups;
|
|
||||||
this.renderersEnabled = renderersEnabled;
|
this.renderersEnabled = renderersEnabled;
|
||||||
this.selections = selections;
|
this.selections = selections;
|
||||||
this.info = info;
|
this.info = info;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user