File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -105,16 +105,17 @@ func (p *Peer[ID]) SubscribeTo(track *webrtc.TrackLocalStaticRTP) error {
105105// Unsubscribes from the given list of tracks.
106106func (p * Peer [ID ]) UnsubscribeFrom (tracks []* webrtc.TrackLocalStaticRTP ) {
107107 // That's unfortunately an O(m*n) operation, but we don't expect the number of tracks to be big.
108- for _ , presentTrack := range p .peerConnection .GetSenders () {
109- if presentTrack .Track () == nil {
110- continue
108+ for _ , sender := range p .peerConnection .GetSenders () {
109+ currentTrack := sender .Track ()
110+ if currentTrack == nil {
111+ return
111112 }
112113
113114 for _ , trackToUnsubscribe := range tracks {
114- presentTrackID , presentStreamID := presentTrack . Track (). ID (), presentTrack . Track () .StreamID ()
115+ presentTrackID , presentStreamID := currentTrack . ID (), currentTrack .StreamID ()
115116 trackID , streamID := trackToUnsubscribe .ID (), trackToUnsubscribe .StreamID ()
116117 if presentTrackID == trackID && presentStreamID == streamID {
117- if err := p .peerConnection .RemoveTrack (presentTrack ); err != nil {
118+ if err := p .peerConnection .RemoveTrack (sender ); err != nil {
118119 p .logger .WithError (err ).Error ("failed to remove track" )
119120 }
120121 }
Original file line number Diff line number Diff line change @@ -102,7 +102,6 @@ func (r *Router) handleMatrixEvent(evt *event.Event) {
102102 "type" : evt .Type .Type ,
103103 "user_id" : userID ,
104104 "conf_id" : conferenceID ,
105- "call_id" : callID ,
106105 "device_id" : deviceID ,
107106 })
108107
You can’t perform that action at this time.
0 commit comments