feat(媒体): 同步视频 sidecar 协议与运行时路由 - #21
Draft
Mr-KID-github wants to merge 6 commits into
Draft
Conversation
公开 API:新增 AudioLiveStream 与 robot.audio.open_stream(),固定支持 24kHz、单声道、PCM16;write 按设备信用额度同步背压发送,close 排空后发送空 LAST,abort 立即停止,且上下文退出和重复关闭语义明确。 传输与状态:Daemon Application 通道持续转发 live AUDIO 帧,使用单写入序列、960 字节分块、32 位序号回绕和设备 buffer_status 信用控制;断线、设备失败、替换与取消会唤醒等待者并返回明确异常。 互斥与兼容:喇叭实时流和机器人麦克风安全互斥,保留 play_file、play_pcm 和有限文件协议;旧固件缺少 audio.stream.live.v1 时给出升级提示。 测试:覆盖协议参数、超过 4MB 的不限时流、首尾帧、回绕、背压、并发中止、失败清理、幂等和双向音频切换;301 项 pytest 与 57 个源文件的 mypy 检查全部通过。 配套提交关系:WatcheRobot_esp32 提交 302b5fa(feat(媒体): 支持半双工双向实时音频测试)提供 live 协议、设备缓冲仲裁和常开摄像头测试页。
修复 Daemon 长时间运行后 UDP 预览监听器可能仍占用端口但不再接收数据,导致设备已经切换分辨率、网页却一直保留旧画面的问题。 在预览开始命令转发给设备前重建有界 UDP 接收端点,并通过异步回调保证监听器先就绪;保留原有重组、认证和最新帧发布策略。补充预览代理的执行顺序测试,以及监听器重绑后仍能接收并发布新帧的回归测试。 配套仓库:WatcheRobot_esp32 同分支提交《fix(预览): 让清晰度切换等待真实新帧》。
让 Python SDK Daemon 在预览启动前刷新 UDP 接收通道,并通过有界最新帧投递、反馈确认和断线清理避免旧视频帧在中继队列中长期排队。 该提交与 ESP32 codex/live-half-duplex-audio 提交 b0983eb 配套,媒体测试页面依赖两边同时更新。保留工作区中原有的 routing/raw.py 和 capture_photo/artifacts 未提交内容。
在内嵌 Daemon 运行时同步 sys.media.hello、websocket_sidecar/v1 能力协商、控制会话绑定鉴权和 WSPK 视频专用路由。 控制连接关闭时清理关联 sidecar,视频连接独立失败时保留音频和控制在线;协议 fixture 与服务端保持逐字段一致。 补充 sidecar 鉴权、非法业务帧、独立断线、控制断线级联关闭和兼容性测试。 配套 ESP32 与 Server 分支均为 codex/esp32-media-concurrency。
将实时音频初始四帧断言从单次 asyncio 调度让出改为有界轮询,复用同文件已有的等待模式。 避免 Python 3.10/3.11 在任务启动稍慢时误判零帧,同时仍验证初始信用仅允许四帧、第五帧必须等待设备状态释放。 该修复不修改运行时代码;application transport 与 runtime 相关测试通过。
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.
目标
让 Python SDK 内嵌 Daemon 与生产 Server 对齐视频 sidecar 协议和隔离语义。
实现
验证
配套
ESP32 与 Server 使用同名分支 codex/esp32-media-concurrency。该分支从本地 main 的既有 4 个媒体提交继续开发,保留用户已确认的当前工作基础;examples/capture_photo/artifacts 未提交。