[video_player_android] Enable ExoPlayer decoder fallback - #12837
[video_player_android] Enable ExoPlayer decoder fallback#12837remyturpin-veesion wants to merge 1 commit into
Conversation
|
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. |
There was a problem hiding this comment.
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
b22c3ba to
7d78d2e
Compare
Enables
setEnableDecoderFallbackon theDefaultRenderersFactorybacking theExoPlayerinstance, so playback falls back to a lower-priority decoder when the preferred one fails to initialize, instead of surfacing anExoPlaybackException.On some devices
MediaCodecUtilreports 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, andACodeccannot raise the output buffer count past the value the decoder declares:The failure is in buffer negotiation rather than codec capability, which is why the error carries
format_supported=YESand reproduces at any resolution or profile — verified from 480p Main@3.1 to 1080p High@4.0. With the flag enabled, playback proceeds onc2.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
[shared_preferences]///).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-assistbot 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
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