srs/internal/rtmp
winlin abfb0cd8ae Claude: RTMP: Fix 3-byte chunk basic header decode in proxy.
readBasicHeader overwrote cid with the 2-byte form (64 + byte2) before testing
whether the 3-byte form was in use, so the `cid == 1` check could never be true
and the 3-byte branch was dead code. Chunk basic headers with marker == 1 (chunk
stream IDs 320-65599) consumed only one of the two trailing bytes, leaving the
high-order byte in the stream and desyncing the chunk parser.

Keep the original marker before cid is overwritten and branch on it, matching the
C++ reference (srs_protocol_rtmp_stack.cpp, read_basic_header). The arithmetic
inside the branch was already correct.

Also correct the unit test, which had encoded the buggy result (expected cid=65
instead of 577, leaving a byte unread); it now guards the 3-byte path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 20:22:34 -04:00
..
rtmpfakes Proxy: Refactor server APIs and expand RTMP test coverage. v7.0.147 (#4672) 2026-05-02 09:36:55 -04:00
amf0_test.go Proxy: Refactor for testability; add SRT/WHIP E2E and unit tests. v7.0.148 (#4675) 2026-05-17 12:09:07 -04:00
amf0.go Proxy: Refactor for testability; add SRT/WHIP E2E and unit tests. v7.0.148 (#4675) 2026-05-17 12:09:07 -04:00
example_test.go Proxy: Refactor server APIs and expand RTMP test coverage. v7.0.147 (#4672) 2026-05-02 09:36:55 -04:00
gen.go Proxy: Refactor server APIs and expand RTMP test coverage. v7.0.147 (#4672) 2026-05-02 09:36:55 -04:00
rtmp_test.go Claude: RTMP: Fix 3-byte chunk basic header decode in proxy. 2026-05-24 20:22:34 -04:00
rtmp.go Claude: RTMP: Fix 3-byte chunk basic header decode in proxy. 2026-05-24 20:22:34 -04:00