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 // return true
// } // }
m := getByMid(t.Mid(), localDesc) m := getByMid(t.Mid(), localDesc)
// Step 5.2 // Step 5.2
if !t.stopped && m == nil { if m == nil {
return true return true
} }
if !t.stopped && m != nil {
// Step 5.3.1 // Step 5.3.1
if t.Direction() == RTPTransceiverDirectionSendrecv || t.Direction() == RTPTransceiverDirectionSendonly { if t.Direction() == RTPTransceiverDirectionSendrecv || t.Direction() == RTPTransceiverDirectionSendonly {
descMsid, okMsid := m.Attribute(sdp.AttrKeyMsid) descMsid, okMsid := m.Attribute(sdp.AttrKeyMsid)
@@ -414,13 +415,13 @@ func (pc *PeerConnection) checkNegotiationNeeded() bool { //nolint:gocognit
} }
default: default:
} }
}
// Step 5.4 // Step 5.4
if t.stopped && t.Mid() != "" { // if t.stopped && t.Mid() != "" {
if getByMid(t.Mid(), localDesc) != nil || getByMid(t.Mid(), remoteDesc) != nil { // if getByMid(t.Mid(), localDesc) != nil || getByMid(t.Mid(), remoteDesc) != nil {
return true // return true
} // }
} // }
} }
// Step 6 // Step 6
return false 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. // 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, // But that will cause sdp inflate. So we only check currentDirection's current value,
// that's worked for all browsers. // 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) { !(currentDirection == RTPTransceiverDirectionSendrecv || currentDirection == RTPTransceiverDirectionSendonly) {
sender, err := pc.api.NewRTPSender(track, pc.dtlsTransport) sender, err := pc.api.NewRTPSender(track, pc.dtlsTransport)
if err == nil { 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) // https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-close (step #4)
pc.mu.Lock() pc.mu.Lock()
for _, t := range pc.rtpTransceivers { for _, t := range pc.rtpTransceivers {
if !t.stopped {
closeErrs = append(closeErrs, t.Stop()) closeErrs = append(closeErrs, t.Stop())
} }
}
if nonMediaBandwidthProbe, ok := pc.nonMediaBandwidthProbe.Load().(*RTPReceiver); ok { if nonMediaBandwidthProbe, ok := pc.nonMediaBandwidthProbe.Load().(*RTPReceiver); ok {
closeErrs = append(closeErrs, nonMediaBandwidthProbe.Stop()) closeErrs = append(closeErrs, nonMediaBandwidthProbe.Stop())
} }

View File

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