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
70273a03
authored
May 07, 2020
by
samrobinson
Committed by
Oliver Woodman
May 14, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Assert incoming buffers are little endian in the DefaultAudioSink.
PiperOrigin-RevId: 310332895
parent
c4c826fb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 additions
and
4 deletions
library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java
library/core/src/main/java/com/google/android/exoplayer2/audio/SilenceSkippingAudioProcessor.java
library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java
View file @
70273a03
...
...
@@ -629,6 +629,7 @@ public final class DefaultAudioSink implements AudioSink {
if
(
inputBuffer
==
null
)
{
// We are seeing this buffer for the first time.
Assertions
.
checkArgument
(
buffer
.
order
()
==
ByteOrder
.
LITTLE_ENDIAN
);
if
(!
buffer
.
hasRemaining
())
{
// The buffer is empty.
return
true
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/audio/SilenceSkippingAudioProcessor.java
View file @
70273a03
...
...
@@ -17,13 +17,11 @@ package com.google.android.exoplayer2.audio;
import
androidx.annotation.IntDef
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.android.exoplayer2.util.Util
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteOrder
;
/**
* An {@link AudioProcessor} that skips silence in the input stream. Input and output are 16-bit
...
...
@@ -317,7 +315,6 @@ public final class SilenceSkippingAudioProcessor extends BaseAudioProcessor {
* classified as a noisy frame, or the limit of the buffer if no such frame exists.
*/
private
int
findNoisePosition
(
ByteBuffer
buffer
)
{
Assertions
.
checkArgument
(
buffer
.
order
()
==
ByteOrder
.
LITTLE_ENDIAN
);
// The input is in ByteOrder.nativeOrder(), which is little endian on Android.
for
(
int
i
=
buffer
.
position
();
i
<
buffer
.
limit
();
i
+=
2
)
{
if
(
Math
.
abs
(
buffer
.
getShort
(
i
))
>
SILENCE_THRESHOLD_LEVEL
)
{
...
...
@@ -333,7 +330,6 @@ public final class SilenceSkippingAudioProcessor extends BaseAudioProcessor {
* from the byte position to the limit are classified as silent.
*/
private
int
findNoiseLimit
(
ByteBuffer
buffer
)
{
Assertions
.
checkArgument
(
buffer
.
order
()
==
ByteOrder
.
LITTLE_ENDIAN
);
// The input is in ByteOrder.nativeOrder(), which is little endian on Android.
for
(
int
i
=
buffer
.
limit
()
-
2
;
i
>=
buffer
.
position
();
i
-=
2
)
{
if
(
Math
.
abs
(
buffer
.
getShort
(
i
))
>
SILENCE_THRESHOLD_LEVEL
)
{
...
...
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