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
8e638ec7
authored
Nov 10, 2020
by
kimvde
Committed by
Ian Baker
Nov 19, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Work around AudioManager#getStreamVolume crashes
Issue:#8191 PiperOrigin-RevId: 341632732
parent
11b09dd5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
RELEASENOTES.md
library/core/src/main/java/com/google/android/exoplayer2/StreamVolumeManager.java
RELEASENOTES.md
View file @
8e638ec7
...
...
@@ -16,6 +16,10 @@
`LeanbackPlayerAdapter`
and use
`ControlDispatcher`
for dispatching
prepare instead
(
[
#7882
](
https://github.com/google/ExoPlayer/issues/7882
)
).
*
Audio:
*
Retry playback after some types of
`AudioTrack`
error.
*
Work around
`AudioManager`
crashes when calling
`getStreamVolume`
(
[
#8191
](
https://github.com/google/ExoPlayer/issues/8191
)
).
*
Extractors:
*
Matroska: Add support for 32-bit floating point PCM, and 8-bit and
16-bit big endian integer PCM
...
...
library/core/src/main/java/com/google/android/exoplayer2/StreamVolumeManager.java
View file @
8e638ec7
...
...
@@ -188,7 +188,14 @@ import com.google.android.exoplayer2.util.Util;
}
private
static
int
getVolumeFromManager
(
AudioManager
audioManager
,
@C
.
StreamType
int
streamType
)
{
return
audioManager
.
getStreamVolume
(
streamType
);
// AudioManager#getStreamVolume(int) throws an exception on some devices. See
// https://github.com/google/ExoPlayer/issues/8191.
try
{
return
audioManager
.
getStreamVolume
(
streamType
);
}
catch
(
RuntimeException
e
)
{
Log
.
w
(
TAG
,
"Could not retrieve stream volume for stream type "
+
streamType
,
e
);
return
audioManager
.
getStreamMaxVolume
(
streamType
);
}
}
private
static
boolean
getMutedFromManager
(
...
...
@@ -196,7 +203,7 @@ import com.google.android.exoplayer2.util.Util;
if
(
Util
.
SDK_INT
>=
23
)
{
return
audioManager
.
isStreamMute
(
streamType
);
}
else
{
return
audioManager
.
getStreamVolume
(
streamType
)
==
0
;
return
getVolumeFromManager
(
audioManager
,
streamType
)
==
0
;
}
}
...
...
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