Skip to content

fix(linux): resolve #639 playback crashes and isolate Flutter 3.47 - #798

Merged
MCDFsteve merged 7 commits into
AimesSoft:mainfrom
baizhenyu:fix-639
Jul 31, 2026
Merged

MCDFsteve merged 7 commits into
AimesSoft:mainfrom
baizhenyu:fix-639

Conversation

@baizhenyu

@baizhenyu baizhenyu commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

合并摘要

解决 #639 中 Linux/NVIDIA 环境下叠加出现的播放崩溃、画面损坏、闪烁和 Libmpv 蓝屏问题,并保留原调查分支中针对 #307 的相关修复。

为可合并所做的整理

  • 合入当前 main(cb4cd8d2),解决原分支基于 v1.11.2 导致的冲突和功能落后。
  • 不再全局升级 Flutter:主线平台继续使用 3.44.6。
  • Linux 独立固定 3.47.0-0.3.pre,通过 .flutter-version-linux 和 pubspec_overrides.linux.yaml 隔离依赖。
  • HarmonyOS 保持独立的 OpenHarmony Flutter 3.35.8-ohos-1.0.1 和 pubspec_overrides.ohos.yaml。
  • 为 Linux 3.47 单独提供 desktop_multi_window_linux_347 兼容层;主线 3.44 和鸿蒙代码不受其内部 API 变化影响。
  • Linux workflow 与 Docker/Podman 构建统一读取 Linux 专属 Flutter 版本并启用 Linux 依赖配置。
  • NVIDIA 判断从“驱动是否加载”收紧为“当前进程是否实际使用 NVIDIA GL/EGL”,避免混合显卡误判。
  • 只迁移旧的默认解码器顺序,保留用户自定义排序。
  • 恢复 media_kit 隔离 EGL 实现,同时保留 Linux ARM64 软件渲染和尺寸缩放保护。
  • vendored FVP 只进入 Linux 依赖图,不再污染其他平台的共享依赖。

验证

  • Flutter 3.47.0-0.3.pre 下 Linux 专属依赖解析成功。
  • 针对修改文件的 flutter analyze:0 issue。
  • 完整 Flutter 测试:287 项通过,2 项按环境跳过。
  • flutter build bundle --no-pub 成功。
  • Linux workflow 通过 actionlint。
  • 容器构建脚本通过 Bash 语法检查。
  • 原 PR 的 Linux/NVIDIA 修复已在 Ubuntu/Wayland/NVIDIA 环境进行播放验证。

本次整理保留了原调查提交的一问题一提交结构,同时消除了原先“不适合合并”的全局 Flutter 升级、旧主分支基线和跨平台依赖污染问题。

Fixes #639.

baizhenyu and others added 7 commits July 31, 2026 01:14
…o host toolchain)

Replicates .github/actions/build-linux in an Ubuntu 24.04 image. Extra
packages vs CI docs (preinstalled on GitHub runners): make (mimalloc via
media_kit_libs_linux), llvm (clang IPO probe), g++ (flutter_js hardcodes it).

Also bundles libsqlite3 into the AppImage: package:sqlite3 dlopens
'libsqlite3.so', which does not exist on stock Ubuntu (only .so.0) — watch
history is silently broken in the official AppImage/deb without it.
…loaded (AimesSoft#639 crash)

VAAPI (and VDPAU) frames imported into an NVIDIA EGL context segfault in
libnvidia-eglcore during player_texture_populate — the exact crash stack in
issue AimesSoft#639 (hybrid AMD+NVIDIA laptop: VAAPI decodes on the iGPU, GL runs on
the dGPU; reproduced with VDPAU on a desktop RTX 5060, driver 595.71.05).

Keyed on /proc/driver/nvidia/version. Also migrates previously saved
decoder orders, since selected_decoders persists the old default.
…ver, AimesSoft#639)

next2_engine_render_gl_texture (librust_lib_nipaplay.so) segfaults inside
libnvidia-eglcore on the raster thread during playback (gdb-verified on
RTX 5060 / 595.71.05, Ubuntu 26.04 Wayland). Even when it does not crash,
its per-frame GL rendering corrupts other textures in the shared context
(green/blue frame corruption affecting every player kernel).

Users can still select Next2 manually; only the default changes.
…creen, AimesSoft#639)

The fork replaced upstream's isolated EGL context with 'reuse Flutter's
current EGL context to avoid per-frame context switches'. That grabs
whatever context is current on the platform thread at construction, while
mpv_render_context_render later runs on the raster thread with Flutter's
context current. mpv requires create/render on the same context; GL
container objects (FBOs/VAOs) are never shared across contexts, so on
NVIDIA the Libmpv kernel shows a blue screen / no video while audio and
thumbnails work.

Reverts linux/video_output.cc and linux/texture_gl.cc to the upstream
implementation from third_party/media-kit-upstream (headers unchanged;
verified 'H/W rendering with isolated EGL context', video displays).
…ang-bin/fvp#258, AimesSoft#307)

player_texture_populate runs mdk::Player::renderVideo() inside Flutter's
raster GL context with no state isolation from Skia/Impeller. Adds a
GLStateGuard that snapshots the shared state, hands mdk clean defaults and
restores everything afterwards.

NOTE: unproven on the machine used for AimesSoft#639 diagnosis — the dark/bright
symptom there turned out to be the Flutter 3.44 compositor (see PR).
Kept because it is harmless and may matter on other setups (AimesSoft#307,
wang-bin/fvp#258). mdk-sdk download artifacts are gitignored.
…icker)

Flutter 3.44.x's GTK compositor (fl_compositor_opengl.cc) causes a
dark/bright alternating flicker during video playback on Linux that stops
whenever additional UI layers/windows repaint (single-layer
glBlitFramebuffer fast path vs shader+blend composite; frames handed to
GTK's paint context with only glFlush, no fence). The compositor rework
that fixes it landed after the 3.44 branch cut and is not in stable
3.44.8; 3.47.0-0.3.pre is the first beta containing it.

desktop_multi_window is adapted to 3.47's renamed internal windowing API
(preferredSize/preferredConstraints -> size/constraints, 'decorated'
removed) — this is why the branch no longer compiles on 3.44.x.
@MCDFsteve MCDFsteve changed the title [调查报告/Not-for-merge] #639 其实是 4 个独立 bug:Next2 弹幕 GL 崩溃、Flutter 3.44 合成器闪烁、NVIDIA 硬解 EGL 崩溃、media_kit 蓝屏 fix(linux): resolve #639 playback crashes and isolate Flutter 3.47 Jul 31, 2026
@MCDFsteve
MCDFsteve marked this pull request as ready for review July 31, 2026 13:32
@MCDFsteve
MCDFsteve requested a review from a team as a code owner July 31, 2026 13:32

@MCDFsteve MCDFsteve left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

已合入最新 main,并将 Flutter 3.47 与 vendored 依赖隔离到 Linux;主线 3.44.6 和 HarmonyOS 3.35.8 保持独立。依赖解析、静态分析、完整测试及编译级验证均已通过。

@MCDFsteve
MCDFsteve merged commit c1df534 into AimesSoft:main Jul 31, 2026
4 checks passed
@baizhenyu
baizhenyu deleted the fix-639 branch August 6, 2026 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Linux 下播放画面在正常色彩和反色之间频繁闪烁,默认 MDK+VAAPI 会崩溃

2 participants