Do not re-use transceiver when negotiation is pending. (#862)

This commit is contained in:
Raja Subramanian
2022-07-31 10:50:55 +05:30
committed by GitHub
parent 997461a2b6
commit a393d64ccc
6 changed files with 143 additions and 5 deletions
+3 -4
View File
@@ -249,7 +249,7 @@ func (t *MediaTrackSubscriptions) AddSubscriber(sub types.LocalParticipant, wr *
// if cannot replace, find an unused transceiver or add new one
if transceiver == nil {
if sub.ProtocolVersion().SupportsTransceiverReuse() {
if sub.ProtocolVersion().SupportsTransceiverReuse() && !sub.IsNegotiationPending(subTrack.PublisherID()) {
//
// AddTrack will create a new transceiver or re-use an unused one
// if the attributes match. This prevents SDP from bloating
@@ -268,9 +268,7 @@ func (t *MediaTrackSubscriptions) AddSubscriber(sub types.LocalParticipant, wr *
}
}
} else {
transceiver, err = sub.SubscriberPC().AddTransceiverFromTrack(downTrack, webrtc.RTPTransceiverInit{
Direction: webrtc.RTPTransceiverDirectionSendonly,
})
transceiver, err = sub.SubscriberPC().AddTransceiverFromTrack(downTrack)
if err != nil {
return err
}
@@ -778,6 +776,7 @@ func (t *MediaTrackSubscriptions) downTrackClosed(
sub.RemoveSubscribedTrack(subTrack)
if !willBeResumed {
sub.AddNegotiationPending(subTrack.PublisherID())
sub.Negotiate(false)
}
}