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
efce10c8
authored
Jul 10, 2020
by
kimvde
Committed by
kim-vde
Jul 13, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Simplify FragmentedMp4Extractor sample time logic
PiperOrigin-RevId: 320574671
parent
6624c7cb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
11 deletions
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/FragmentedMp4Extractor.java
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/FragmentedMp4Extractor.java
View file @
efce10c8
...
@@ -715,16 +715,17 @@ public class FragmentedMp4Extractor implements Extractor {
...
@@ -715,16 +715,17 @@ public class FragmentedMp4Extractor implements Extractor {
}
}
TrackFragment
fragment
=
trackBundle
.
fragment
;
TrackFragment
fragment
=
trackBundle
.
fragment
;
long
d
ecodeTime
=
fragment
.
nextFragmentDecodeTime
;
long
fragmentD
ecodeTime
=
fragment
.
nextFragmentDecodeTime
;
trackBundle
.
reset
();
trackBundle
.
reset
();
trackBundle
.
currentlyInFragment
=
true
;
trackBundle
.
currentlyInFragment
=
true
;
@Nullable
LeafAtom
tfdtAtom
=
traf
.
getLeafAtomOfType
(
Atom
.
TYPE_tfdt
);
@Nullable
LeafAtom
tfdtAtom
=
traf
.
getLeafAtomOfType
(
Atom
.
TYPE_tfdt
);
if
(
tfdtAtom
!=
null
&&
(
flags
&
FLAG_WORKAROUND_IGNORE_TFDT_BOX
)
==
0
)
{
if
(
tfdtAtom
!=
null
&&
(
flags
&
FLAG_WORKAROUND_IGNORE_TFDT_BOX
)
==
0
)
{
decodeTime
=
parseTfdt
(
traf
.
getLeafAtomOfType
(
Atom
.
TYPE_tfdt
).
data
);
fragment
.
nextFragmentDecodeTime
=
parseTfdt
(
traf
.
getLeafAtomOfType
(
Atom
.
TYPE_tfdt
).
data
);
}
else
{
fragment
.
nextFragmentDecodeTime
=
fragmentDecodeTime
;
}
}
parseTruns
(
traf
,
trackBundle
,
decodeTime
,
flags
);
parseTruns
(
traf
,
trackBundle
,
flags
);
@Nullable
@Nullable
TrackEncryptionBox
encryptionBox
=
TrackEncryptionBox
encryptionBox
=
...
@@ -762,8 +763,7 @@ public class FragmentedMp4Extractor implements Extractor {
...
@@ -762,8 +763,7 @@ public class FragmentedMp4Extractor implements Extractor {
}
}
}
}
private
static
void
parseTruns
(
private
static
void
parseTruns
(
ContainerAtom
traf
,
TrackBundle
trackBundle
,
@Flags
int
flags
)
ContainerAtom
traf
,
TrackBundle
trackBundle
,
long
decodeTime
,
@Flags
int
flags
)
throws
ParserException
{
throws
ParserException
{
int
trunCount
=
0
;
int
trunCount
=
0
;
int
totalSampleCount
=
0
;
int
totalSampleCount
=
0
;
...
@@ -791,8 +791,8 @@ public class FragmentedMp4Extractor implements Extractor {
...
@@ -791,8 +791,8 @@ public class FragmentedMp4Extractor implements Extractor {
for
(
int
i
=
0
;
i
<
leafChildrenSize
;
i
++)
{
for
(
int
i
=
0
;
i
<
leafChildrenSize
;
i
++)
{
LeafAtom
trun
=
leafChildren
.
get
(
i
);
LeafAtom
trun
=
leafChildren
.
get
(
i
);
if
(
trun
.
type
==
Atom
.
TYPE_trun
)
{
if
(
trun
.
type
==
Atom
.
TYPE_trun
)
{
trunStartPosition
=
parseTrun
(
trackBundle
,
trunIndex
++,
decodeTime
,
flags
,
trun
.
data
,
trunStartPosition
=
trunStartPosition
);
parseTrun
(
trackBundle
,
trunIndex
++,
flags
,
trun
.
data
,
trunStartPosition
);
}
}
}
}
}
}
...
@@ -940,7 +940,6 @@ public class FragmentedMp4Extractor implements Extractor {
...
@@ -940,7 +940,6 @@ public class FragmentedMp4Extractor implements Extractor {
* @param trackBundle The {@link TrackBundle} that contains the {@link TrackFragment} into which
* @param trackBundle The {@link TrackBundle} that contains the {@link TrackFragment} into which
* parsed data should be placed.
* parsed data should be placed.
* @param index Index of the track run in the fragment.
* @param index Index of the track run in the fragment.
* @param decodeTime The decode time of the first sample in the fragment run.
* @param flags Flags to allow any required workaround to be executed.
* @param flags Flags to allow any required workaround to be executed.
* @param trun The trun atom to decode.
* @param trun The trun atom to decode.
* @return The starting position of samples for the next run.
* @return The starting position of samples for the next run.
...
@@ -948,7 +947,6 @@ public class FragmentedMp4Extractor implements Extractor {
...
@@ -948,7 +947,6 @@ public class FragmentedMp4Extractor implements Extractor {
private
static
int
parseTrun
(
private
static
int
parseTrun
(
TrackBundle
trackBundle
,
TrackBundle
trackBundle
,
int
index
,
int
index
,
long
decodeTime
,
@Flags
int
flags
,
@Flags
int
flags
,
ParsableByteArray
trun
,
ParsableByteArray
trun
,
int
trackRunStart
)
int
trackRunStart
)
...
@@ -1002,7 +1000,7 @@ public class FragmentedMp4Extractor implements Extractor {
...
@@ -1002,7 +1000,7 @@ public class FragmentedMp4Extractor implements Extractor {
int
trackRunEnd
=
trackRunStart
+
fragment
.
trunLength
[
index
];
int
trackRunEnd
=
trackRunStart
+
fragment
.
trunLength
[
index
];
long
timescale
=
track
.
timescale
;
long
timescale
=
track
.
timescale
;
long
cumulativeTime
=
index
>
0
?
fragment
.
nextFragmentDecodeTime
:
d
ecodeTime
;
long
cumulativeTime
=
fragment
.
nextFragmentD
ecodeTime
;
for
(
int
i
=
trackRunStart
;
i
<
trackRunEnd
;
i
++)
{
for
(
int
i
=
trackRunStart
;
i
<
trackRunEnd
;
i
++)
{
// Use trun values if present, otherwise tfhd, otherwise trex.
// Use trun values if present, otherwise tfhd, otherwise trex.
int
sampleDuration
=
int
sampleDuration
=
...
...
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