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
}
It turns out that a
receiver
may actually have anil
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: