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
9faa393a
authored
Jan 15, 2021
by
kimvde
Committed by
Oliver Woodman
Jan 17, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Handle sample size mismatch in MP4 extractors
#minor-release PiperOrigin-RevId: 352016698
parent
e869d5db
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
RELEASENOTES.md
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/AtomParsers.java
RELEASENOTES.md
View file @
9faa393a
...
@@ -143,6 +143,8 @@
...
@@ -143,6 +143,8 @@
*
Populate codecs string for H.265/HEVC in MP4, Matroska and MPEG-TS
*
Populate codecs string for H.265/HEVC in MP4, Matroska and MPEG-TS
streams to allow decoder capability checks based on codec profile/level
streams to allow decoder capability checks based on codec profile/level
(
[
#8393
](
https://github.com/google/ExoPlayer/issues/8393
)
).
(
[
#8393
](
https://github.com/google/ExoPlayer/issues/8393
)
).
*
Handle sample size mismatches between raw audio
`stsd`
information and
`stsz`
fixed sample size in MP4 extractors.
*
Track selection:
*
Track selection:
*
Allow parallel adaptation for video and audio
*
Allow parallel adaptation for video and audio
(
[
#5111
](
https://github.com/google/ExoPlayer/issues/5111
)
).
(
[
#5111
](
https://github.com/google/ExoPlayer/issues/5111
)
).
...
...
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/AtomParsers.java
View file @
9faa393a
...
@@ -315,7 +315,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
...
@@ -315,7 +315,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
SampleSizeBox
sampleSizeBox
;
SampleSizeBox
sampleSizeBox
;
@Nullable
Atom
.
LeafAtom
stszAtom
=
stblAtom
.
getLeafAtomOfType
(
Atom
.
TYPE_stsz
);
@Nullable
Atom
.
LeafAtom
stszAtom
=
stblAtom
.
getLeafAtomOfType
(
Atom
.
TYPE_stsz
);
if
(
stszAtom
!=
null
)
{
if
(
stszAtom
!=
null
)
{
sampleSizeBox
=
new
StszSampleSizeBox
(
stszAtom
);
sampleSizeBox
=
new
StszSampleSizeBox
(
stszAtom
,
track
.
format
);
}
else
{
}
else
{
@Nullable
Atom
.
LeafAtom
stz2Atom
=
stblAtom
.
getLeafAtomOfType
(
Atom
.
TYPE_stz2
);
@Nullable
Atom
.
LeafAtom
stz2Atom
=
stblAtom
.
getLeafAtomOfType
(
Atom
.
TYPE_stz2
);
if
(
stz2Atom
==
null
)
{
if
(
stz2Atom
==
null
)
{
...
@@ -1720,10 +1720,25 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
...
@@ -1720,10 +1720,25 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
private
final
int
sampleCount
;
private
final
int
sampleCount
;
private
final
ParsableByteArray
data
;
private
final
ParsableByteArray
data
;
public
StszSampleSizeBox
(
Atom
.
LeafAtom
stszAtom
)
{
public
StszSampleSizeBox
(
Atom
.
LeafAtom
stszAtom
,
Format
trackFormat
)
{
data
=
stszAtom
.
data
;
data
=
stszAtom
.
data
;
data
.
setPosition
(
Atom
.
FULL_HEADER_SIZE
);
data
.
setPosition
(
Atom
.
FULL_HEADER_SIZE
);
int
fixedSampleSize
=
data
.
readUnsignedIntToInt
();
int
fixedSampleSize
=
data
.
readUnsignedIntToInt
();
if
(
MimeTypes
.
AUDIO_RAW
.
equals
(
trackFormat
.
sampleMimeType
))
{
int
pcmFrameSize
=
Util
.
getPcmFrameSize
(
trackFormat
.
pcmEncoding
,
trackFormat
.
channelCount
);
if
(
fixedSampleSize
==
0
||
fixedSampleSize
%
pcmFrameSize
!=
0
)
{
// The sample size from the stsz box is inconsistent with the PCM encoding and channel
// count derived from the stsd box. Choose stsd box as source of truth
// [Internal ref: b/171627904].
Log
.
w
(
TAG
,
"Audio sample size mismatch. stsd sample size: "
+
pcmFrameSize
+
", stsz sample size: "
+
fixedSampleSize
);
fixedSampleSize
=
pcmFrameSize
;
}
}
this
.
fixedSampleSize
=
fixedSampleSize
==
0
?
C
.
LENGTH_UNSET
:
fixedSampleSize
;
this
.
fixedSampleSize
=
fixedSampleSize
==
0
?
C
.
LENGTH_UNSET
:
fixedSampleSize
;
sampleCount
=
data
.
readUnsignedIntToInt
();
sampleCount
=
data
.
readUnsignedIntToInt
();
}
}
...
...
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