Skip to content

Commit 8c69c77

Browse files
authored
janus: fixed compatibility with Tailscale MTU (#325)
1 parent 5331ae1 commit 8c69c77

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

janus/src/rtp.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,13 @@
2727

2828
// Max RTP size for WebRTC is 1200 bytes:
2929
// - https://stackoverflow.com/questions/47635545/why-webrtc-chose-rtp-max-packet-size-to-1200-bytes
30-
// We take this and substract 50 bytes for possible RTP extensions, see sdp.c
31-
#define US_RTP_TOTAL_SIZE (1200 - 50)
30+
// But(!) Tailscale has 1200 MTU. So to fit it required to substract:
31+
// 1. possible RTP extensions (see sdp.c)
32+
// 2. additional SRTP fields (>= 10 bytes)
33+
// 3. UDP header (8 bytes)
34+
// 4. IPv6 header (40 bytes)
35+
// Finally it looks like 100 bytes for all above should be enough
36+
#define US_RTP_TOTAL_SIZE (1200 - 100)
3237
#define US_RTP_HEADER_SIZE 12
3338
#define US_RTP_PAYLOAD_SIZE (US_RTP_TOTAL_SIZE - US_RTP_HEADER_SIZE)
3439

0 commit comments

Comments
 (0)