[Android TV] Player crashed when system audio capability changed

Hi,

My users have recently experienced crashes on the latest release of the App, specifically with Bitmovin version 3.52.0.

Based on the crash log, it’s likely that the TV attempted to play the audio track through the HDMI port but failed.

these are the crash logs:

Fatal Exception: java.lang.RuntimeException: Error receiving broadcast Intent { act=android.media.action.HDMI_AUDIO_PLUG flg=0x40000010 (has extras) } in androidx.media3.exoplayer.audio.AudioCapabilitiesReceiver$HdmiAudioPlugBroadcastReceiver@c4f603e
       at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0(LoadedApk.java:1401)
       at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(:2)
       at android.os.Handler.handleCallback(Handler.java:873)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:193)
       at android.os.HandlerThread.run(HandlerThread.java:65)
Caused by java.lang.IllegalStateException:
       at androidx.media3.common.util.Assertions.checkState(Assertions.java:85)
       at androidx.media3.exoplayer.audio.DefaultAudioSink.onAudioCapabilitiesChanged(DefaultAudioSink.java:1469)
       at androidx.media3.exoplayer.audio.DefaultAudioSink$$ExternalSyntheticLambda6.onAudioCapabilitiesChanged(:2)
       at androidx.media3.exoplayer.audio.AudioCapabilitiesReceiver.onNewAudioCapabilities(AudioCapabilitiesReceiver.java:142)
       at androidx.media3.exoplayer.audio.AudioCapabilitiesReceiver.access$200(AudioCapabilitiesReceiver.java:42)
       at com.pairip.VMRunner.executeVM(VMRunner.java)
       at com.pairip.VMRunner.invoke(VMRunner.java:59)
       at androidx.media3.exoplayer.audio.AudioCapabilitiesReceiver$HdmiAudioPlugBroadcastReceiver.onReceive(:23)
       at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0(LoadedApk.java:1391)
       at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(:2)
       at android.os.Handler.handleCallback(Handler.java:873)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:193)
       at android.os.HandlerThread.run(HandlerThread.java:65)

This is the implementation of Exoplayer’s audio capabilities broadcast receiver where the crash happened:

private final class HdmiAudioPlugBroadcastReceiver extends BroadcastReceiver {
        private HdmiAudioPlugBroadcastReceiver() {
        }

        public void onReceive(Context context, Intent intent) {
            if (!this.isInitialStickyBroadcast()) {
                AudioCapabilitiesReceiver.this.onNewAudioCapabilities(AudioCapabilities.getCapabilities(context, intent));
            }

        }
    }

the class full package name:
androidx.media3.exoplayer.audio.AudioCapabilitiesReceiver.HdmiAudioPlugBroadcastReceiver

Unfortunately, I don’t have any HDMI device capable of replicating the crash. I connected a Jabra Speak 510 speaker to the TV’s USB port and tested the app. It crashed once but did not happen again. Interestingly, when the speaker is connected to the TV, the player’s performance gets worse. The player kept freezing every 3 seconds due to repeated settings of newAudioCapabilities. I upgraded Bitmovin Player to version 3.55.0 but still faced the same issue.

This is the function which gets triggered when the speaker is connected to the TV, it’s part of Exoplayer’s AudioCapabilitiesReceiver.

    private void onNewAudioCapabilities(AudioCapabilities newAudioCapabilities) {
        if (this.registered && !newAudioCapabilities.equals(this.audioCapabilities)) {
            this.audioCapabilities = newAudioCapabilities;
            this.listener.onAudioCapabilitiesChanged(newAudioCapabilities);
        }
    }

Thank you in advance for your help. Let me know if you need any further information from me.

1 Like

Hi @puthea.mam!

Thank you for taking the time to report this issue. The team will investigate it further and keep you updated.

Thanks again,
Chris

1 Like

Hi, @christoph.aigner

May I please know if there are any updates regarding this issue? An increasing number of users are reporting crashes.

Best regard,
Puthea

Hi Puthea, on checking internally, we found that this is also reported by another customer and there is already an internal ticket which will be prioritised through engineering in an up and coming sprint.

The crash being investigated in the internal ticket, it is about IllegalStateException in handling of DefaultAudioSink.onAudioCapabilitiesChanged callback. This most likely is happening when changing audio sink of a TV device when playback is in progress like connecting/disconnecting an HDMI or bluetooth output device etc.

We will keep you updated about when this makes it into a sprint.

Kind regards,

Bitmovin support

3 Likes

Hi,
A release with a fix just came out today.

Please feel free to reach out again in case you need anything else.

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.