Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8c3e6663
authored
Nov 18, 2019
by
olly
Committed by
Oliver Woodman
Nov 19, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Clean up non-trivial track selection deprecation
PiperOrigin-RevId: 281051893
parent
da9c985c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
35 deletions
library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadHelper.java
library/core/src/main/java/com/google/android/exoplayer2/trackselection/TrackSelection.java
testutils/src/main/java/com/google/android/exoplayer2/testutil/MediaPeriodAsserts.java
library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadHelper.java
View file @
8c3e6663
...
...
@@ -37,6 +37,8 @@ import com.google.android.exoplayer2.source.MediaSourceFactory;
import
com.google.android.exoplayer2.source.ProgressiveMediaSource
;
import
com.google.android.exoplayer2.source.TrackGroup
;
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.DefaultTrackSelector
;
import
com.google.android.exoplayer2.trackselection.DefaultTrackSelector.Parameters
;
...
...
@@ -1100,6 +1102,16 @@ public final class DownloadHelper {
public
Object
getSelectionData
()
{
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
{
...
...
library/core/src/main/java/com/google/android/exoplayer2/trackselection/TrackSelection.java
View file @
8c3e6663
...
...
@@ -21,7 +21,6 @@ import com.google.android.exoplayer2.Format;
import
com.google.android.exoplayer2.source.TrackGroup
;
import
com.google.android.exoplayer2.source.chunk.MediaChunk
;
import
com.google.android.exoplayer2.source.chunk.MediaChunkIterator
;
import
com.google.android.exoplayer2.trackselection.TrackSelectionUtil.AdaptiveTrackSelectionFactory
;
import
com.google.android.exoplayer2.upstream.BandwidthMeter
;
import
java.util.List
;
import
org.checkerframework.checker.nullness.compatqual.NullableType
;
...
...
@@ -77,32 +76,19 @@ public interface TrackSelection {
interface
Factory
{
/**
* @deprecated Implement {@link #createTrackSelections(Definition[], BandwidthMeter)} instead.
* Calling {@link TrackSelectionUtil#createTrackSelectionsForDefinitions(Definition[],
* AdaptiveTrackSelectionFactory)} helps to create a single adaptive track selection in the
* same way as using this deprecated method.
*/
@Deprecated
default
TrackSelection
createTrackSelection
(
TrackGroup
group
,
BandwidthMeter
bandwidthMeter
,
int
...
tracks
)
{
throw
new
UnsupportedOperationException
();
}
/**
* Creates a new selection for each {@link Definition}.
* Creates track selections for the provided {@link Definition Definitions}.
*
* <p>Implementations that create at most one adaptive track selection may use {@link
* TrackSelectionUtil#createTrackSelectionsForDefinitions}.
*
* @param definitions A {@link Definition} array. May include null values.
* @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
* include null values.
*/
@SuppressWarnings
(
"deprecation"
)
default
@NullableType
TrackSelection
[]
createTrackSelections
(
@NullableType
Definition
[]
definitions
,
BandwidthMeter
bandwidthMeter
)
{
return
TrackSelectionUtil
.
createTrackSelectionsForDefinitions
(
definitions
,
definition
->
createTrackSelection
(
definition
.
group
,
bandwidthMeter
,
definition
.
tracks
));
}
@NullableType
TrackSelection
[]
createTrackSelections
(
@NullableType
Definition
[]
definitions
,
BandwidthMeter
bandwidthMeter
);
}
/**
...
...
@@ -214,16 +200,6 @@ public interface TrackSelection {
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.
*
* <p>This method may only be called when the selection is enabled.
...
...
@@ -247,14 +223,12 @@ public interface TrackSelection {
* that this information may not be available for all tracks, and so some iterators may be
* empty.
*/
default
void
updateSelectedTrack
(
void
updateSelectedTrack
(
long
playbackPositionUs
,
long
bufferedDurationUs
,
long
availableDurationUs
,
List
<?
extends
MediaChunk
>
queue
,
MediaChunkIterator
[]
mediaChunkIterators
)
{
updateSelectedTrack
(
playbackPositionUs
,
bufferedDurationUs
,
availableDurationUs
);
}
MediaChunkIterator
[]
mediaChunkIterators
);
/**
* May be called periodically by sources that load media in discrete {@link MediaChunk}s and
...
...
testutils/src/main/java/com/google/android/exoplayer2/testutil/MediaPeriodAsserts.java
View file @
8c3e6663
...
...
@@ -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.TrackGroup
;
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.TrackSelection
;
import
com.google.android.exoplayer2.util.ConditionVariable
;
...
...
@@ -234,5 +236,15 @@ public final class MediaPeriodAsserts {
public
Object
getSelectionData
()
{
return
null
;
}
@Override
public
void
updateSelectedTrack
(
long
playbackPositionUs
,
long
bufferedDurationUs
,
long
availableDurationUs
,
List
<?
extends
MediaChunk
>
queue
,
MediaChunkIterator
[]
mediaChunkIterators
)
{
// Do nothing.
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment