2 Commits

Author SHA1 Message Date
63b21fdfed fix(rtc): volc_rtc.c:430 NULL message 判空, idle 后偶发服务端超时不再 panic
火山 RTC SDK 在 ICE Agent 失败路径下 (如服务端 session idle timeout / NAT 表过期)
会用 message=NULL 调用 _on_global_error 回调, 触发 printf("%s", NULL) → strlen(NULL)
→ LoadProhibited panic → 设备无故重启。

实测复现条件:
  - 设备进入 idle 后 10+ 分钟 (无用户活动)
  - RTC 服务端清理 stale signaling 连接 + NAT 表项过期
  - ICE Agent 收到 keepalive failure → state=FAILED
  - ConnectionService.c 触发 _on_global_error(code, message=NULL)
  - panic at strlen ROM 0x400556d5

注意: 这是低频偶发, 不是每次 idle 必触发。同样 idle 20 分钟有时不触发 (取决于
SDK 内部 ICE state machine 错误路径走向)。修复成本极低 (一行判空), 收益是消除
该偶发崩溃风险。

修改:
  components/common/src/volc_rtc.c:430
    LOGI("global error %d %s\n", code, message);
    →
    LOGI("global error %d %s\n", code, message ? message : "(null)");

修复后行为:
  - 服务端 idle 超时仍会触发 _on_global_error
  - 日志正常打印 "global error <code> (null)" 不再 panic
  - 设备继续保持 idle, 下次按 BOOT 时 SDK 自动重新 join_room
  - 软退出+保留 engine 的快速唤醒优化继续生效 (License 节省策略不变)

依赖 commit aeae073: components/common/ 已纳入 git 跟踪

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 13:55:08 +08:00
aeae073e4f chore(git): 把 components/common/ 纳入 git 跟踪
components/common/ 是项目自己写的代码 (火山 RTC SDK 的 wrapper + HTTP 客户端 + JSON
工具 + 设备管理), 历史上被 .gitignore 的 components/ 规则误排除。共 15 个文件 2750
行项目代码长期未被 git 跟踪, 修改易丢失, 不利于多设备开发和回溯。

主要变动:

1. .gitignore
   - 改 components/ → /components/* (顶层 children 而非目录本身)
   - 加 !/components/common/ 例外, 让项目自己代码进入跟踪
   - 加 esp-spot/**/components/ 显式 ignore 子项目里的 components/ 保持原行为

2. components/common/ 首次入 git (~2750 行)
   - inc/volc_rtc.h, src/volc_rtc.c — 火山 RTC SDK 的封装层
   - inc/volc_http.h, src/volc_http.c — HTTP 客户端
   - inc/util/volc_json.h, src/volc_json.c — JSON 工具
   - inc/base/volc_device_manager.h, src/volc_device_manager.c — RTC 设备凭证管理
   - inc/util/volc_log.h — 日志宏
   - inc/util/volc_list.h — 链表工具
   - inc/volc_conv_ai.h — 会话 AI 接口定义
   - inc/volc_platform.h, src/volc_platform.c — 平台抽象
   - inc/base/volc_base.h — 基础类型

未跟踪的兄弟目录 (保持 ignore):
   - components/78__esp-opus-encoder/ (IDF managed component)
   - components/volc_engine_rtc_lite/ (火山 RTC SDK 二进制库)
   - components/zlib/ (第三方库)

后续 fix(rtc) NULL guard 等 components/common/ 的改动将作为独立 commit。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 13:50:52 +08:00