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
d4a0dfda
authored
Oct 12, 2020
by
ibaker
Committed by
Oliver Woodman
Oct 20, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Ensure ParsableByteArray is large enough when appending in VorbisReader
PiperOrigin-RevId: 336643621
parent
1e315e47
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/ogg/VorbisReader.java
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/ogg/VorbisReader.java
View file @
d4a0dfda
...
@@ -25,6 +25,7 @@ import com.google.android.exoplayer2.util.MimeTypes;
...
@@ -25,6 +25,7 @@ import com.google.android.exoplayer2.util.MimeTypes;
import
com.google.android.exoplayer2.util.ParsableByteArray
;
import
com.google.android.exoplayer2.util.ParsableByteArray
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
/**
/**
* {@link StreamReader} to extract Vorbis data out of Ogg byte stream.
* {@link StreamReader} to extract Vorbis data out of Ogg byte stream.
...
@@ -160,8 +161,11 @@ import java.util.ArrayList;
...
@@ -160,8 +161,11 @@ import java.util.ArrayList;
@VisibleForTesting
@VisibleForTesting
/* package */
static
void
appendNumberOfSamples
(
/* package */
static
void
appendNumberOfSamples
(
ParsableByteArray
buffer
,
long
packetSampleCount
)
{
ParsableByteArray
buffer
,
long
packetSampleCount
)
{
if
(
buffer
.
capacity
()
<
buffer
.
limit
()
+
4
)
{
buffer
.
setLimit
(
buffer
.
limit
()
+
4
);
buffer
.
reset
(
Arrays
.
copyOf
(
buffer
.
getData
(),
buffer
.
limit
()
+
4
));
}
else
{
buffer
.
setLimit
(
buffer
.
limit
()
+
4
);
}
// The vorbis decoder expects the number of samples in the packet
// The vorbis decoder expects the number of samples in the packet
// to be appended to the audio data as an int32
// to be appended to the audio data as an int32
byte
[]
data
=
buffer
.
getData
();
byte
[]
data
=
buffer
.
getData
();
...
...
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