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
32bad691
authored
Jan 07, 2019
by
aquilescanta
Committed by
Oliver Woodman
Jan 15, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Increase search size in mp4 sniffing once moov has been found
Issue:#5320 PiperOrigin-RevId: 228142567
parent
ff9a40f0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
library/core/src/main/java/com/google/android/exoplayer2/extractor/mp4/Sniffer.java
library/core/src/main/java/com/google/android/exoplayer2/extractor/mp4/Sniffer.java
View file @
32bad691
...
@@ -27,9 +27,7 @@ import java.io.IOException;
...
@@ -27,9 +27,7 @@ import java.io.IOException;
*/
*/
/* package */
final
class
Sniffer
{
/* package */
final
class
Sniffer
{
/**
/** The maximum number of bytes to peek when sniffing. */
* The maximum number of bytes to peek when sniffing.
*/
private
static
final
int
SEARCH_LENGTH
=
4
*
1024
;
private
static
final
int
SEARCH_LENGTH
=
4
*
1024
;
private
static
final
int
[]
COMPATIBLE_BRANDS
=
new
int
[]
{
private
static
final
int
[]
COMPATIBLE_BRANDS
=
new
int
[]
{
...
@@ -112,12 +110,16 @@ import java.io.IOException;
...
@@ -112,12 +110,16 @@ import java.io.IOException;
atomSize
=
buffer
.
readLong
();
atomSize
=
buffer
.
readLong
();
}
else
if
(
atomSize
==
Atom
.
EXTENDS_TO_END_SIZE
)
{
}
else
if
(
atomSize
==
Atom
.
EXTENDS_TO_END_SIZE
)
{
// The atom extends to the end of the file.
// The atom extends to the end of the file.
long
e
ndPosition
=
input
.
getLength
();
long
fileE
ndPosition
=
input
.
getLength
();
if
(
e
ndPosition
!=
C
.
LENGTH_UNSET
)
{
if
(
fileE
ndPosition
!=
C
.
LENGTH_UNSET
)
{
atomSize
=
e
ndPosition
-
input
.
getPeekPosition
()
+
headerSize
;
atomSize
=
fileE
ndPosition
-
input
.
getPeekPosition
()
+
headerSize
;
}
}
}
}
if
(
inputLength
!=
C
.
LENGTH_UNSET
&&
bytesSearched
+
atomSize
>
inputLength
)
{
// The file is invalid because the atom extends past the end of the file.
return
false
;
}
if
(
atomSize
<
headerSize
)
{
if
(
atomSize
<
headerSize
)
{
// The file is invalid because the atom size is too small for its header.
// The file is invalid because the atom size is too small for its header.
return
false
;
return
false
;
...
@@ -125,6 +127,13 @@ import java.io.IOException;
...
@@ -125,6 +127,13 @@ import java.io.IOException;
bytesSearched
+=
headerSize
;
bytesSearched
+=
headerSize
;
if
(
atomType
==
Atom
.
TYPE_moov
)
{
if
(
atomType
==
Atom
.
TYPE_moov
)
{
// We have seen the moov atom. We increase the search size to make sure we don't miss an
// mvex atom because the moov's size exceeds the search length.
bytesToSearch
+=
(
int
)
atomSize
;
if
(
inputLength
!=
C
.
LENGTH_UNSET
&&
bytesToSearch
>
inputLength
)
{
// Make sure we don't exceed the file size.
bytesToSearch
=
(
int
)
inputLength
;
}
// Check for an mvex atom inside the moov atom to identify whether the file is fragmented.
// Check for an mvex atom inside the moov atom to identify whether the file is fragmented.
continue
;
continue
;
}
}
...
...
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