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
2094c749
authored
Mar 24, 2020
by
olly
Committed by
Oliver Woodman
Mar 30, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
WAV: Don't read past data end position
Issue: #7129 PiperOrigin-RevId: 302660343
parent
1d6bd0de
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
5 deletions
RELEASENOTES.md
library/core/src/main/java/com/google/android/exoplayer2/extractor/wav/WavExtractor.java
library/core/src/test/assets/wav/sample_with_trailing_bytes.wav
library/core/src/test/java/com/google/android/exoplayer2/extractor/wav/WavExtractorTest.java
RELEASENOTES.md
View file @
2094c749
...
@@ -8,6 +8,8 @@
...
@@ -8,6 +8,8 @@
(
[
#6885
](
https://github.com/google/ExoPlayer/issues/6885
)
).
(
[
#6885
](
https://github.com/google/ExoPlayer/issues/6885
)
).
*
Allow missing hours in SubRip (.srt) timecodes
*
Allow missing hours in SubRip (.srt) timecodes
(
[
#7122
](
https://github.com/google/ExoPlayer/issues/7122
)
).
(
[
#7122
](
https://github.com/google/ExoPlayer/issues/7122
)
).
*
WAV: Fix failure to play WAV files that contain trailing non-media bytes
(
[
#7129
](
https://github.com/google/ExoPlayer/issues/7129
)
)
*
UI: Add an option to set whether to use the orientation sensor for rotation
*
UI: Add an option to set whether to use the orientation sensor for rotation
in spherical playbacks
in spherical playbacks
(
[
#6761
](
https://github.com/google/ExoPlayer/issues/6761
)
).
(
[
#6761
](
https://github.com/google/ExoPlayer/issues/6761
)
).
...
...
library/core/src/main/java/com/google/android/exoplayer2/extractor/wav/WavExtractor.java
View file @
2094c749
...
@@ -259,14 +259,14 @@ public final class WavExtractor implements Extractor {
...
@@ -259,14 +259,14 @@ public final class WavExtractor implements Extractor {
public
boolean
sampleData
(
ExtractorInput
input
,
long
bytesLeft
)
public
boolean
sampleData
(
ExtractorInput
input
,
long
bytesLeft
)
throws
IOException
,
InterruptedException
{
throws
IOException
,
InterruptedException
{
// Write sample data until we've reached the target sample size, or the end of the data.
// Write sample data until we've reached the target sample size, or the end of the data.
boolean
endOfSampleData
=
bytesLeft
==
0
;
while
(
bytesLeft
>
0
&&
pendingOutputBytes
<
targetSampleSizeBytes
)
{
while
(!
endOfSampleData
&&
pendingOutputBytes
<
targetSampleSizeBytes
)
{
int
bytesToRead
=
(
int
)
Math
.
min
(
targetSampleSizeBytes
-
pendingOutputBytes
,
bytesLeft
);
int
bytesToRead
=
(
int
)
Math
.
min
(
targetSampleSizeBytes
-
pendingOutputBytes
,
bytesLeft
);
int
bytesAppended
=
trackOutput
.
sampleData
(
input
,
bytesToRead
,
true
);
int
bytesAppended
=
trackOutput
.
sampleData
(
input
,
bytesToRead
,
true
);
if
(
bytesAppended
==
RESULT_END_OF_INPUT
)
{
if
(
bytesAppended
==
RESULT_END_OF_INPUT
)
{
endOfSampleData
=
true
;
bytesLeft
=
0
;
}
else
{
}
else
{
pendingOutputBytes
+=
bytesAppended
;
pendingOutputBytes
+=
bytesAppended
;
bytesLeft
-=
bytesAppended
;
}
}
}
}
...
@@ -288,7 +288,7 @@ public final class WavExtractor implements Extractor {
...
@@ -288,7 +288,7 @@ public final class WavExtractor implements Extractor {
pendingOutputBytes
=
offset
;
pendingOutputBytes
=
offset
;
}
}
return
endOfSampleData
;
return
bytesLeft
<=
0
;
}
}
}
}
...
...
library/core/src/test/assets/wav/sample_with_trailing_bytes.wav
0 → 100644
View file @
2094c749
No preview for this file type
library/core/src/test/java/com/google/android/exoplayer2/extractor/wav/WavExtractorTest.java
View file @
2094c749
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
*/
*/
package
com
.
google
.
android
.
exoplayer2
.
extractor
.
wav
;
package
com
.
google
.
android
.
exoplayer2
.
extractor
.
wav
;
import
androidx.test.core.app.ApplicationProvider
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
com.google.android.exoplayer2.testutil.ExtractorAsserts
;
import
com.google.android.exoplayer2.testutil.ExtractorAsserts
;
import
org.junit.Test
;
import
org.junit.Test
;
...
@@ -30,7 +31,7 @@ public final class WavExtractorTest {
...
@@ -30,7 +31,7 @@ public final class WavExtractorTest {
}
}
@Test
@Test
public
void
testSampleI
maAdpcm
()
throws
Exception
{
public
void
sample_i
maAdpcm
()
throws
Exception
{
ExtractorAsserts
.
assertBehavior
(
WavExtractor:
:
new
,
"wav/sample_ima_adpcm.wav"
);
ExtractorAsserts
.
assertBehavior
(
WavExtractor:
:
new
,
"wav/sample_ima_adpcm.wav"
);
}
}
}
}
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