You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Play DASH stream with E-AC3-JOC audio or with audio with unknown channel count.
The following exception is thrown during processing of period data:
09-14 20:50:15.735 1515 2397 E ExoPlayerImplInternal: Playback error
09-14 20:50:15.735 1515 2397 E ExoPlayerImplInternal: com.google.android.exoplayer2.ExoPlaybackException: Unexpected runtime error
09-14 20:50:15.735 1515 2397 E ExoPlayerImplInternal: at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:668)
09-14 20:50:15.735 1515 2397 E ExoPlayerImplInternal: at android.os.Handler.dispatchMessage(Handler.java:102)
09-14 20:50:15.735 1515 2397 E ExoPlayerImplInternal: at android.os.Looper.loopOnce(Looper.java:201)
09-14 20:50:15.735 1515 2397 E ExoPlayerImplInternal: at android.os.Looper.loop(Looper.java:288)
09-14 20:50:15.735 1515 2397 E ExoPlayerImplInternal: at android.os.HandlerThread.run(HandlerThread.java:67)
09-14 20:50:15.735 1515 2397 E ExoPlayerImplInternal: Caused by: java.lang.IllegalArgumentException: Invalid zero channel mask
09-14 20:50:15.735 1515 2397 E ExoPlayerImplInternal: at android.media.AudioFormat$Builder.setChannelMask(AudioFormat.java:1126)
09-14 20:50:15.735 1515 2397 E ExoPlayerImplInternal: at com.google.android.exoplayer2.audio.AudioCapabilities$Api29.getMaxSupportedChannelCountForPassthrough(AudioCapabilities.java:419)
09-14 20:50:15.735 1515 2397 E ExoPlayerImplInternal: at com.google.android.exoplayer2.audio.AudioCapabilities.getMaxSupportedChannelCountForPassthrough(AudioCapabilities.java:302)
09-14 20:50:15.735 1515 2397 E ExoPlayerImplInternal: at com.google.android.exoplayer2.audio.AudioCapabilities.getEncodingAndChannelConfigForPassthrough(AudioCapabilities.java:240)
09-14 20:50:15.735 1515 2397 E ExoPlayerImplInternal: at com.google.android.exoplayer2.audio.AudioCapabilities.isPassthroughPlaybackSupported(AudioCapabilities.java:199)
09-14 20:50:15.735 1515 2397 E ExoPlayerImplInternal: at com.google.android.exoplayer2.audio.DefaultAudioSink.getFormatSupport(DefaultAudioSink.java:620)
09-14 20:50:15.735 1515 2397 E ExoPlayerImplInternal: at com.google.android.exoplayer2.audio.DefaultAudioSink.supportsFormat(DefaultAudioSink.java:599)
09-14 20:50:15.735 1515 2397 E ExoPlayerImplInternal: at com.google.android.exoplayer2.audio.MediaCodecAudioRenderer.supportsFormat(MediaCodecAudioRenderer.java:300)
09-14 20:50:15.735 1515 2397 E ExoPlayerImplInternal: at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.supportsFormat(MediaCodecRenderer.java:459)
09-14 20:50:15.735 1515 2397 E ExoPlayerImplInternal: at com.google.android.exoplayer2.trackselection.MappingTrackSelector.findRenderer(MappingTrackSelector.java:513)
09-14 20:50:15.735 1515 2397 E ExoPlayerImplInternal: at com.google.android.exoplayer2.trackselection.MappingTrackSelector.selectTracks(MappingTrackSelector.java:380)
09-14 20:50:15.735 1515 2397 E ExoPlayerImplInternal: at com.google.android.exoplayer2.MediaPeriodHolder.selectTracks(MediaPeriodHolder.java:246)
09-14 20:50:15.735 1515 2397 E ExoPlayerImplInternal: at com.google.android.exoplayer2.MediaPeriodHolder.handlePrepared(MediaPeriodHolder.java:194)
09-14 20:50:15.735 1515 2397 E ExoPlayerImplInternal: at com.google.android.exoplayer2.ExoPlayerImplInternal.handlePeriodPrepared(ExoPlayerImplInternal.java:2327)
09-14 20:50:15.735 1515 2397 E ExoPlayerImplInternal: at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:541)
09-14 20:50:15.735 1515 2397 E ExoPlayerImplInternal: ... 4 more
There is an issue in AudioCapabilities.java getMaxSupportedChannelCountForPassthrough().
The function iterates from DEFAULT_MAX_CHANNEL_COUNT, which now is 10 to 1 and trying to create AudioFormat, setting the channel mask with given channel count, but Util.getAudioTrackChannelConfig() for input parameter 9 returns AudioFormat.CHANNEL_INVALID, which leads to exception.
The issue happened after May 25 2023, when DEFAULT_MAX_CHANNEL_COUNT was changed from 8 to 10.
The possible fix:
diff --git a/library/core/src/main/java/com/google/android/exoplayer2/audio/AudioCapabilities.java b/library/core/src/main/java/com/google/android/exoplayer2/audio/AudioCapabilities.java
index d384d05fdb..09f0507cf2 100644
--- a/library/core/src/main/java/com/google/android/exoplayer2/audio/AudioCapabilities.java
+++ b/library/core/src/main/java/com/google/android/exoplayer2/audio/AudioCapabilities.java
@@ -412,11 +412,15 @@ public final class AudioCapabilities {
// TODO(internal b/234351617): Query supported channel masks directly once it's supported,
// see also b/25994457.
for (int channelCount = DEFAULT_MAX_CHANNEL_COUNT; channelCount > 0; channelCount--) {
+ int channelMask = Util.getAudioTrackChannelConfig(channelCount);
+ if(AudioFormat.CHANNEL_INVALID == channelMask) {
+ continue;
+ }
AudioFormat audioFormat =
new AudioFormat.Builder()
.setEncoding(encoding)
.setSampleRate(sampleRate)
- .setChannelMask(Util.getAudioTrackChannelConfig(channelCount))
+ .setChannelMask(channelMask)
.build();
if (AudioTrack.isDirectPlaybackSupported(audioFormat, DEFAULT_AUDIO_ATTRIBUTES)) {
return channelCount;
Version
ExoPlayer 2.19.1
More version details
No response
Devices that reproduce the issue
Android 12 STB
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Yes
Reproduction steps
Play DASH stream with E-AC3-JOC audio or with audio with unknown channel count.
The following exception is thrown during processing of period data:
The function iterates from DEFAULT_MAX_CHANNEL_COUNT, which now is 10 to 1 and trying to create AudioFormat, setting the channel mask with given channel count, but Util.getAudioTrackChannelConfig() for input parameter 9 returns AudioFormat.CHANNEL_INVALID, which leads to exception.
The issue happened after May 25 2023, when DEFAULT_MAX_CHANNEL_COUNT was changed from 8 to 10.
The possible fix:
Expected result
Media stream is played correctly.
Actual result
Playback error
Media
Bug Report
adb bugreport
to [email protected] after filing this issue.The text was updated successfully, but these errors were encountered: