Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

MediaUtils.mergePlayerInfo crashes with IllegalStateException on invalid PlayerInfo from remote session

Abierto
#3,239 0 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 4 días

@marcbaechinger ya está trabajando en esto.

Desde el 29/5/2026.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

bug needs triage
Version

Media3 1.10.0

More version details

No response

Devices that reproduce the issue
  • TCL Smart Tv Pro
Devices that do not reproduce the issue

No response

Reproducible in the demo app?

No response

Reproduction steps

MediaUtils.mergePlayerInfo() throws an IllegalStateException via Preconditions.checkState() when a remote MediaSession sends a PlayerInfo update with an out-of-bounds currentMediaItemIndex. This crash is not catchable by the client app.

Note : this is probably related to #1447

Context

I develop an Android TV launcher that connects to active MediaSessions (via MediaSessionManager.getActiveSessions() → SessionToken.createSessionToken() → MediaController.Builder.buildAsync()) in order to display a "Now Playing" row. The launcher simply listens to player state/metadata changes and does not control playback.

Why this is a problem

The crash originates from a misbehaving remote app, not from the client. The client MediaController has no way to validate or reject the incoming PlayerInfo before mergePlayerInfo() is called.
The crash happens inside Media3's internal handler dispatch (MediaControllerStub.dispatchControllerTaskOnHandler), so there is no way for the client app to catch it — it's not wrapped in any client-facing callback.
Impact: For a launcher, any third-party app with a broken MediaSession can crash the entire launcher, which is the user's home screen.

Expected result

mergePlayerInfo() should handle an invalid index gracefully — for example by logging a warning and ignoring the update (or clamping the index) — rather than crashing the client process. The client should not be punished for a remote session sending inconsistent state.

Actual result

A remote app (in this case com.crunchyroll.crunchyroid, interface version=8) sends a PlayerInfo update where newIndex = 1 but the timeline only contains 1 item (count = 1). This triggers a fatal

IllegalStateException in MediaUtils.mergePlayerInfo():
Fatal Exception: java.lang.IllegalStateException: Invalid PlayerInfo update, old index: 0 (count=1), new index = 1, sent from com.crunchyroll.crunchyroid, interface version=8
    at androidx.core.util.Preconditions.checkState(Preconditions.java:169)
    at androidx.media3.session.MediaUtils.mergePlayerInfo(MediaUtils.java:150)
    at androidx.media3.session.MediaControllerImplBase.onPlayerInfoChanged(MediaControllerImplBase.java:2965)
    at androidx.media3.session.MediaControllerStub.lambda$onPlayerInfoChangedWithExclusions$12(MediaControllerStub.java:309)
    at androidx.media3.session.MediaControllerStub.lambda$dispatchControllerTaskOnHandler$18(MediaControllerStub.java:431)
    at android.os.Handler.handleCallback(Handler.java:958)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:233)
    at android.os.Looper.loop(Looper.java:328)
    at android.app.ActivityThread.main(ActivityThread.java:8305)
Media

I don't have any media related to this issue as this is not originating from my app. I didn't reproduce it myself, it has only been seen on crashlytics.

Bug Report
  • You will email the zip file produced by adb bugreport to [email protected] after filing this issue.
Lenguaje dominante
Java
Estrellas
3.1k
Forks
998
Merge medio
6 d 8 h
PR fusionados (30 d)
2

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de androidx/media

Todos los issues de androidx/media

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.