Skip to content

feat: configurable JPEG/WebP streaming with bounded buffering - #29

Merged
fython merged 3 commits into
mainfrom
codex/image-stream-pipeline
Oct 21, 2026
Merged

fython merged 3 commits into
mainfrom
codex/image-stream-pipeline

Conversation

@fython

@fython fython commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

图片串流固定 JPEG 和质量参数、并逐帧等待浏览器 ACK,限制了用户对画质、CPU 与带宽的取舍。本改动增加可配置的 JPEG / WebP 图片串流与有界流水线,保留旧协议兼容路径。

  • 在「设置 → 画面与串流」选择 JPEG / WebP,并输入 1–100 的图片质量,默认 WebP、75。设置持久化,保存后用于后续图片,无需重连手机或浏览器;静态画面也会重新编码。它同时适用于图片兼容模式与 WebRTC 回退,不改变 H.264 / HEVC 视频质量。

  • 用户选择 JPEG 优先于浏览器的 WebP 声明;选择 WebP 时仍需真实解码探测。编码或解码失败回退 JPEG,并保留用户质量值;一次编码使用同一份不可变设置,诊断数据报告实际格式和质量。

  • 使用 media=2&images=3 协商携带格式的 v3 图片包。旧服务端继续返回 v2 JPEG,旧客户端继续使用 JPEG 和单帧 ACK。

  • 最多两帧在途、三个 img 缓冲位。较新帧先完成时淘汰旧任务,逐帧 ACK 校验 sessionId / videoEpoch / sequence;重复、迟到或无编号 ACK 不能释放错误槽位。

  • 在途 payload 预算为 2 MiB(单张超预算帧可独占);ACK 等待达到 250 ms 时收缩为单帧窗口。只保留最新待发源帧,在 RTC 接管或重连时取消待解码工作。

  • 增加 window.wheelplayStats.image 诊断,更新英、简中、繁中文案和 docs/IMAGE_STREAM.md。

  • HTTPS 设置 UI 测试等待后台保存后的实际界面刷新,避免只等待偏好落盘导致的可见性断言竞态;CI 失败时保留单元测试 XML 和 HTML 报告。

验证:

  • 网页单测:117 项通过。
  • Android 全量单测:shared 426 项、common 324 项通过。包含真实 Compose 设置操作、保存 / 取消 / 输入校验、持久化恢复、用户格式优先级、回退时的质量参数,以及真实 WebSocket 协商、旧客户端缓存隔离、精确 ACK、窗口与字节预算。
  • 真实 Chromium / WebSocket:WebP 探测、损坏 WebP 回退 JPEG、双图片 ACK、缩放补偿下的 WebP 触控、无遮罩误闪、同尺寸重建、旋转与重连通过。
  • Debug APK 构建、lint 和设备测试编译通过;APK 内网页资源与源码一致。

设备测试覆盖真实 EGL 静态画面的格式 / 质量切换,但尚未在设备上执行,iPhone / 车机性能仍需硬件验证。源发布上限仍约 15 fps;WebP 编码成本与带宽收益依设备和画面而异,本 PR 不承诺实测性能提升百分比。

@fython
fython force-pushed the codex/image-stream-pipeline branch from 41c3bd2 to 6169624 Compare October 21, 2026 03:29
@fython fython changed the title feat: negotiate WebP and pipeline still-image streaming feat: configurable JPEG/WebP streaming with bounded buffering Oct 21, 2026
@fython
fython merged commit 03a5934 into main Oct 21, 2026
6 checks passed
@fython
fython deleted the codex/image-stream-pipeline branch October 21, 2026 06:48
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.

2 participants