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
d7df4260
authored
Mar 04, 2022
by
olly
Committed by
Ian Baker
Mar 04, 2022
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Simplify application of track overrides
PiperOrigin-RevId: 432485797
parent
aafe5f48
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
1 deletions
library/core/src/main/java/com/google/android/exoplayer2/trackselection/DefaultTrackSelector.java
library/core/src/main/java/com/google/android/exoplayer2/trackselection/ExoTrackSelection.java
testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeTrackSelector.java
library/core/src/main/java/com/google/android/exoplayer2/trackselection/DefaultTrackSelector.java
View file @
d7df4260
This diff is collapsed.
Click to expand it.
library/core/src/main/java/com/google/android/exoplayer2/trackselection/ExoTrackSelection.java
View file @
d7df4260
...
...
@@ -25,6 +25,7 @@ import com.google.android.exoplayer2.source.chunk.Chunk;
import
com.google.android.exoplayer2.source.chunk.MediaChunk
;
import
com.google.android.exoplayer2.source.chunk.MediaChunkIterator
;
import
com.google.android.exoplayer2.upstream.BandwidthMeter
;
import
com.google.android.exoplayer2.util.Log
;
import
java.util.List
;
import
org.checkerframework.checker.nullness.compatqual.NullableType
;
...
...
@@ -45,6 +46,8 @@ public interface ExoTrackSelection extends TrackSelection {
/** The type that will be returned from {@link TrackSelection#getType()}. */
public
final
@Type
int
type
;
private
static
final
String
TAG
=
"ETSDefinition"
;
/**
* @param group The {@link TrackGroup}. Must not be null.
* @param tracks The indices of the selected tracks within the {@link TrackGroup}. Must not be
...
...
@@ -61,6 +64,10 @@ public interface ExoTrackSelection extends TrackSelection {
* @param type The type that will be returned from {@link TrackSelection#getType()}.
*/
public
Definition
(
TrackGroup
group
,
int
[]
tracks
,
@Type
int
type
)
{
if
(
tracks
.
length
==
0
)
{
// TODO: Turn this into an assertion.
Log
.
e
(
TAG
,
"Empty tracks are not allowed"
,
new
IllegalArgumentException
());
}
this
.
group
=
group
;
this
.
tracks
=
tracks
;
this
.
type
=
type
;
...
...
testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeTrackSelector.java
View file @
d7df4260
...
...
@@ -65,7 +65,10 @@ public class FakeTrackSelector extends DefaultTrackSelector {
for
(
int
i
=
0
;
i
<
rendererCount
;
i
++)
{
TrackGroupArray
trackGroupArray
=
mappedTrackInfo
.
getTrackGroups
(
i
);
boolean
hasTracks
=
trackGroupArray
.
length
>
0
;
definitions
[
i
]
=
hasTracks
?
new
ExoTrackSelection
.
Definition
(
trackGroupArray
.
get
(
0
))
:
null
;
definitions
[
i
]
=
hasTracks
?
new
ExoTrackSelection
.
Definition
(
trackGroupArray
.
get
(
0
),
/* tracks...= */
0
)
:
null
;
}
return
definitions
;
}
...
...
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