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
fad2846d
authored
Sep 24, 2020
by
krocard
Committed by
kim-vde
Sep 25, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Workaround AudioTrack incorrect error code
#exo-offload PiperOrigin-RevId: 333513385
parent
aa7309cd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletions
library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java
library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java
View file @
fad2846d
...
...
@@ -234,6 +234,18 @@ public final class DefaultAudioSink implements AudioSink {
/** To avoid underruns on some devices (e.g., Broadcom 7271), scale up the AC3 buffer duration. */
private
static
final
int
AC3_BUFFER_MULTIPLICATION_FACTOR
=
2
;
/**
* Native error code equivalent of {@link AudioTrack#ERROR_DEAD_OBJECT} to workaround missing
* error code translation on some devices.
*
* <p>On some devices, AudioTrack native error codes are not always converted to their SDK
* equivalent.
*
* <p>For example: {@link AudioTrack#write(byte[], int, int)} can return -32 instead of {@link
* AudioTrack#ERROR_DEAD_OBJECT}.
*/
private
static
final
int
ERROR_NATIVE_DEAD_OBJECT
=
-
32
;
private
static
final
String
TAG
=
"AudioTrack"
;
/**
...
...
@@ -966,7 +978,8 @@ public final class DefaultAudioSink implements AudioSink {
}
private
static
boolean
isAudioTrackDeadObject
(
int
status
)
{
return
Util
.
SDK_INT
>=
24
&&
status
==
AudioTrack
.
ERROR_DEAD_OBJECT
;
return
(
Util
.
SDK_INT
>=
24
&&
status
==
AudioTrack
.
ERROR_DEAD_OBJECT
)
||
status
==
ERROR_NATIVE_DEAD_OBJECT
;
}
private
boolean
drainToEndOfStream
()
throws
WriteException
{
...
...
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