RemoteCastPlayer: receiver stalls in buffering when a single setActiveMediaTracks request changes the audio and the text track during playback

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

Los mantenedores suelen responder en 4 días

@tanay187 ya está trabajando en esto.

Desde el 18/11/2026.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

bug needs triage
Version

Media3 1.11.0

More version details
  • media3-cast 1.11.0, RemoteCastPlayer wrapped in CastPlayer, with a custom CastTrackSelector
  • play-services-cast-framework 22.3.1
Devices that reproduce the issue
  • Sender: Redmi Note 8 Pro running Android 11 (also seen with a Pixel 6)
  • Receiver: TV Stick (SDMC), Android TV 10, Chromecast built-in 3.72.446070
Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Not tested

Reproduction steps

Not tested in the demo app (the Cast demo has no CastTrackSelector, so it never sends track changes)

  1. Cast a DASH stream with at least two audio languages and one subtitle track, using RemoteCastPlayer with a CastTrackSelector that applies the preferred languages, for example:
    class LanguageCastTrackSelector : CastTrackSelector() {
        override fun evaluate(request: CastTrackSelectorRequest): CastTrackSelectorResult {
            val params = request.trackSelectionParameters
            fun pick(type: Int, language: String?) =
                request.trackGroupList.firstOrNull { it.type == type && it.getFormat(0).language == language }
            val audio = pick(C.TRACK_TYPE_AUDIO, params.preferredAudioLanguages.firstOrNull())
            val text = pick(C.TRACK_TYPE_TEXT, params.preferredTextLanguages.firstOrNull())
            val kept = request.currentlySelectedTrackGroups.filter {
                (it.type != C.TRACK_TYPE_AUDIO || audio == null) && (it.type != C.TRACK_TYPE_TEXT || text == null)
            }
            return request.buildResultUpon().setSelections(ImmutableSet.copyOf(kept + listOfNotNull(audio, text))).build()
        }
    }
    
  2. While the receiver is playing, change the audio and the subtitle at once:
    player.trackSelectionParameters = player.trackSelectionParameters.buildUpon()
        .setPreferredAudioLanguage("<other audio language>")
        .setPreferredTextLanguage("<subtitle language>")
        .build()
    
    RemoteCastPlayer sends one setActiveMediaTracks([audioId, textId]) (a single EDIT_TRACKS_INFO message).
  3. Watch the receiver.
Expected result

The receiver switches both tracks and playback goes on.

Actual result

The receiver never resumes playback and RemoteCastPlayer stays in STATE_BUFFERING. Receiver logcat (cast_shell), with the sender log aligned on it (the two clocks are not synchronized):

  1. The receiver starts playing: Effective playback rate changed from 0 to 1.
  2. The sender sends one setActiveMediaTracks([2, 3]): audio track 2 and text track 3.
  3. The receiver switches the audio: it empties the audio SourceBuffer (remove start=0 end=3826), seeks to the current position (kSeek 2054.58) and goes BUFFERING_HAVE_NOTHING. The system media session reports STATE_BUFFERING with speed 0.
  4. It appends the new audio init segment and 4 audio segments, video and audio go back to BUFFERING_HAVE_ENOUGH, and kPlay is logged twice.
  5. Then nothing happens: no Effective playback rate changed from 0 to 1, no further appendBuffer on either SourceBuffer for the remaining 21 s of the capture, and the media session stays in STATE_BUFFERING. The sender never leaves buffering.

Log excerpt attached (excerpt.txt); full sender and receiver logcats available.

Sending the same change in two requests works every time: setActiveMediaTracks with the new audio only, then, once the receiver status reports that audio as active, setActiveMediaTracks with the new subtitle. We use this as a workaround in our CastTrackSelector.

Is this a known receiver limitation? Since RemoteCastPlayer sends the whole selection in one request, should media3 (or CastTrackSelector) apply audio and text changes one after the other, or is this a CAF receiver bug to report to the Cast SDK team?

Media

Widevine-protected DASH stream, multi-period (pre-roll ad period, then main content).

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
1k
Merge medio
6 d 4 h
PR fusionados (30 d)
5

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.