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
92bf5d80
authored
Sep 14, 2021
by
krocard
Committed by
bachinger
Sep 14, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add nullness annotations to TsExtractors
#exofixit PiperOrigin-RevId: 396658717
parent
4d668f1b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
10 deletions
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/ts/TsExtractor.java
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/ts/TsExtractor.java
View file @
92bf5d80
...
@@ -48,6 +48,8 @@ import java.util.ArrayList;
...
@@ -48,6 +48,8 @@ import java.util.ArrayList;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.List
;
import
org.checkerframework.checker.nullness.compatqual.NullableType
;
import
org.checkerframework.checker.nullness.qual.MonotonicNonNull
;
/** Extracts data from the MPEG-2 TS container format. */
/** Extracts data from the MPEG-2 TS container format. */
public
final
class
TsExtractor
implements
Extractor
{
public
final
class
TsExtractor
implements
Extractor
{
...
@@ -110,7 +112,7 @@ public final class TsExtractor implements Extractor {
...
@@ -110,7 +112,7 @@ public final class TsExtractor implements Extractor {
private
static
final
int
BUFFER_SIZE
=
TS_PACKET_SIZE
*
50
;
private
static
final
int
BUFFER_SIZE
=
TS_PACKET_SIZE
*
50
;
private
static
final
int
SNIFF_TS_PACKET_COUNT
=
5
;
private
static
final
int
SNIFF_TS_PACKET_COUNT
=
5
;
private
final
@Mode
int
mode
;
@Mode
private
final
int
mode
;
private
final
int
timestampSearchBytes
;
private
final
int
timestampSearchBytes
;
private
final
List
<
TimestampAdjuster
>
timestampAdjusters
;
private
final
List
<
TimestampAdjuster
>
timestampAdjusters
;
private
final
ParsableByteArray
tsPacketBuffer
;
private
final
ParsableByteArray
tsPacketBuffer
;
...
@@ -122,13 +124,13 @@ public final class TsExtractor implements Extractor {
...
@@ -122,13 +124,13 @@ public final class TsExtractor implements Extractor {
private
final
TsDurationReader
durationReader
;
private
final
TsDurationReader
durationReader
;
// Accessed only by the loading thread.
// Accessed only by the loading thread.
private
TsBinarySearchSeeker
tsBinarySearchSeeker
;
private
@MonotonicNonNull
TsBinarySearchSeeker
tsBinarySearchSeeker
;
private
ExtractorOutput
output
;
private
ExtractorOutput
output
;
private
int
remainingPmts
;
private
int
remainingPmts
;
private
boolean
tracksEnded
;
private
boolean
tracksEnded
;
private
boolean
hasOutputSeekMap
;
private
boolean
hasOutputSeekMap
;
private
boolean
pendingSeekToStart
;
private
boolean
pendingSeekToStart
;
private
TsPayloadReader
id3Reader
;
@Nullable
private
TsPayloadReader
id3Reader
;
private
int
bytesSinceLastSync
;
private
int
bytesSinceLastSync
;
private
int
pcrPid
;
private
int
pcrPid
;
...
@@ -214,6 +216,7 @@ public final class TsExtractor implements Extractor {
...
@@ -214,6 +216,7 @@ public final class TsExtractor implements Extractor {
tsPayloadReaders
=
new
SparseArray
<>();
tsPayloadReaders
=
new
SparseArray
<>();
continuityCounters
=
new
SparseIntArray
();
continuityCounters
=
new
SparseIntArray
();
durationReader
=
new
TsDurationReader
(
timestampSearchBytes
);
durationReader
=
new
TsDurationReader
(
timestampSearchBytes
);
output
=
ExtractorOutput
.
PLACEHOLDER
;
pcrPid
=
-
1
;
pcrPid
=
-
1
;
resetPayloadReaders
();
resetPayloadReaders
();
}
}
...
@@ -289,8 +292,8 @@ public final class TsExtractor implements Extractor {
...
@@ -289,8 +292,8 @@ public final class TsExtractor implements Extractor {
}
}
@Override
@Override
public
@ReadResult
int
read
(
ExtractorInput
input
,
PositionHolder
seekPosition
)
@ReadResult
throws
IOException
{
public
int
read
(
ExtractorInput
input
,
PositionHolder
seekPosition
)
throws
IOException
{
long
inputLength
=
input
.
getLength
();
long
inputLength
=
input
.
getLength
();
if
(
tracksEnded
)
{
if
(
tracksEnded
)
{
boolean
canReadDuration
=
inputLength
!=
C
.
LENGTH_UNSET
&&
mode
!=
MODE_HLS
;
boolean
canReadDuration
=
inputLength
!=
C
.
LENGTH_UNSET
&&
mode
!=
MODE_HLS
;
...
@@ -549,7 +552,7 @@ public final class TsExtractor implements Extractor {
...
@@ -549,7 +552,7 @@ public final class TsExtractor implements Extractor {
private
static
final
int
TS_PMT_DESC_DVB_EXT_AC4
=
0x15
;
private
static
final
int
TS_PMT_DESC_DVB_EXT_AC4
=
0x15
;
private
final
ParsableBitArray
pmtScratch
;
private
final
ParsableBitArray
pmtScratch
;
private
final
SparseArray
<
TsPayloadReader
>
trackIdToReaderScratch
;
private
final
SparseArray
<
@NullableType
TsPayloadReader
>
trackIdToReaderScratch
;
private
final
SparseIntArray
trackIdToPidScratch
;
private
final
SparseIntArray
trackIdToPidScratch
;
private
final
int
pid
;
private
final
int
pid
;
...
@@ -618,10 +621,12 @@ public final class TsExtractor implements Extractor {
...
@@ -618,10 +621,12 @@ public final class TsExtractor implements Extractor {
// appears intermittently during playback. See [Internal: b/20261500].
// appears intermittently during playback. See [Internal: b/20261500].
EsInfo
id3EsInfo
=
new
EsInfo
(
TS_STREAM_TYPE_ID3
,
null
,
null
,
Util
.
EMPTY_BYTE_ARRAY
);
EsInfo
id3EsInfo
=
new
EsInfo
(
TS_STREAM_TYPE_ID3
,
null
,
null
,
Util
.
EMPTY_BYTE_ARRAY
);
id3Reader
=
payloadReaderFactory
.
createPayloadReader
(
TS_STREAM_TYPE_ID3
,
id3EsInfo
);
id3Reader
=
payloadReaderFactory
.
createPayloadReader
(
TS_STREAM_TYPE_ID3
,
id3EsInfo
);
id3Reader
.
init
(
if
(
id3Reader
!=
null
)
{
timestampAdjuster
,
id3Reader
.
init
(
output
,
timestampAdjuster
,
new
TrackIdGenerator
(
programNumber
,
TS_STREAM_TYPE_ID3
,
MAX_PID_PLUS_ONE
));
output
,
new
TrackIdGenerator
(
programNumber
,
TS_STREAM_TYPE_ID3
,
MAX_PID_PLUS_ONE
));
}
}
}
trackIdToReaderScratch
.
clear
();
trackIdToReaderScratch
.
clear
();
...
...
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