From 2ef6dbd0a8b8872632d5fe3374c3f6588cc86e0e Mon Sep 17 00:00:00 2001 From: cnderrauber Date: Mon, 24 May 2021 12:57:48 +0800 Subject: [PATCH] Fix startRtpSenders : panic when RemoveTrack called. --- peerconnection.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/peerconnection.go b/peerconnection.go index da796d36f5b..e88ede54b04 100644 --- a/peerconnection.go +++ b/peerconnection.go @@ -1320,13 +1320,13 @@ func (pc *PeerConnection) startRTPReceivers(incomingTracks []trackDetails, curre // startRTPSenders starts all outbound RTP streams func (pc *PeerConnection) startRTPSenders(currentTransceivers []*RTPTransceiver) error { for _, transceiver := range currentTransceivers { - if transceiver.Sender() != nil && transceiver.Sender().isNegotiated() && !transceiver.Sender().hasSent() { - err := transceiver.Sender().Send(RTPSendParameters{ + if sender := transceiver.Sender(); sender != nil && sender.isNegotiated() && !sender.hasSent() { + err := sender.Send(RTPSendParameters{ Encodings: []RTPEncodingParameters{ { RTPCodingParameters{ - SSRC: transceiver.Sender().ssrc, - PayloadType: transceiver.Sender().payloadType, + SSRC: sender.ssrc, + PayloadType: sender.payloadType, }, }, },