Skip to content

Continue playback on another decoder when one fails mid-stream - #3422

Open
HaraldNordgren wants to merge 1 commit into
androidx:mainfrom
HaraldNordgren:fix/recover-from-runtime-decoder-failures
Open

HaraldNordgren wants to merge 1 commit into
androidx:mainfrom
HaraldNordgren:fix/recover-from-runtime-decoder-failures

Conversation

@HaraldNordgren

Copy link
Copy Markdown

I ran into a specific HEVC file that would reliably fail on a Philips Android TV: it played fine for the first 48 minutes, then hard failed every single time I tried to resume from that point, at the exact same timestamp. Device logs showed the TV's MediaTek hardware HEVC decoder itself crashing partway through decoding, well after it had already initialized and decoded almost an hour of video successfully. Since decoder fallback (setEnableDecoderFallback) only ever kicks in when a decoder fails to initialize, a crash like this had no recovery path and surfaced as a fatal playback error every time, on that device, for that file.

This extends decoder fallback to also cover a decoder that crashes partway through decoding, not just one that fails to start. When that happens and another decoder is available for the format, it's excluded and a different decoder is selected, the same way initialization failures are already handled. If no other decoder is available, the failure still surfaces as before.

I verified this against the real failure: with this change, the same file that previously failed every time on this device now falls back to a software decoder mid-stream and plays normally, both from the start and when resuming partway through.

Closes #3421

@HaraldNordgren

Copy link
Copy Markdown
Author

Ping @rohitjoins @tonihei

@microkatz

Copy link
Copy Markdown
Contributor

@HaraldNordgren

As per repo policy, before we review your CL, would you mind rebasing your CL to the androidx:main branch?

A decoder can throw well after initializing successfully, for
example a device-specific hardware bug on one particular file.
That was always fatal before, even with another decoder available.
Decoder fallback now covers this case too, so playback continues.
@HaraldNordgren
HaraldNordgren changed the base branch from release to main September 22, 2026 12:43
@HaraldNordgren
HaraldNordgren force-pushed the fix/recover-from-runtime-decoder-failures branch from ef26100 to d31544a Compare September 22, 2026 12:44
@HaraldNordgren

Copy link
Copy Markdown
Author

@microkatz Done! Maybe it would be good to change the default branch of this repo to main to avoid this in the future?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Recover from runtime decoder failures, not just initialization failures

2 participants