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
c1e29237
authored
Nov 22, 2022
by
samrobinson
Committed by
Ian Baker
Nov 24, 2022
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix SpeedChangingAudioProcessor handling of EMPTY_BUFFER.
PiperOrigin-RevId: 490265564
parent
309f24ad
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
13 deletions
library/common/src/main/java/com/google/android/exoplayer2/audio/AudioProcessingPipeline.java
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/SpeedChangingAudioProcessor.java
library/common/src/main/java/com/google/android/exoplayer2/audio/AudioProcessingPipeline.java
View file @
c1e29237
...
...
@@ -15,6 +15,7 @@
*/
package
com
.
google
.
android
.
exoplayer2
.
audio
;
import
static
com
.
google
.
android
.
exoplayer2
.
audio
.
AudioProcessor
.
EMPTY_BUFFER
;
import
static
com
.
google
.
android
.
exoplayer2
.
util
.
Assertions
.
checkState
;
import
androidx.annotation.Nullable
;
...
...
@@ -22,7 +23,6 @@ import com.google.android.exoplayer2.audio.AudioProcessor.AudioFormat;
import
com.google.common.collect.ImmutableList
;
import
com.google.errorprone.annotations.CanIgnoreReturnValue
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteOrder
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -67,10 +67,6 @@ import java.util.List;
*/
public
final
class
AudioProcessingPipeline
{
/** An empty, direct {@link ByteBuffer}. */
private
static
final
ByteBuffer
EMPTY_BUFFER
=
ByteBuffer
.
allocateDirect
(
0
).
order
(
ByteOrder
.
nativeOrder
());
/** The {@link AudioProcessor} instances passed to {@link AudioProcessingPipeline}. */
private
final
ImmutableList
<
AudioProcessor
>
audioProcessors
;
/**
...
...
@@ -321,13 +317,6 @@ public final class AudioProcessingPipeline {
index
>
0
?
outputBuffers
[
index
-
1
]
:
inputBuffer
.
hasRemaining
()
?
inputBuffer
:
EMPTY_BUFFER
;
if
(
input
==
AudioProcessor
.
EMPTY_BUFFER
)
{
// TODO(internal b/198772621): compare to how it was done in DefaultAudioSink to make sure
// this is not unnecessarily complicated.
// Queueing AudioProcessor.EMPTY_BUFFER to an AudioProcessor might lead to unexpected
// behaviour (see [Internal: b/259393434]).
input
=
EMPTY_BUFFER
;
}
long
inputBytes
=
input
.
remaining
();
audioProcessor
.
queueInput
(
input
);
outputBuffers
[
index
]
=
audioProcessor
.
getOutput
();
...
...
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/SpeedChangingAudioProcessor.java
View file @
c1e29237
...
...
@@ -108,7 +108,9 @@ import java.nio.ByteBuffer;
}
}
else
{
ByteBuffer
buffer
=
replaceOutputBuffer
(
/* size= */
inputBuffer
.
remaining
());
buffer
.
put
(
inputBuffer
);
if
(
inputBuffer
.
hasRemaining
())
{
buffer
.
put
(
inputBuffer
);
}
buffer
.
flip
();
}
bytesRead
+=
inputBuffer
.
position
()
-
startPosition
;
...
...
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