Repository navigation
feat(audio): add negotiated and authenticated live MAT transport - #40
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved timeout handling and build compatibility issues can disconnect healthy streams, leave finite sessions stalled, or break supported builds.
4 open issues
What changed in this PR
Adds negotiated, authenticated live MAT audio transport to the shared library, keeping file handling and offline input in host diagnostic tools.
Changes:
- Adds live MAT negotiation, authenticated packets, cycle reassembly, and cycle/EOS callbacks.
- Restricts normal MAT preference to live MAT or Opus while retaining explicit finite profiles.
- Adds transport, parser, and AudioStream regression tests and documents the integration boundary.
| File | Description |
|---|---|
| tests/RtspParserMatTest.c | Tests duplicate headers and existing parser behavior. |
| tests/MatPlaybackSelectionTest.c | Tests finite-profile selection and fallback. |
| tests/MatLiveTest.c | Tests authentication, sequencing, integrity, and callbacks. |
| tests/MatLiveRtpTest.c | Exercises live MAT through RTP and AudioStream. |
| tests/AudioCodecSelectionTest.c | Tests negotiated startup and finite callbacks. |
| src/SdpGenerator.c | Emits MAT negotiation attributes and transport timing. |
| src/RtspParser.c | Preserves duplicate-header evidence. |
| src/RtspConnection.c | Validates MAT capabilities and confirmations. |
| src/Rtsp.h | Defines the duplicate-header flag. |
| src/MatWire.h | Defines MAT packet layout and helpers. |
| src/MatReceiver.h | Declares cycle and completion interfaces. |
| src/MatReceiver.c | Connects reassembly to consumer callbacks. |
| src/MatProfile.h | Centralizes carrier constants and SDP parsing. |
| src/MatPlaybackProfile.h | Defines finite playback negotiation. |
| src/MatPlayback.h | Declares the finite playback receiver. |
| src/MatPlayback.c | Validates finite stream SHA/count and delivers callbacks. |
| src/MatLiveProfile.h | Defines live-profile parsing and confirmation. |
| src/MatLivePlayback.h | Declares the authenticated live receiver. |
| src/MatLivePlayback.c | Authenticates packets and enforces sequence continuity. |
| src/MatLiveCrypto.h | Implements key derivation and authenticated encryption. |
| src/MatDumpProfile.h | Defines finite diagnostic profile validation. |
| src/MatDepacketizer.h | Declares bounded cycle reassembly state. |
| src/MatDepacketizer.c | Validates fragments, cycles, and stream completion. |
| src/Limelight.h | Exposes MAT codecs and consumer callbacks. |
| src/Limelight-internal.h | Exposes internal MAT profile state. |
| src/Connection.c | Initializes profiles and selects requested MAT modes. |
| src/AudioStream.c | Integrates MAT reception, lifecycle, and failure handling. |
| docs/MAT-HANDOFF.md | Documents ownership boundaries and validation limits. |
| CMakeLists.txt | Registers MAT regression test targets. |
Review effort: Balanced


改了啥呀
把有限回放这只杂鱼从生产路径请出去,共享层收敛为最小实时 MAT 协议、认证和接收回调。
mat-live-v1:严格 DESCRIBE/ANNOUNCE/ACK、HKDF-SHA256、AES-128-GCM、64 位包计数、完整周期重组和 cycle/EOS 回调。验证
当前 head
62c0bcff392f9d78c443a1448083a7ab2ce92a73,base mic。build/mat-minimal-live-v1/proof.json通过:22 个实际 RTSP 客户端协商场景、独立 Python HKDF/GCM oracle、两组 1300 周期 UDP/FEC、391 个刻意丢包恢复,以及源契约/租约/管道/管理入口回归。边界
实时 profile/密文格式不变;这些未发布 API 的删除要求消费者重建。Android 应用及其 shared 指针不升级,客户端继续 mock;不将历史原生短测算作当前重构验收。没有设备 MAT/Atmos 播放结论。PR 已 squash 合入
mic,落点24f23691a1c303e49cab9334414d35e023ba7f97,代码树与上述已验证 head 完全一致;CodeRabbit 对 mic base 禁用审查,跳过不算通过。