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
d2ba2907
authored
Mar 01, 2023
by
tonihei
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge pull request #255 from mayurk2:use_edts_offset_if_it_is_for_entire_file
PiperOrigin-RevId: 513213229
parents
3e1f8258
0761641d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
5 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 @
d2ba2907
...
...
@@ -968,6 +968,26 @@ public class FragmentedMp4Extractor implements Extractor {
return
version
==
1
?
tfdt
.
readUnsignedLongToLong
()
:
tfdt
.
readUnsignedInt
();
}
private
static
boolean
isEdtsListDurationForEntireMediaTimeline
(
Track
track
)
{
// Currently we only support a single edit that moves the entire media timeline (indicated by
// duration == 0 or (editListDurationUs + editListMediaTimeUs) >= track duration.
// Other uses of edit lists are uncommon and unsupported.
if
(
track
.
editListDurations
==
null
||
track
.
editListDurations
.
length
!=
1
||
track
.
editListMediaTimes
==
null
)
{
return
false
;
}
if
(
track
.
editListDurations
[
0
]
==
0
)
{
return
true
;
}
long
editListEndMediaTimeUs
=
Util
.
scaleLargeTimestamp
(
track
.
editListDurations
[
0
]
+
track
.
editListMediaTimes
[
0
],
C
.
MICROS_PER_SECOND
,
track
.
movieTimescale
);
return
editListEndMediaTimeUs
>=
track
.
durationUs
;
}
/**
* Parses a trun atom (defined in 14496-12).
*
...
...
@@ -1015,11 +1035,8 @@ public class FragmentedMp4Extractor implements Extractor {
// ensure that the first frame's presentation timestamp is zero.
long
edtsOffset
=
0
;
// Currently we only support a single edit that moves the entire media timeline (indicated by
// duration == 0). Other uses of edit lists are uncommon and unsupported.
if
(
track
.
editListDurations
!=
null
&&
track
.
editListDurations
.
length
==
1
&&
track
.
editListDurations
[
0
]
==
0
)
{
// Currently we only support a single edit that moves the entire media timeline.
if
(
isEdtsListDurationForEntireMediaTimeline
(
track
))
{
edtsOffset
=
castNonNull
(
track
.
editListMediaTimes
)[
0
];
}
...
...
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