# 检测到RTP SSRC冲突：终止流

- **ID:** `communication/rtp-ssrc-collision-detected`
- **领域:** communication
- **类别:** protocol_error
- **验证级别:** ai_generated
- **修复率:** 76%

## 根因

同一RTP会话中的两个或多个参与者使用了相同的同步源（SSRC）标识符，导致RTP堆栈终止其中一个流以解决冲突，如RFC 3550第8.1节所述。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| FFmpeg 6.1 | active | — | — |
| GStreamer 1.22.0 | active | — | — |
| WebRTC (libwebrtc M120) | active | — | — |
| Janus 1.2.0 | active | — | — |
| MediaSoup 3.10.0 | active | — | — |

## 解决方案

1. ```
   Ensure each RTP participant generates a random SSRC using a cryptographically secure random number generator: in C with GStreamer, set 'gst_rtp_buffer_set_ssrc(buffer, g_random_int())'.
   ```
2. ```
   Use RTCP to detect and resolve collisions automatically: enable RTCP support in both sender and receiver, and implement the collision resolution logic from RFC 3550 section 8.2 (send BYE and re-randomize SSRC).
   ```

## 无效尝试

- **Manually assign a fixed SSRC value in the RTP sender configuration** — Static SSRC assignment guarantees collisions if multiple senders use the same value; RFC requires SSRC to be randomly chosen to minimize collision probability. (95% 失败率)
- **Disable SSRC collision detection in the RTP stack** — Disabling collision detection violates RFC 3550 and can cause undetected stream corruption, packet loss, and audio/video desynchronization. (90% 失败率)
- **Increase the RTP buffer size to absorb the collision** — Buffer size does not affect SSRC collisions; it only affects jitter handling and packet reordering. (85% 失败率)
