media: Crash on playback in onAudioCapabilitiesChanged
Version
Media3 1.3.0
More version details
No response
Devices that reproduce the issue
- Fire TV Stick 4K
Devices that do not reproduce the issue
- Nvidia Shield
- Android emulator (API 33)
Reproducible in the demo app?
Not tested
Reproduction steps
Steps To Reproduce:
- Install and launch the app
- Go through the app content and use the functionality as outlined in description
- Select Music Category
- Click on play button Actual Result: Observe app force closes to launch page Expected Result: App must not experience force close, crash, or soft/hard lock while in use, even when dealing with conflicting inputs.
(Via Amazon tester)
Expected result
The androidx.media3 library should not cause a crash due to invalid state.
Actual result
The check in onAudioCapabilitiesChanged() fails because it is not called from the main thread. This appears to be a regression introduced in 432cde60511db47a739973cff7c2da287380fa15, to be specific the newly introduced “OnRoutingChangedListenerApi24”.
03-17 02:58:54.887: E/ACRA(10455): ACRA caught a IllegalStateException for org.jellyfin.androidtv
03-17 02:58:54.887: E/ACRA(10455): java.lang.IllegalStateException
03-17 02:58:54.887: E/ACRA(10455): at androidx.media3.common.util.Assertions.checkState(Assertions.java:85)
03-17 02:58:54.887: E/ACRA(10455): at androidx.media3.exoplayer.audio.DefaultAudioSink.onAudioCapabilitiesChanged(DefaultAudioSink.java:1527)
03-17 02:58:54.887: E/ACRA(10455): at androidx.media3.exoplayer.audio.DefaultAudioSink$$ExternalSyntheticLambda16.onAudioCapabilitiesChanged(D8$$SyntheticClass)
03-17 02:58:54.887: E/ACRA(10455): at androidx.media3.exoplayer.audio.AudioCapabilitiesReceiver.onNewAudioCapabilities(AudioCapabilitiesReceiver.java:205)
03-17 02:58:54.887: E/ACRA(10455): at androidx.media3.exoplayer.audio.AudioCapabilitiesReceiver.setRoutedDevice(AudioCapabilitiesReceiver.java:142)
03-17 02:58:54.887: E/ACRA(10455): at androidx.media3.exoplayer.audio.DefaultAudioSink$OnRoutingChangedListenerApi24.onRoutingChanged(DefaultAudioSink.java:1939)
03-17 02:58:54.887: E/ACRA(10455): at androidx.media3.exoplayer.audio.DefaultAudioSink$OnRoutingChangedListenerApi24.$r8$lambda$HRb3r58UkCrShJGoyBtN21Qgd6c(DefaultAudioSink.java)
03-17 02:58:54.887: E/ACRA(10455): at androidx.media3.exoplayer.audio.DefaultAudioSink$OnRoutingChangedListenerApi24$$ExternalSyntheticLambda4.onRoutingChanged(D8$$SyntheticClass)
03-17 02:58:54.887: E/ACRA(10455): at android.media.AudioTrack$NativeRoutingEventHandlerDelegate$1.handleMessage(AudioTrack.java:2764)
03-17 02:58:54.887: E/ACRA(10455): at android.os.Handler.dispatchMessage(Handler.java:102)
03-17 02:58:54.887: E/ACRA(10455): at android.os.Looper.loop(Looper.java:154)
03-17 02:58:54.887: E/ACRA(10455): at android.os.HandlerThread.run(HandlerThread.java:61)
Media
The Amazon tester used an MP3 file.
Bug Report
- You will email the zip file produced by
adb bugreportto android-media-github@google.com after filing this issue.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 16
Commits related to this issue
- Add more details to thread assertion in onAudioCapabilitiesChanged This helps to debug issues reported in https://github.com/androidx/media/issues/1191 PiperOrigin-RevId: 636545970 — committed to androidx/media by tonihei 2 years ago
- Feat/migrate media3 (#35) * Re-apply CEA-708 `rowLock/columnLock` fix This change was originally made in https://github.com/androidx/media/commit/6f8249184bd69b126c93479f918768b0cf2d0889 It was... — committed to DiceTechnology/androidx-media by guoen21 2 years ago
- More clearly assert if DefaultAudioSink is used from wrong thread This may happen if apps call Renderer.getFormatSupport on the main thread outside the player for example. Using the DefaultAudioSink ... — committed to androidx/media by tonihei a year ago
If this is not reproducible, I’m inclined to leave it for now until we know more. I’ll leave the issue open and if you or anyone else sees something like that again we can look into submitting a workaround.