Handle nil when buffer pair doesn't exist

This commit is contained in:
David Zhao committed 2021-11-11 23:16:21 -08:00
1 parent 0a20acdf68
commit 5a057f3d19
1 file changed
+7
+7
View File
@@ -327,6 +327,13 @@ func (t *MediaTrack) AddReceiver(receiver *webrtc.RTPReceiver, track *webrtc.Tra
defer t.lock.Unlock()
buff, rtcpReader := t.params.BufferFactory.GetBufferPair(uint32(track.SSRC()))
if buff == nil || rtcpReader == nil {
logger.Errorw("could not retrieve buffer pair", nil,
"participant", t.params.ParticipantIdentity,
"participantID", t.params.ParticipantID,
"track", t.ID())
return
}
buff.OnFeedback(t.handlePublisherFeedback)
if t.Kind() == livekit.TrackType_AUDIO {