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
b0ac959e
authored
Dec 21, 2022
by
kimvde
Committed by
Marc Baechinger
Jan 04, 2023
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add IntRange annotation to onTrackCount
PiperOrigin-RevId: 496942702
parent
6ffef38c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
4 deletions
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/AssetLoader.java
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/ExoPlayerAssetLoader.java
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/TransformerInternal.java
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/AssetLoader.java
View file @
b0ac959e
...
...
@@ -18,6 +18,7 @@ package com.google.android.exoplayer2.transformer;
import
android.content.Context
;
import
android.os.Looper
;
import
androidx.annotation.IntRange
;
import
com.google.android.exoplayer2.Format
;
import
com.google.android.exoplayer2.MediaItem
;
import
com.google.android.exoplayer2.util.Clock
;
...
...
@@ -129,7 +130,7 @@ public interface AssetLoader {
void
onDurationUs
(
long
durationUs
);
/** Called when the number of tracks output by the asset loader is known. */
void
onTrackCount
(
int
trackCount
);
void
onTrackCount
(
@IntRange
(
from
=
1
)
int
trackCount
);
/**
* Called when the information on a track is known.
...
...
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/ExoPlayerAssetLoader.java
View file @
b0ac959e
...
...
@@ -20,6 +20,7 @@ import static com.google.android.exoplayer2.DefaultLoadControl.DEFAULT_BUFFER_FO
import
static
com
.
google
.
android
.
exoplayer2
.
DefaultLoadControl
.
DEFAULT_BUFFER_FOR_PLAYBACK_MS
;
import
static
com
.
google
.
android
.
exoplayer2
.
DefaultLoadControl
.
DEFAULT_MAX_BUFFER_MS
;
import
static
com
.
google
.
android
.
exoplayer2
.
DefaultLoadControl
.
DEFAULT_MIN_BUFFER_MS
;
import
static
com
.
google
.
android
.
exoplayer2
.
PlaybackException
.
ERROR_CODE_FAILED_RUNTIME_CHECK
;
import
static
com
.
google
.
android
.
exoplayer2
.
transformer
.
Transformer
.
PROGRESS_STATE_AVAILABLE
;
import
static
com
.
google
.
android
.
exoplayer2
.
transformer
.
Transformer
.
PROGRESS_STATE_NOT_STARTED
;
import
static
com
.
google
.
android
.
exoplayer2
.
transformer
.
Transformer
.
PROGRESS_STATE_UNAVAILABLE
;
...
...
@@ -348,7 +349,15 @@ public final class ExoPlayerAssetLoader implements AssetLoader {
if
(
tracks
.
isTypeSelected
(
C
.
TRACK_TYPE_VIDEO
))
{
trackCount
++;
}
assetLoaderListener
.
onTrackCount
(
trackCount
);
if
(
trackCount
==
0
)
{
assetLoaderListener
.
onError
(
new
PlaybackException
(
"The asset loader has no track to output."
,
/* cause= */
null
,
ERROR_CODE_FAILED_RUNTIME_CHECK
));
}
else
{
assetLoaderListener
.
onTrackCount
(
trackCount
);
}
}
@Override
...
...
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/TransformerInternal.java
View file @
b0ac959e
...
...
@@ -401,8 +401,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
@Override
public
void
onTrackCount
(
int
trackCount
)
{
if
(
trackCount
==
0
)
{
onError
(
new
IllegalStateException
(
"The output does not contain any tracks."
));
if
(
trackCount
<=
0
)
{
onError
(
new
IllegalStateException
(
"AssetLoader instances must provide at least 1 track."
));
return
;
}
this
.
trackCount
.
set
(
trackCount
);
if
(
forceSilentAudio
)
{
...
...
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