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
bddaaf02
authored
Oct 06, 2020
by
kimvde
Committed by
Oliver Woodman
Oct 17, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Ignore negative payload size in TS PesReader
Issue: #8005 PiperOrigin-RevId: 335625992
parent
1cca9ffd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
9 deletions
RELEASENOTES.md
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/ts/PesReader.java
RELEASENOTES.md
View file @
bddaaf02
...
@@ -29,6 +29,8 @@
...
@@ -29,6 +29,8 @@
*
Add TS extractor parameter to configure the number of bytes in which
*
Add TS extractor parameter to configure the number of bytes in which
to search for a timestamp to determine the duration and to seek.
to search for a timestamp to determine the duration and to seek.
(
[
#7988
](
https://github.com/google/ExoPlayer/issues/7988
)
).
(
[
#7988
](
https://github.com/google/ExoPlayer/issues/7988
)
).
*
Ignore negative payload size in PES packets
(
[
#8005
](
https://github.com/google/ExoPlayer/issues/8005
)
).
*
UI
*
UI
*
Do not require subtitleButton in custom layouts of StyledPlayerView
*
Do not require subtitleButton in custom layouts of StyledPlayerView
(
[
#7962
](
https://github.com/google/ExoPlayer/issues/7962
)
).
(
[
#7962
](
https://github.com/google/ExoPlayer/issues/7962
)
).
...
...
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/ts/PesReader.java
View file @
bddaaf02
...
@@ -97,11 +97,11 @@ public final class PesReader implements TsPayloadReader {
...
@@ -97,11 +97,11 @@ public final class PesReader implements TsPayloadReader {
Log
.
w
(
TAG
,
"Unexpected start indicator reading extended header"
);
Log
.
w
(
TAG
,
"Unexpected start indicator reading extended header"
);
break
;
break
;
case
STATE_READING_BODY:
case
STATE_READING_BODY:
// If payloadSize
== -1
then the length of the previous packet was unspecified, and so
// If payloadSize
is unset
then the length of the previous packet was unspecified, and so
// we only know that it's finished now that we've seen the start of the next one. This
// we only know that it's finished now that we've seen the start of the next one. This
is
//
is expected. If payloadSize != -1, then the length of the previous packet was known,
//
expected. If payloadSize is set, then the length of the previous packet was known, but
//
but
we didn't receive that amount of data. This is not expected.
// we didn't receive that amount of data. This is not expected.
if
(
payloadSize
!=
-
1
)
{
if
(
payloadSize
!=
C
.
LENGTH_UNSET
)
{
Log
.
w
(
TAG
,
"Unexpected start indicator: expected "
+
payloadSize
+
" more bytes"
);
Log
.
w
(
TAG
,
"Unexpected start indicator: expected "
+
payloadSize
+
" more bytes"
);
}
}
// Either way, notify the reader that it has now finished.
// Either way, notify the reader that it has now finished.
...
@@ -136,13 +136,13 @@ public final class PesReader implements TsPayloadReader {
...
@@ -136,13 +136,13 @@ public final class PesReader implements TsPayloadReader {
break
;
break
;
case
STATE_READING_BODY:
case
STATE_READING_BODY:
readLength
=
data
.
bytesLeft
();
readLength
=
data
.
bytesLeft
();
int
padding
=
payloadSize
==
-
1
?
0
:
readLength
-
payloadSize
;
int
padding
=
payloadSize
==
C
.
LENGTH_UNSET
?
0
:
readLength
-
payloadSize
;
if
(
padding
>
0
)
{
if
(
padding
>
0
)
{
readLength
-=
padding
;
readLength
-=
padding
;
data
.
setLimit
(
data
.
getPosition
()
+
readLength
);
data
.
setLimit
(
data
.
getPosition
()
+
readLength
);
}
}
reader
.
consume
(
data
);
reader
.
consume
(
data
);
if
(
payloadSize
!=
-
1
)
{
if
(
payloadSize
!=
C
.
LENGTH_UNSET
)
{
payloadSize
-=
readLength
;
payloadSize
-=
readLength
;
if
(
payloadSize
==
0
)
{
if
(
payloadSize
==
0
)
{
reader
.
packetFinished
();
reader
.
packetFinished
();
...
@@ -191,7 +191,7 @@ public final class PesReader implements TsPayloadReader {
...
@@ -191,7 +191,7 @@ public final class PesReader implements TsPayloadReader {
int
startCodePrefix
=
pesScratch
.
readBits
(
24
);
int
startCodePrefix
=
pesScratch
.
readBits
(
24
);
if
(
startCodePrefix
!=
0x000001
)
{
if
(
startCodePrefix
!=
0x000001
)
{
Log
.
w
(
TAG
,
"Unexpected start code prefix: "
+
startCodePrefix
);
Log
.
w
(
TAG
,
"Unexpected start code prefix: "
+
startCodePrefix
);
payloadSize
=
-
1
;
payloadSize
=
C
.
LENGTH_UNSET
;
return
false
;
return
false
;
}
}
...
@@ -208,10 +208,14 @@ public final class PesReader implements TsPayloadReader {
...
@@ -208,10 +208,14 @@ public final class PesReader implements TsPayloadReader {
extendedHeaderLength
=
pesScratch
.
readBits
(
8
);
extendedHeaderLength
=
pesScratch
.
readBits
(
8
);
if
(
packetLength
==
0
)
{
if
(
packetLength
==
0
)
{
payloadSize
=
-
1
;
payloadSize
=
C
.
LENGTH_UNSET
;
}
else
{
}
else
{
payloadSize
=
packetLength
+
6
/* packetLength does not include the first 6 bytes */
payloadSize
=
packetLength
+
6
/* packetLength does not include the first 6 bytes */
-
HEADER_SIZE
-
extendedHeaderLength
;
-
HEADER_SIZE
-
extendedHeaderLength
;
if
(
payloadSize
<
0
)
{
Log
.
w
(
TAG
,
"Found negative packet payload size: "
+
payloadSize
);
payloadSize
=
C
.
LENGTH_UNSET
;
}
}
}
return
true
;
return
true
;
}
}
...
...
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