Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix check for unchanged transceivers in CreateOffer #1658

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions peerconnection.go
Original file line number Diff line number Diff line change
Expand Up @@ -561,18 +561,16 @@ func (pc *PeerConnection) getStatsID() string {
return pc.statsID
}

func (pc *PeerConnection) hasLocalDescriptionChanged(desc *SessionDescription) bool {
for _, t := range pc.GetTransceivers() {
m := getByMid(t.Mid(), desc)
if m == nil {
return true
}

if getPeerDirection(m) != t.Direction() {
func (pc *PeerConnection) hasLocalDescriptionChanged(old []*RTPTransceiver) bool {
transceivers := pc.GetTransceivers()
if len(transceivers) != len(old) {
return true
}
for i, t := range transceivers {
if t != old[i] {
return true
}
}

return false
}

Expand Down Expand Up @@ -670,7 +668,7 @@ func (pc *PeerConnection) CreateOffer(options *OfferOptions) (SessionDescription

// Verify local media hasn't changed during offer
// generation. Recompute if necessary
if isPlanB || !pc.hasLocalDescriptionChanged(&offer) {
if isPlanB || !pc.hasLocalDescriptionChanged(currentTransceivers) {
break
}
}
Expand Down