srs/internal
winlin 26803ac4f4 Claude: RTMP: Use extended timestamp as delta for chunk fmt=1/2 in proxy.
Port the C++ srs_protocol_rtmp_stack.cpp fix (#4356) to the Go proxy's RTMP parser in internal/rtmp.

For chunk fmt=1/2 the extended timestamp encodes a timestamp delta, not an absolute timestamp. The parser previously assigned the extended value to the message timestamp unconditionally, so once a delta reached 0xffffff the DTS was miscomputed, and since audio and video deltas differ this could cause A/V desync.

Changes:
- Split chunkStream's single ext-ts bool into hasExtendedTimestamp (presence) plus a raw extendedTimestamp uint32, mirroring the C++ has_extended_timestamp_ / extended_timestamp_ fields.
- Compute the message timestamp once: extended value when present, else the 3-byte header delta; assign it as absolute for fmt=0 and accumulate it as a delta for fmt=1/2 (and a fmt=3 first chunk).
- Resolve the 'detect the extended timestamp' TODO: peek the 4 bytes and leave them as payload when a librtmp/ffmpeg-style sender omits the ext-ts on a Type-3 chunk (Go equivalent of the C++ skip(-4)).
- Add unit tests for the fmt=1 delta-crossing-0xffffff case and the Type-3 omitted-ext-ts case.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 18:10:51 -04:00
..
bootstrap Proxy: Refactor for testability; add SRT/WHIP E2E and unit tests. v7.0.148 (#4675) 2026-05-17 12:09:07 -04:00
debug Proxy: Fix RTC/SRT reader leak, legacy WHEP unwrap, WHEP perf guide. v8.0.1 (#4676) 2026-05-17 21:13:21 -04:00
env Proxy: Refine logger and environment APIs. v7.0.146 (#4670) 2026-04-28 07:18:45 -04:00
errors Proxy: Modernize internal packages on stdlib and add unit tests. v7.0.145 (#4667) 2026-04-23 07:25:48 -04:00
lb Proxy: Refactor for testability; add SRT/WHIP E2E and unit tests. v7.0.148 (#4675) 2026-05-17 12:09:07 -04:00
logger Proxy: Refine logger and environment APIs. v7.0.146 (#4670) 2026-04-28 07:18:45 -04:00
proxy Proxy: Fix RTC/SRT reader leak, legacy WHEP unwrap, WHEP perf guide. v8.0.1 (#4676) 2026-05-17 21:13:21 -04:00
redisclient Proxy: Refactor for testability; add SRT/WHIP E2E and unit tests. v7.0.148 (#4675) 2026-05-17 12:09:07 -04:00
rtmp Claude: RTMP: Use extended timestamp as delta for chunk fmt=1/2 in proxy. 2026-05-24 18:10:51 -04:00
signal Proxy: Refactor for testability; add SRT/WHIP E2E and unit tests. v7.0.148 (#4675) 2026-05-17 12:09:07 -04:00
sync Proxy: Modernize internal packages on stdlib and add unit tests. v7.0.145 (#4667) 2026-04-23 07:25:48 -04:00
utils Proxy: Fix RTC/SRT reader leak, legacy WHEP unwrap, WHEP perf guide. v8.0.1 (#4676) 2026-05-17 21:13:21 -04:00
version Edge: Fix HTTP-FLV 404 and RTMP late-join missing sequence headers. v8.0.2 (#4678) 2026-05-19 10:53:30 -04:00