Skip to content

[video_player_android] Enable ExoPlayer decoder fallback - #12837

Open
remyturpin-veesion wants to merge 1 commit into
flutter:mainfrom
veesion-io:video-player-android-decoder-fallback
Open

[video_player_android] Enable ExoPlayer decoder fallback#12837
remyturpin-veesion wants to merge 1 commit into
flutter:mainfrom
veesion-io:video-player-android-decoder-fallback

Conversation

@remyturpin-veesion

Copy link
Copy Markdown

Enables setEnableDecoderFallback on the DefaultRenderersFactory backing the ExoPlayer instance, so playback falls back to a lower-priority decoder when the preferred one fails to initialize, instead of surfacing an ExoPlaybackException.

On some devices MediaCodecUtil reports a format as supported, the hardware decoder is selected, and initialization fails anyway. Playback then aborts even though a working software decoder is present on the device.

Reproduced on a Lenovo Tab M10 FHD Plus (MediaTek mt6765, Android 10). ExoPlayer selects OMX.MTK.VIDEO.DECODER.AVC, and ACodec cannot raise the output buffer count past the value the decoder declares:

[OUTPUT] nBufferCountActual(7)
setParameter(ParamPortDefinition) ERROR: BadParameter(0x80001005)
setting nBufferCountActual to 14 failed: -22
setting nBufferCountActual to 13 failed: -22
setting nBufferCountActual to 12 failed: -22
setting nBufferCountActual to 11 failed: -22
E/ACodec: Failed to allocate buffers after transitioning to IDLE state (0xffffffea)
E/MediaCodec: Codec reported err 0xffffffea, actionCode 0, while in state 5

The failure is in buffer negotiation rather than codec capability, which is why the error carries format_supported=YES and reproduces at any resolution or profile — verified from 480p Main@3.1 to 1080p High@4.0. With the flag enabled, playback proceeds on c2.android.avc.decoder.

Verified by building the same application twice, differing only in this flag: playback fails every time without it and succeeds every time with it, on the same device and the same videos.

Fallback only engages after the preferred decoder has already failed to initialize, so the trade-off is a possibly slower decoder rather than no playback at all.

Related to flutter/flutter#185674 — same error signature, reported there on Huawei hardware. The device used here is a MediaTek tablet, so the underlying vendor failure may differ, but the fallback path is the same.

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2

@google-cla

google-cla Bot commented Sep 11, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enables ExoPlayer's decoder fallback in both PlatformViewVideoPlayer and TextureVideoPlayer by configuring DefaultRenderersFactory with setEnableDecoderFallback(true). It also adds a corresponding unit test in TextureVideoPlayerTest to verify this behavior, and bumps the package version to 2.12.3 in pubspec.yaml and CHANGELOG.md. There are no review comments, so no additional feedback is provided.

On some devices MediaCodecUtil reports a format as supported, the hardware
decoder is selected, and initialization fails anyway, aborting playback even
though a working software decoder is available.

Enabling decoder fallback on the DefaultRenderersFactory lets ExoPlayer move
on to the next candidate decoder instead of surfacing an ExoPlaybackException.

Related to flutter/flutter#185674
@remyturpin-veesion
remyturpin-veesion force-pushed the video-player-android-decoder-fallback branch from b22c3ba to 7d78d2e Compare September 11, 2026 13:23
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.

1 participant