Skip to content

Commit

Permalink
Merge c47c1e1 into cddf631
Browse files Browse the repository at this point in the history
  • Loading branch information
Juliusz Chroboczek authored Feb 2, 2021
2 parents cddf631 + c47c1e1 commit 44a5a20
Showing 1 changed file with 8 additions and 10 deletions.
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

0 comments on commit 44a5a20

Please sign in to comment.