matrix-org / waterfall

A cascading stream forwarding unit for scalable, distributed voice and video conferencing over Matrix
Apache License 2.0
97 stars 5 forks source link

peer: fix crash in the rtcp handling #67

Closed daniel-abramov closed 1 year ago

daniel-abramov commented 1 year ago

It turns out that a receiver may actually have a nil track inside. Not sure when and why but it looks like it happens during the negotiation (maybe when the transceiver exists, but the track does not exist already?).

That's the body of the function:

func (r *RTPReceiver) Track() *TrackRemote {
    r.mu.RLock()
    defer r.mu.RUnlock()

    if len(r.tracks) != 1 { // so this is possible!
        return nil
    }
    return r.tracks[0].track
}