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
c8e5988e
authored
Dec 05, 2014
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix handling of unknown duration in FMP4.
Issue: 186
parent
6f1832fb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
library/src/main/java/com/google/android/exoplayer/parser/mp4/FragmentedMp4Extractor.java
library/src/main/java/com/google/android/exoplayer/parser/mp4/FragmentedMp4Extractor.java
View file @
c8e5988e
...
@@ -462,7 +462,8 @@ public final class FragmentedMp4Extractor implements Extractor {
...
@@ -462,7 +462,8 @@ public final class FragmentedMp4Extractor implements Extractor {
/**
/**
* Parses a tkhd atom (defined in 14496-12).
* Parses a tkhd atom (defined in 14496-12).
*
*
* @return A {@link Pair} consisting of the track id and duration.
* @return A {@link Pair} consisting of the track id and duration (in the timescale indicated in
* the movie header box). The duration is set to -1 if the duration is unspecified.
*/
*/
private
static
Pair
<
Integer
,
Long
>
parseTkhd
(
ParsableByteArray
tkhd
)
{
private
static
Pair
<
Integer
,
Long
>
parseTkhd
(
ParsableByteArray
tkhd
)
{
tkhd
.
setPosition
(
ATOM_HEADER_SIZE
);
tkhd
.
setPosition
(
ATOM_HEADER_SIZE
);
...
@@ -473,7 +474,23 @@ public final class FragmentedMp4Extractor implements Extractor {
...
@@ -473,7 +474,23 @@ public final class FragmentedMp4Extractor implements Extractor {
int
trackId
=
tkhd
.
readInt
();
int
trackId
=
tkhd
.
readInt
();
tkhd
.
skip
(
4
);
tkhd
.
skip
(
4
);
long
duration
=
version
==
0
?
tkhd
.
readUnsignedInt
()
:
tkhd
.
readUnsignedLongToLong
();
boolean
durationUnknown
=
true
;
int
durationPosition
=
tkhd
.
getPosition
();
int
durationByteCount
=
version
==
0
?
4
:
8
;
for
(
int
i
=
0
;
i
<
durationByteCount
;
i
++)
{
if
(
tkhd
.
data
[
durationPosition
+
i
]
!=
-
1
)
{
durationUnknown
=
false
;
break
;
}
}
long
duration
;
if
(
durationUnknown
)
{
tkhd
.
skip
(
durationByteCount
);
duration
=
-
1
;
}
else
{
duration
=
version
==
0
?
tkhd
.
readUnsignedInt
()
:
tkhd
.
readUnsignedLongToLong
();
}
return
Pair
.
create
(
trackId
,
duration
);
return
Pair
.
create
(
trackId
,
duration
);
}
}
...
...
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