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
8dd564c9
authored
Jul 21, 2020
by
kimvde
Committed by
Oliver Woodman
Jul 24, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Remove Mp4Extractor from nullness exclusion list
PiperOrigin-RevId: 322310474
parent
73df8e4a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/Mp4Extractor.java
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/Mp4Extractor.java
View file @
8dd564c9
...
@@ -16,6 +16,8 @@
...
@@ -16,6 +16,8 @@
package
com
.
google
.
android
.
exoplayer2
.
extractor
.
mp4
;
package
com
.
google
.
android
.
exoplayer2
.
extractor
.
mp4
;
import
static
com
.
google
.
android
.
exoplayer2
.
extractor
.
mp4
.
AtomParsers
.
parseTraks
;
import
static
com
.
google
.
android
.
exoplayer2
.
extractor
.
mp4
.
AtomParsers
.
parseTraks
;
import
static
com
.
google
.
android
.
exoplayer2
.
util
.
Assertions
.
checkNotNull
;
import
static
com
.
google
.
android
.
exoplayer2
.
util
.
Util
.
castNonNull
;
import
androidx.annotation.IntDef
;
import
androidx.annotation.IntDef
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
...
@@ -46,6 +48,7 @@ import java.util.ArrayDeque;
...
@@ -46,6 +48,7 @@ import java.util.ArrayDeque;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
org.checkerframework.checker.nullness.qual.MonotonicNonNull
;
import
org.checkerframework.checker.nullness.qual.MonotonicNonNull
;
import
org.checkerframework.checker.nullness.qual.RequiresNonNull
;
/**
/**
* Extracts data from the MP4 container format.
* Extracts data from the MP4 container format.
...
@@ -118,8 +121,8 @@ public final class Mp4Extractor implements Extractor, SeekMap {
...
@@ -118,8 +121,8 @@ public final class Mp4Extractor implements Extractor, SeekMap {
// Extractor outputs.
// Extractor outputs.
private
@MonotonicNonNull
ExtractorOutput
extractorOutput
;
private
@MonotonicNonNull
ExtractorOutput
extractorOutput
;
private
Mp4Track
[]
tracks
;
private
Mp4Track
@MonotonicNonNull
[]
tracks
;
private
long
[][]
accumulatedSampleSizes
;
private
long
@MonotonicNonNull
[][]
accumulatedSampleSizes
;
private
int
firstVideoTrackIndex
;
private
int
firstVideoTrackIndex
;
private
long
durationUs
;
private
long
durationUs
;
private
boolean
isQuickTime
;
private
boolean
isQuickTime
;
...
@@ -213,7 +216,7 @@ public final class Mp4Extractor implements Extractor, SeekMap {
...
@@ -213,7 +216,7 @@ public final class Mp4Extractor implements Extractor, SeekMap {
@Override
@Override
public
SeekPoints
getSeekPoints
(
long
timeUs
)
{
public
SeekPoints
getSeekPoints
(
long
timeUs
)
{
if
(
tracks
.
length
==
0
)
{
if
(
checkNotNull
(
tracks
)
.
length
==
0
)
{
return
new
SeekPoints
(
SeekPoint
.
START
);
return
new
SeekPoints
(
SeekPoint
.
START
);
}
}
...
@@ -346,6 +349,7 @@ public final class Mp4Extractor implements Extractor, SeekMap {
...
@@ -346,6 +349,7 @@ public final class Mp4Extractor implements Extractor, SeekMap {
long
atomPayloadSize
=
atomSize
-
atomHeaderBytesRead
;
long
atomPayloadSize
=
atomSize
-
atomHeaderBytesRead
;
long
atomEndPosition
=
input
.
getPosition
()
+
atomPayloadSize
;
long
atomEndPosition
=
input
.
getPosition
()
+
atomPayloadSize
;
boolean
seekRequired
=
false
;
boolean
seekRequired
=
false
;
@Nullable
ParsableByteArray
atomData
=
this
.
atomData
;
if
(
atomData
!=
null
)
{
if
(
atomData
!=
null
)
{
input
.
readFully
(
atomData
.
data
,
atomHeaderBytesRead
,
(
int
)
atomPayloadSize
);
input
.
readFully
(
atomData
.
data
,
atomHeaderBytesRead
,
(
int
)
atomPayloadSize
);
if
(
atomType
==
Atom
.
TYPE_ftyp
)
{
if
(
atomType
==
Atom
.
TYPE_ftyp
)
{
...
@@ -418,6 +422,7 @@ public final class Mp4Extractor implements Extractor, SeekMap {
...
@@ -418,6 +422,7 @@ public final class Mp4Extractor implements Extractor, SeekMap {
isQuickTime
,
isQuickTime
,
/* modifyTrackFunction= */
track
->
track
);
/* modifyTrackFunction= */
track
->
track
);
ExtractorOutput
extractorOutput
=
checkNotNull
(
this
.
extractorOutput
);
int
trackCount
=
trackSampleTables
.
size
();
int
trackCount
=
trackSampleTables
.
size
();
for
(
int
i
=
0
;
i
<
trackCount
;
i
++)
{
for
(
int
i
=
0
;
i
<
trackCount
;
i
++)
{
TrackSampleTable
trackSampleTable
=
trackSampleTables
.
get
(
i
);
TrackSampleTable
trackSampleTable
=
trackSampleTables
.
get
(
i
);
...
@@ -483,7 +488,7 @@ public final class Mp4Extractor implements Extractor, SeekMap {
...
@@ -483,7 +488,7 @@ public final class Mp4Extractor implements Extractor, SeekMap {
return
RESULT_END_OF_INPUT
;
return
RESULT_END_OF_INPUT
;
}
}
}
}
Mp4Track
track
=
tracks
[
sampleTrackIndex
];
Mp4Track
track
=
castNonNull
(
tracks
)
[
sampleTrackIndex
];
TrackOutput
trackOutput
=
track
.
trackOutput
;
TrackOutput
trackOutput
=
track
.
trackOutput
;
int
sampleIndex
=
track
.
sampleIndex
;
int
sampleIndex
=
track
.
sampleIndex
;
long
position
=
track
.
sampleTable
.
offsets
[
sampleIndex
];
long
position
=
track
.
sampleTable
.
offsets
[
sampleIndex
];
...
@@ -583,14 +588,14 @@ public final class Mp4Extractor implements Extractor, SeekMap {
...
@@ -583,14 +588,14 @@ public final class Mp4Extractor implements Extractor, SeekMap {
long
minAccumulatedBytes
=
Long
.
MAX_VALUE
;
long
minAccumulatedBytes
=
Long
.
MAX_VALUE
;
boolean
minAccumulatedBytesRequiresReload
=
true
;
boolean
minAccumulatedBytesRequiresReload
=
true
;
int
minAccumulatedBytesTrackIndex
=
C
.
INDEX_UNSET
;
int
minAccumulatedBytesTrackIndex
=
C
.
INDEX_UNSET
;
for
(
int
trackIndex
=
0
;
trackIndex
<
tracks
.
length
;
trackIndex
++)
{
for
(
int
trackIndex
=
0
;
trackIndex
<
castNonNull
(
tracks
)
.
length
;
trackIndex
++)
{
Mp4Track
track
=
tracks
[
trackIndex
];
Mp4Track
track
=
tracks
[
trackIndex
];
int
sampleIndex
=
track
.
sampleIndex
;
int
sampleIndex
=
track
.
sampleIndex
;
if
(
sampleIndex
==
track
.
sampleTable
.
sampleCount
)
{
if
(
sampleIndex
==
track
.
sampleTable
.
sampleCount
)
{
continue
;
continue
;
}
}
long
sampleOffset
=
track
.
sampleTable
.
offsets
[
sampleIndex
];
long
sampleOffset
=
track
.
sampleTable
.
offsets
[
sampleIndex
];
long
sampleAccumulatedBytes
=
accumulatedSampleSizes
[
trackIndex
][
sampleIndex
];
long
sampleAccumulatedBytes
=
castNonNull
(
accumulatedSampleSizes
)
[
trackIndex
][
sampleIndex
];
long
skipAmount
=
sampleOffset
-
inputPosition
;
long
skipAmount
=
sampleOffset
-
inputPosition
;
boolean
requiresReload
=
skipAmount
<
0
||
skipAmount
>=
RELOAD_MINIMUM_SEEK_DISTANCE
;
boolean
requiresReload
=
skipAmount
<
0
||
skipAmount
>=
RELOAD_MINIMUM_SEEK_DISTANCE
;
if
((!
requiresReload
&&
preferredRequiresReload
)
if
((!
requiresReload
&&
preferredRequiresReload
)
...
@@ -616,6 +621,7 @@ public final class Mp4Extractor implements Extractor, SeekMap {
...
@@ -616,6 +621,7 @@ public final class Mp4Extractor implements Extractor, SeekMap {
/**
/**
* Updates every track's sample index to point its latest sync sample before/at {@code timeUs}.
* Updates every track's sample index to point its latest sync sample before/at {@code timeUs}.
*/
*/
@RequiresNonNull
(
"tracks"
)
private
void
updateSampleIndices
(
long
timeUs
)
{
private
void
updateSampleIndices
(
long
timeUs
)
{
for
(
Mp4Track
track
:
tracks
)
{
for
(
Mp4Track
track
:
tracks
)
{
TrackSampleTable
sampleTable
=
track
.
sampleTable
;
TrackSampleTable
sampleTable
=
track
.
sampleTable
;
...
...
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