mirror of
https://github.com/androidx/media.git
synced 2025-05-03 21:57:46 +08:00
Clean up non-trivial track selection deprecation
PiperOrigin-RevId: 281051893
This commit is contained in:
parent
da9c985cce
commit
8c3e6663d3
@ -37,6 +37,8 @@ import com.google.android.exoplayer2.source.MediaSourceFactory;
|
|||||||
import com.google.android.exoplayer2.source.ProgressiveMediaSource;
|
import com.google.android.exoplayer2.source.ProgressiveMediaSource;
|
||||||
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.source.chunk.MediaChunk;
|
||||||
|
import com.google.android.exoplayer2.source.chunk.MediaChunkIterator;
|
||||||
import com.google.android.exoplayer2.trackselection.BaseTrackSelection;
|
import com.google.android.exoplayer2.trackselection.BaseTrackSelection;
|
||||||
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
|
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
|
||||||
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector.Parameters;
|
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector.Parameters;
|
||||||
@ -1100,6 +1102,16 @@ public final class DownloadHelper {
|
|||||||
public Object getSelectionData() {
|
public Object getSelectionData() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateSelectedTrack(
|
||||||
|
long playbackPositionUs,
|
||||||
|
long bufferedDurationUs,
|
||||||
|
long availableDurationUs,
|
||||||
|
List<? extends MediaChunk> queue,
|
||||||
|
MediaChunkIterator[] mediaChunkIterators) {
|
||||||
|
// Do nothing.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class DummyBandwidthMeter implements BandwidthMeter {
|
private static final class DummyBandwidthMeter implements BandwidthMeter {
|
||||||
|
@ -21,7 +21,6 @@ import com.google.android.exoplayer2.Format;
|
|||||||
import com.google.android.exoplayer2.source.TrackGroup;
|
import com.google.android.exoplayer2.source.TrackGroup;
|
||||||
import com.google.android.exoplayer2.source.chunk.MediaChunk;
|
import com.google.android.exoplayer2.source.chunk.MediaChunk;
|
||||||
import com.google.android.exoplayer2.source.chunk.MediaChunkIterator;
|
import com.google.android.exoplayer2.source.chunk.MediaChunkIterator;
|
||||||
import com.google.android.exoplayer2.trackselection.TrackSelectionUtil.AdaptiveTrackSelectionFactory;
|
|
||||||
import com.google.android.exoplayer2.upstream.BandwidthMeter;
|
import com.google.android.exoplayer2.upstream.BandwidthMeter;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.checkerframework.checker.nullness.compatqual.NullableType;
|
import org.checkerframework.checker.nullness.compatqual.NullableType;
|
||||||
@ -77,32 +76,19 @@ public interface TrackSelection {
|
|||||||
interface Factory {
|
interface Factory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Implement {@link #createTrackSelections(Definition[], BandwidthMeter)} instead.
|
* Creates track selections for the provided {@link Definition Definitions}.
|
||||||
* Calling {@link TrackSelectionUtil#createTrackSelectionsForDefinitions(Definition[],
|
*
|
||||||
* AdaptiveTrackSelectionFactory)} helps to create a single adaptive track selection in the
|
* <p>Implementations that create at most one adaptive track selection may use {@link
|
||||||
* same way as using this deprecated method.
|
* TrackSelectionUtil#createTrackSelectionsForDefinitions}.
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
default TrackSelection createTrackSelection(
|
|
||||||
TrackGroup group, BandwidthMeter bandwidthMeter, int... tracks) {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new selection for each {@link Definition}.
|
|
||||||
*
|
*
|
||||||
* @param definitions A {@link Definition} array. May include null values.
|
* @param definitions A {@link Definition} array. May include null values.
|
||||||
* @param bandwidthMeter A {@link BandwidthMeter} which can be used to select tracks.
|
* @param bandwidthMeter A {@link BandwidthMeter} which can be used to select tracks.
|
||||||
* @return The created selections. Must have the same length as {@code definitions} and may
|
* @return The created selections. Must have the same length as {@code definitions} and may
|
||||||
* include null values.
|
* include null values.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
@NullableType
|
||||||
default @NullableType TrackSelection[] createTrackSelections(
|
TrackSelection[] createTrackSelections(
|
||||||
@NullableType Definition[] definitions, BandwidthMeter bandwidthMeter) {
|
@NullableType Definition[] definitions, BandwidthMeter bandwidthMeter);
|
||||||
return TrackSelectionUtil.createTrackSelectionsForDefinitions(
|
|
||||||
definitions,
|
|
||||||
definition -> createTrackSelection(definition.group, bandwidthMeter, definition.tracks));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -213,16 +199,6 @@ public interface TrackSelection {
|
|||||||
*/
|
*/
|
||||||
default void onDiscontinuity() {}
|
default void onDiscontinuity() {}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use and implement {@link #updateSelectedTrack(long, long, long, List,
|
|
||||||
* MediaChunkIterator[])} instead.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
default void updateSelectedTrack(
|
|
||||||
long playbackPositionUs, long bufferedDurationUs, long availableDurationUs) {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the selected track for sources that load media in discrete {@link MediaChunk}s.
|
* Updates the selected track for sources that load media in discrete {@link MediaChunk}s.
|
||||||
*
|
*
|
||||||
@ -247,14 +223,12 @@ public interface TrackSelection {
|
|||||||
* that this information may not be available for all tracks, and so some iterators may be
|
* that this information may not be available for all tracks, and so some iterators may be
|
||||||
* empty.
|
* empty.
|
||||||
*/
|
*/
|
||||||
default void updateSelectedTrack(
|
void updateSelectedTrack(
|
||||||
long playbackPositionUs,
|
long playbackPositionUs,
|
||||||
long bufferedDurationUs,
|
long bufferedDurationUs,
|
||||||
long availableDurationUs,
|
long availableDurationUs,
|
||||||
List<? extends MediaChunk> queue,
|
List<? extends MediaChunk> queue,
|
||||||
MediaChunkIterator[] mediaChunkIterators) {
|
MediaChunkIterator[] mediaChunkIterators);
|
||||||
updateSelectedTrack(playbackPositionUs, bufferedDurationUs, availableDurationUs);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* May be called periodically by sources that load media in discrete {@link MediaChunk}s and
|
* May be called periodically by sources that load media in discrete {@link MediaChunk}s and
|
||||||
|
@ -26,6 +26,8 @@ import com.google.android.exoplayer2.source.MediaPeriod;
|
|||||||
import com.google.android.exoplayer2.source.MediaPeriod.Callback;
|
import com.google.android.exoplayer2.source.MediaPeriod.Callback;
|
||||||
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.source.chunk.MediaChunk;
|
||||||
|
import com.google.android.exoplayer2.source.chunk.MediaChunkIterator;
|
||||||
import com.google.android.exoplayer2.trackselection.BaseTrackSelection;
|
import com.google.android.exoplayer2.trackselection.BaseTrackSelection;
|
||||||
import com.google.android.exoplayer2.trackselection.TrackSelection;
|
import com.google.android.exoplayer2.trackselection.TrackSelection;
|
||||||
import com.google.android.exoplayer2.util.ConditionVariable;
|
import com.google.android.exoplayer2.util.ConditionVariable;
|
||||||
@ -234,5 +236,15 @@ public final class MediaPeriodAsserts {
|
|||||||
public Object getSelectionData() {
|
public Object getSelectionData() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateSelectedTrack(
|
||||||
|
long playbackPositionUs,
|
||||||
|
long bufferedDurationUs,
|
||||||
|
long availableDurationUs,
|
||||||
|
List<? extends MediaChunk> queue,
|
||||||
|
MediaChunkIterator[] mediaChunkIterators) {
|
||||||
|
// Do nothing.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user