diff --git a/pkg/webrtc/producer.go b/pkg/webrtc/producer.go index 32e958ee5..c6111b3f3 100644 --- a/pkg/webrtc/producer.go +++ b/pkg/webrtc/producer.go @@ -34,6 +34,22 @@ func (c *Conn) GetTrack(media *core.Media, codec *core.Codec) (*core.Receiver, e // Passive producers: OBS Studio via WHIP or Browser // Active producers: go2rtc as WebRTC client or WebTorrent + // Some remote peers (observed with Nest/SDM WebRTC) start sending + // media on a different payload type than the one originally wired + // to consumers (e.g. switch from PT 96 to PT 98 mid-session for the + // same video media, without a renegotiation). Since each payload + // type is a distinct *Codec pointer, the exact-codec lookup above + // misses and a brand-new, unwired Receiver would otherwise be + // created for it, silently starving every already-connected + // consumer. Reuse the existing Receiver for this Media instead, so + // already-wired Senders keep receiving packets regardless of which + // declared payload type the remote actually transmits on. + for _, track := range c.Receivers { + if track.Media == media { + return track, nil + } + } + default: panic(core.Caller()) }