Skip to content

Texture flickering issue when using external textures for video playback on iOS #174794

@qpalwo

Description

@qpalwo

Steps to reproduce

I encountered a texture flickering bug when using external textures for video playback on iOS platform. I've prepared a demo that consistently reproduces this issue on Flutter 3.35.1.

Steps to reproduce:

  1. Clone the demo repository
  2. Run on iOS device with Flutter 3.35.1
  3. Observe texture flickering (no need to click PlayAll)

Expected results

Video should play smoothly without texture flickering.

Actual results

Texture flickering occurs during video playback when using external textures.

Code sample

Code sample

Demo repository: https://github.com/qpalwo/flutter_flash_screen

Key changes: qpalwo/flutter_flash_screen@1f00260

Suspected root cause:
I suspect this issue is related to PR flutter/engine#57020. After changing keep_alive_frame_count to 0, the issue no longer reproduces.

Analysis:
Upon examining the related logic, I believe the problem may be caused by improper reuse of the RenderTargetCache during YUV to RGB conversion.

Screenshots or Video

Screenshots / Video demonstration
out.mp4

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
../offical_flutter/bin/flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel [user-branch], 3.35.1, on macOS 15.6.1 24G90 darwin-arm64, locale zh-Hans-CN)
    ! Flutter version 3.35.1 on channel [user-branch] at /Users/ext/project/offical_flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at
      https://flutter.dev/setup.
    ! Upstream repository unknown source is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
[!] Android toolchain - develop for Android devices (Android SDK version 35.0.1)
    ✗ cmdline-tools component is missing.
      Try installing or updating Android Studio.
      Alternatively, download the tools from https://developer.android.com/studio#command-line-tools-only
      and make sure to set the ANDROID_HOME environment variable.
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/to/macos-android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2025.1)
[✓] VS Code (version 1.103.1)
[✓] Connected device (3 available)
[✓] Network resources

! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

Labels

a: videoVideo playbackc: renderingUI glitches reported at the engine/skia or impeller rendering levelengineflutter/engine related. See also e: labels.platform-iosiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-engineOwned by Engine teamwaiting for PR to land (fixed)A fix is in flight

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions