Commit 5e4cd12 1 parent cc8f4dc commit 5e4cd12 Copy full SHA for 5e4cd12
File tree 2 files changed +10
-3
lines changed
library/core/src/main/java/com/google/android/exoplayer2/audio
2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 51
51
behavior of track and location fallback. Location fallback is currently
52
52
only supported for DASH manifests with multiple base URLs.
53
53
* Disable platform transcoding when playing content URIs on Android 12.
54
+ * Restrict use of ` AudioTrack.isDirectPlaybackSupported ` to TVs, to avoid
55
+ listing audio offload encodings as supported for passthrough mode on
56
+ mobile devices
57
+ ([ #9239 ] ( https://github.com/google/ExoPlayer/issues/9239 ) ).
54
58
* Remove deprecated symbols:
55
59
* Remove ` Player.getPlaybackError ` . Use ` Player.getPlayerError ` instead.
56
60
* Remove ` Player.getCurrentTag ` . Use ` Player.getCurrentMediaItem ` and
Original file line number Diff line number Diff line change @@ -88,9 +88,12 @@ public static AudioCapabilities getCapabilities(Context context) {
88
88
&& Global .getInt (context .getContentResolver (), EXTERNAL_SURROUND_SOUND_KEY , 0 ) == 1 ) {
89
89
return EXTERNAL_SURROUND_SOUND_CAPABILITIES ;
90
90
}
91
- if (Util .SDK_INT >= 29 ) {
91
+ // AudioTrack.isDirectPlaybackSupported returns true for encodings that are supported for audio
92
+ // offload, as well as for encodings we want to list for passthrough mode. Therefore we only use
93
+ // it on TV devices, which generally shouldn't support audio offload for surround encodings.
94
+ if (Util .SDK_INT >= 29 && Util .isTv (context )) {
92
95
return new AudioCapabilities (
93
- AudioTrackWrapperV29 .getDirectPlaybackSupportedEncodingsV29 (), DEFAULT_MAX_CHANNEL_COUNT );
96
+ Api29 .getDirectPlaybackSupportedEncodingsV29 (), DEFAULT_MAX_CHANNEL_COUNT );
94
97
}
95
98
if (intent == null || intent .getIntExtra (AudioManager .EXTRA_AUDIO_PLUG_STATE , 0 ) == 0 ) {
96
99
return DEFAULT_AUDIO_CAPABILITIES ;
@@ -185,7 +188,7 @@ private static boolean deviceMaySetExternalSurroundSoundGlobalSetting() {
185
188
}
186
189
187
190
@ RequiresApi (29 )
188
- private static final class AudioTrackWrapperV29 {
191
+ private static final class Api29 {
189
192
@ DoNotInline
190
193
public static int [] getDirectPlaybackSupportedEncodingsV29 () {
191
194
ImmutableList .Builder <Integer > supportedEncodingsListBuilder = ImmutableList .builder ();
You can’t perform that action at this time.
0 commit comments