Skip to content

feat: 增加可配置 AirPlay buffer / 低延迟模式 #11

@ByteColtX

Description

@ByteColtX

背景

当前 RAOP 发送链路固定使用 250ms startup latency,并在 SDP 中输出对应的 a=min-latency。这比较稳,但实时系统音频串流可以提供更低延迟的实验选项。

目标

新增可配置 buffer / latency 设置,让用户在稳定性和低延迟之间选择。

建议模式:

  • safe: 250ms,默认行为
  • normal: 150ms
  • low: 100ms
  • realtime: 极低延迟实验模式
  • custom: 用户指定 buffer ms,允许 0ms 作为实验值

非目标

  • 不承诺端到端 0ms 延迟
  • 不改变默认稳定行为
  • 不在本 issue 中调整 codec

实现任务

  • 新增 latency/buffer profile 模型
  • 将固定 startup latency 改为 session 配置
  • 按配置输出 SDP a=min-latency
  • 按配置计算 RTP 初始 timestamp offset
  • CLI 增加参数,例如 --latency safe|normal|low|realtime--buffer-ms <ms>
  • 日志输出 requested buffer ms/frames
  • 增加 profile 换算、SDP、timestamp offset 测试
  • 保留 safe 作为默认值

验收标准

  • 默认行为仍等价于当前 250ms
  • 用户可以选择预设 latency 模式
  • 用户可以指定 custom buffer,包括 0ms
  • SDP 和 RTP timestamp offset 与请求 buffer 一致
  • 极低 buffer 不兼容时,用户可以回退到 safe

风险

  • 极低 buffer 可能被 receiver 忽略或导致断续
  • 不同 receiver 对 a=min-latency 的兼容性不同
  • 多设备播放下低 buffer 更容易暴露同步问题

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions