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
9926a8f6
authored
Oct 01, 2021
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge pull request #9498 from DolbyLaboratories:dev-v2-direct-automotive
PiperOrigin-RevId: 400134426
parents
ce0cf23a
732fc3ef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
library/common/src/main/java/com/google/android/exoplayer2/util/Util.java
library/core/src/main/java/com/google/android/exoplayer2/audio/AudioCapabilities.java
library/common/src/main/java/com/google/android/exoplayer2/util/Util.java
View file @
9926a8f6
...
@@ -2306,6 +2306,17 @@ public final class Util {
...
@@ -2306,6 +2306,17 @@ public final class Util {
}
}
/**
/**
* Returns whether the app is running on an automotive device.
*
* @param context Any context.
* @return Whether the app is running on an automotive device.
*/
public
static
boolean
isAutomotive
(
Context
context
)
{
return
Util
.
SDK_INT
>=
23
&&
context
.
getPackageManager
().
hasSystemFeature
(
PackageManager
.
FEATURE_AUTOMOTIVE
);
}
/**
* Gets the size of the current mode of the default display, in pixels.
* Gets the size of the current mode of the default display, in pixels.
*
*
* <p>Note that due to application UI scaling, the number of pixels made available to applications
* <p>Note that due to application UI scaling, the number of pixels made available to applications
...
...
library/core/src/main/java/com/google/android/exoplayer2/audio/AudioCapabilities.java
View file @
9926a8f6
...
@@ -90,8 +90,9 @@ public final class AudioCapabilities {
...
@@ -90,8 +90,9 @@ public final class AudioCapabilities {
}
}
// AudioTrack.isDirectPlaybackSupported returns true for encodings that are supported for audio
// 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
// 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.
// it on TV and automotive devices, which generally shouldn't support audio offload for surround
if
(
Util
.
SDK_INT
>=
29
&&
Util
.
isTv
(
context
))
{
// encodings.
if
(
Util
.
SDK_INT
>=
29
&&
(
Util
.
isTv
(
context
)
||
Util
.
isAutomotive
(
context
)))
{
return
new
AudioCapabilities
(
return
new
AudioCapabilities
(
Api29
.
getDirectPlaybackSupportedEncodings
(),
DEFAULT_MAX_CHANNEL_COUNT
);
Api29
.
getDirectPlaybackSupportedEncodings
(),
DEFAULT_MAX_CHANNEL_COUNT
);
}
}
...
...
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