Based on PCAP analysis of official Mi Home app traffic, the keepalive
mechanism was incorrect:
Before (broken):
- Sent PING every 5s only when receiving data
- Responded to PING with PONG
After (fixed):
- Send PING every 1 second independently via dedicated goroutine
- Don't respond to PING with PONG (official app doesn't either)
- Both sides send PING bidirectionally as heartbeats
The official app sends 199 PING messages and 0 PONG messages in a
typical session. This fix matches that behavior.
Fixes connection resets after prolonged streaming sessions with
Xiaomi cameras using the CS2 P2P protocol.
go2rtc tries to name formats, protocols and codecs the same way they are named in FFmpeg.
Some formats and protocols go2rtc supports exclusively. They have no equivalent in FFmpeg.
Producers (input)
The initiator of the connection can be go2rtc - Source protocols
The initiator of the connection can be an external program - Ingress protocols
Codecs can be incoming - Recevers codecs
Codecs can be outgoing (two way audio) - Senders codecs