Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions pkg/webrtc/producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down