Remove stopped member from RTPTransceiver

It is unused. If needed in the future we can add it back
This commit is contained in:
boks1971
2024-12-14 16:53:10 -08:00
committed by Sean DuBois
parent 2585a2fd03
commit 9eee2cc038
2 changed files with 46 additions and 48 deletions

View File

@@ -371,11 +371,12 @@ func (pc *PeerConnection) checkNegotiationNeeded() bool { //nolint:gocognit
// return true
// }
m := getByMid(t.Mid(), localDesc)
// Step 5.2
if !t.stopped && m == nil {
if m == nil {
return true
}
if !t.stopped && m != nil {
// Step 5.3.1
if t.Direction() == RTPTransceiverDirectionSendrecv || t.Direction() == RTPTransceiverDirectionSendonly {
descMsid, okMsid := m.Attribute(sdp.AttrKeyMsid)
@@ -414,13 +415,13 @@ func (pc *PeerConnection) checkNegotiationNeeded() bool { //nolint:gocognit
}
default:
}
}
// Step 5.4
if t.stopped && t.Mid() != "" {
if getByMid(t.Mid(), localDesc) != nil || getByMid(t.Mid(), remoteDesc) != nil {
return true
}
}
// if t.stopped && t.Mid() != "" {
// if getByMid(t.Mid(), localDesc) != nil || getByMid(t.Mid(), remoteDesc) != nil {
// return true
// }
// }
}
// Step 6
return false
@@ -1872,7 +1873,7 @@ func (pc *PeerConnection) AddTrack(track TrackLocal) (*RTPSender, error) {
// transceiver can be reused only if it's currentDirection never be sendrecv or sendonly.
// But that will cause sdp inflate. So we only check currentDirection's current value,
// that's worked for all browsers.
if !t.stopped && t.kind == track.Kind() && t.Sender() == nil &&
if t.kind == track.Kind() && t.Sender() == nil &&
!(currentDirection == RTPTransceiverDirectionSendrecv || currentDirection == RTPTransceiverDirectionSendonly) {
sender, err := pc.api.NewRTPSender(track, pc.dtlsTransport)
if err == nil {
@@ -2213,10 +2214,8 @@ func (pc *PeerConnection) close(shouldGracefullyClose bool) error {
// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-close (step #4)
pc.mu.Lock()
for _, t := range pc.rtpTransceivers {
if !t.stopped {
closeErrs = append(closeErrs, t.Stop())
}
}
if nonMediaBandwidthProbe, ok := pc.nonMediaBandwidthProbe.Load().(*RTPReceiver); ok {
closeErrs = append(closeErrs, nonMediaBandwidthProbe.Stop())
}

View File

@@ -24,7 +24,6 @@ type RTPTransceiver struct {
codecs []RTPCodecParameters // User provided codecs via SetCodecPreferences
stopped bool
kind RTPCodecType
api *API