Skip to content

Commit

Permalink
fix(pc): set track on new transceiver
Browse files Browse the repository at this point in the history
  • Loading branch information
tarrencev committed Oct 23, 2020
1 parent be1723b commit b97c9b4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions peerconnection.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ func (pc *PeerConnection) checkNegotiationNeeded() bool { //nolint:gocognit
// Step 5.3.1
if t.Direction() == RTPTransceiverDirectionSendrecv || t.Direction() == RTPTransceiverDirectionSendonly {
descMsid, okMsid := m.Attribute(sdp.AttrKeyMsid)
if !okMsid || (t.Sender() != nil && descMsid != t.Sender().Track().Msid()) {
if !okMsid || descMsid != t.Sender().Track().Msid() {
return true
}
}
Expand Down Expand Up @@ -1006,6 +1006,8 @@ func (pc *PeerConnection) SetRemoteDescription(desc SessionDescription) error {
return err
}
t = pc.newRTPTransceiver(receiver, nil, RTPTransceiverDirectionRecvonly, kind)

pc.onNegotiationNeeded()
}
if t.Mid() == "" {
if err := t.setMid(midValue); err != nil {
Expand Down Expand Up @@ -1616,7 +1618,9 @@ func (pc *PeerConnection) AddTransceiverFromTrack(track *Track, init ...RtpTrans
RTPTransceiverDirectionSendrecv,
track.Kind(),
)

pc.onNegotiationNeeded()

return t, nil

case RTPTransceiverDirectionSendonly:
Expand All @@ -1631,7 +1635,9 @@ func (pc *PeerConnection) AddTransceiverFromTrack(track *Track, init ...RtpTrans
RTPTransceiverDirectionSendonly,
track.Kind(),
)

pc.onNegotiationNeeded()

return t, nil
default:
return nil, errPeerConnAddTransceiverFromTrackOneTransceiver
Expand Down Expand Up @@ -1828,8 +1834,6 @@ func (pc *PeerConnection) newRTPTransceiver(
pc.rtpTransceivers = append(pc.rtpTransceivers, t)
pc.mu.Unlock()

pc.onNegotiationNeeded()

return t
}

Expand Down

0 comments on commit b97c9b4

Please sign in to comment.