Repository navigation
fix(player): 恢复全屏切换后的 MKV 视频解码器错误 - #104
Merged
Merged
Conversation
mahoshojoHCG
marked this pull request as ready for review
October 2, 2026 09:42
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题与定位
iPad Safari 的 MKV 前端播放在进入系统全屏后触发原生视频解码错误,立即转到服务端 HLS。真机日志显示:进入全屏约 180 ms 后发生
EncodingError: Decoder failure,当时页面仍可见、AudioContext 仍在运行;之后才发生暂停、退出全屏和播放器销毁。同一文件不进入全屏可以持续播放。已将线上 bundle 的三个堆栈位置映射到
VideoDecoderWrapper→VideoSampleSink._createDecoder()→mediaSamplesInRange()。堆栈来自库在创建 decoder 时保存的 stack,实际错误由原生VideoDecoder.error回调报告。WebKit 将底层解码失败汇总为Decoder failure,JavaScript 侧无法读取具体平台错误码,因此不能进一步断言是某个硬件 session 错误。销毁后的
VideoSampleGC 警告还有明确的清理缺陷:代理内嵌的旧 Mediabunny 没有在 producer 异常退出时可靠关闭 decoder,并且对已经因报错关闭的 native decoder 再次调用close(),会跳过后续帧队列释放。项目单独依赖的 Mediabunny 已有相应修复,但代理播放使用的是包内嵌实现。修改
EncodingError尝试一次 decoder 重建,从当前音频位置对应的关键帧重新解码,保留 Canvas、音频时钟、字幕与全屏元素。参考:WebKit 解码结果回调、WebCodecs 的 decoder 关闭语义、Mediabunny 1.55.3 的 iterator/decoder 清理。
验证
yarn install --immutable:通过。yarn test:unit:34 项通过。yarn typecheck:通过。yarn build:budget:生产构建及包体积检查通过。git diff --check:通过。按本次合并请求转为可审阅;实体 iPad Safari 复测仍未完成。现有验证确认构建和既有行为检查通过,尚未证明发生该原生错误后,一次 decoder 重建在用户设备上必然成功。