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
59324069
authored
Aug 03, 2021
by
andrewlewis
Committed by
Christos Tsilopoulos
Aug 04, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Use AudioTrack.isDirectPlaybackSupported on TVs only
Issue: #9239 PiperOrigin-RevId: 388437614
parent
95dcd896
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
RELEASENOTES.md
library/core/src/main/java/com/google/android/exoplayer2/audio/AudioCapabilities.java
RELEASENOTES.md
View file @
59324069
...
...
@@ -50,6 +50,11 @@
*
Change interface of
`LoadErrorHandlingPolicy`
to support configuring the
behavior of track and location fallback. Location fallback is currently
only supported for DASH manifests with multiple base URLs.
*
Disable platform transcoding when playing content URIs on Android 12.
*
Restrict use of
`AudioTrack.isDirectPlaybackSupported`
to TVs, to avoid
listing audio offload encodings as supported for passthrough mode on
mobile devices
(
[
#9239
](
https://github.com/google/ExoPlayer/issues/9239
)
).
*
Remove deprecated symbols:
*
Remove
`Player.getPlaybackError`
. Use
`Player.getPlayerError`
instead.
*
Remove
`Player.getCurrentTag`
. Use
`Player.getCurrentMediaItem`
and
...
...
library/core/src/main/java/com/google/android/exoplayer2/audio/AudioCapabilities.java
View file @
59324069
...
...
@@ -88,9 +88,12 @@ public final class AudioCapabilities {
&&
Global
.
getInt
(
context
.
getContentResolver
(),
EXTERNAL_SURROUND_SOUND_KEY
,
0
)
==
1
)
{
return
EXTERNAL_SURROUND_SOUND_CAPABILITIES
;
}
if
(
Util
.
SDK_INT
>=
29
)
{
// AudioTrack.isDirectPlaybackSupported returns true for encodings that are supported for audio
// offload, as well as for encodings we want to list for passthrough mode. Therefore we only use
// it on TV devices, which generally shouldn't support audio offload for surround encodings.
if
(
Util
.
SDK_INT
>=
29
&&
Util
.
isTv
(
context
))
{
return
new
AudioCapabilities
(
A
udioTrackWrapperV
29
.
getDirectPlaybackSupportedEncodingsV29
(),
DEFAULT_MAX_CHANNEL_COUNT
);
A
pi
29
.
getDirectPlaybackSupportedEncodingsV29
(),
DEFAULT_MAX_CHANNEL_COUNT
);
}
if
(
intent
==
null
||
intent
.
getIntExtra
(
AudioManager
.
EXTRA_AUDIO_PLUG_STATE
,
0
)
==
0
)
{
return
DEFAULT_AUDIO_CAPABILITIES
;
...
...
@@ -185,7 +188,7 @@ public final class AudioCapabilities {
}
@RequiresApi
(
29
)
private
static
final
class
A
udioTrackWrapperV
29
{
private
static
final
class
A
pi
29
{
@DoNotInline
public
static
int
[]
getDirectPlaybackSupportedEncodingsV29
()
{
ImmutableList
.
Builder
<
Integer
>
supportedEncodingsListBuilder
=
ImmutableList
.
builder
();
...
...
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