Skip to content

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

Open

Description

@yoobi

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

Activity

  1. self-assigned this
    on Nov 18, 2026
  2. tanay187 commented on Nov 18, 2026

    @tanay187
    Contributor

    @yoobi Thanks for raising the issue and the detailed report!

    The buffering stall when switching both audio and text track simultaneously looks like a receiver-side issue. I'll report this to the Cast receiver team to investigate, and we'll also look into whether we can sequence combined audio and text changes defensively in RemoteCastPlayer on the Media3 side.

    Can you please also email the sender and receiver logcats to android-media-github@google.com with "Issue 3561" in the subject line if you haven't already?

    Will keep you posted here as we have updates.

  3. yoobi commented on Nov 18, 2026

    @yoobi
    ContributorAuthor

    Thanks I have created a similar report on the cast sdk here is the link https://issuetracker.google.com/issues/587104162

    I'll try to give you either a drm we use (not sure the link will be have a long enough expiration time and otherwise i'll find a public video that can reproduce and link it here)

  4. yoobi commented on Nov 19, 2026

    @yoobi
    ContributorAuthor

    @tanay187 Reproduced with a public, unencrypted, single-period DASH stream: https://media.axprod.net/TestVectors/v7-Clear/Manifest_1080p.mpd (3 audio languages: en, en-AU, et-ET; text tracks: en, zh-Hant-CN, nl, ru, es)

    Sender: Android, play-services-cast-framework via androidx.media3 1.11.0 (RemoteCastPlayer).
    Receiver: custom CAF v3 Web Receiver whose only code sets DRM on LOAD (not used here, the stream is clear).
    Device: Android TV stick, Chromecast built-in (com.google.android.apps.mediashell 3.72.446070).

    Sequence, from the sender's RemoteMediaClient status updates:
    13:32:32.163 playerState=LOADING
    13:32:33.076 playerState=BUFFERING activeTrackIds=[1]
    13:32:34.263 playerState=PLAYING activeTrackIds=[1]
    13:32:34.266 sender: setActiveMediaTracks([3, 4]) (audio et-ET + text en, one EDIT_TRACKS_INFO)
    13:32:34.342 playerState=PLAYING activeTrackIds=[3, 4]
    13:32:34.373 playerState=BUFFERING activeTrackIds=[3, 4] <- never leaves BUFFERING

    So DRM and multi-period are not involved. Sending the audio change first, then the text change once the status reports the audio as active, works.

    Edit: I reproduced the same issue with Google's Default Media Receiver (CC1AD845)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    ⌂ 换网址