srs/internal/utils
winlin 9b08a3809a Proxy: Unwrap legacy /rtc/v1/play/ JSON envelope for ICE parsing.
srs_bench and other legacy clients post the SDP offer as
{"sdp":"v=0\r\n...","streamurl":"..."} to /rtc/v1/play/ (and
/rtc/v1/publish/). The proxy was passing that raw body straight into
ParseIceUfragPwd, whose [^\s]+ class did not stop at the literal "\"
characters of the JSON-escaped newlines, so the captured ufrag absorbed
the next attributes. The contaminated ufrag was stored in the LB while
the player's STUN binding carried the clean wire ufrag, so
LoadWebRTCByUfrag missed and playback never started.

Add unwrapSDPEnvelope to extract the sdp field when the body is a JSON
envelope (forwarded bytes and the candidate port rewrite still operate
on the raw envelope so the client sees a valid response), and tighten
ParseIceUfragPwd to stop at backslash as well as whitespace.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 17:52:07 -04:00
..
utils_test.go Proxy: Unwrap legacy /rtc/v1/play/ JSON envelope for ICE parsing. 2026-05-17 17:52:07 -04:00
utils.go Proxy: Unwrap legacy /rtc/v1/play/ JSON envelope for ICE parsing. 2026-05-17 17:52:07 -04:00