pub async fn remove_track(&self, sender: &Arc<RTCRtpSender>) -> Result<()> {
        if self.internal.is_closed.load(Ordering::SeqCst) {
            return Err(Error::ErrConnectionClosed);
        }

        let mut transceiver = None;
        {
            let rtp_transceivers = self.internal.rtp_transceivers.lock().await;
            for t in &*rtp_transceivers {
                if let Some(s) = t.sender().await {
                    if s.id == sender.id {
                        transceiver = Some(t.clone());
                        break;
                    }
                }
            }
        }

        if let Some(t) = transceiver {
            if sender.stop().await.is_ok() && t.set_sending_track(None).await.is_ok() {
                RTCPeerConnection::do_negotiation_needed(NegotiationNeededParams {
                    on_negotiation_needed_handler: Arc::clone(
                        &self.internal.on_negotiation_needed_handler,
                    ),
                    is_closed: Arc::clone(&self.internal.is_closed),
                    ops: Arc::clone(&self.internal.ops),
                    negotiation_needed_state: Arc::clone(&self.internal.negotiation_needed_state),
                    is_negotiation_needed: Arc::clone(&self.internal.is_negotiation_needed),
                    signaling_state: Arc::clone(&self.internal.signaling_state),
                    check_negotiation_needed_params: CheckNegotiationNeededParams {
                        sctp_transport: Arc::clone(&self.internal.sctp_transport),
                        rtp_transceivers: Arc::clone(&self.internal.rtp_transceivers),
                        current_local_description: self.internal.current_local_description.clone(),
                        current_remote_description: self
                            .internal
                            .current_remote_description
                            .clone(),
                    },
                })
                .await;
            }
            Ok(())
        } else {
            Err(Error::ErrSenderNotCreatedByConnection)
        }
    }
/// remove_track removes a Track from the PeerConnection
remove_track removes a Track from the PeerConnection
remove_track removes a Track from the PeerConnection
pub async fn remove_track(&self, sender: &Arc<RTCRtpSender>) -> Result<()> {
        if self.internal.is_closed.load(Ordering::SeqCst) {
            return Err(Error::ErrConnectionClosed);
        }
        let mut transceiver = None;
        {
            let rtp_transceivers = self.internal.rtp_transceivers.lock().await;
            for t in &*rtp_transceivers {
                if let Some(s) = t.sender().await {
                    if s.id == sender.id {
                        transceiver = Some(t.clone());
                        break;
                    }
                }
            }
        }
        if let Some(t) = transceiver {
            if sender.stop().await.is_ok() && t.set_sending_track(None).await.is_ok() {
                RTCPeerConnection::do_negotiation_needed(NegotiationNeededParams {
                    on_negotiation_needed_handler: Arc::clone(
                        &self.internal.on_negotiation_needed_handler,
                    ),
                    is_closed: Arc::clone(&self.internal.is_closed),
                    ops: Arc::clone(&self.internal.ops),
                    negotiation_needed_state: Arc::clone(&self.internal.negotiation_needed_state),
                    is_negotiation_needed: Arc::clone(&self.internal.is_negotiation_needed),
                    signaling_state: Arc::clone(&self.internal.signaling_state),
                    check_negotiation_needed_params: CheckNegotiationNeededParams {
                        sctp_transport: Arc::clone(&self.internal.sctp_transport),
                        rtp_transceivers: Arc::clone(&self.internal.rtp_transceivers),
                        current_local_description: self.internal.current_local_description.clone(),
                        current_remote_description: self
                            .internal
                            .current_remote_description
                            .clone(),
                    },
                })
                .await;
            }
            Ok(())
        } else {
            Err(Error::ErrSenderNotCreatedByConnection)
        }
    }
pub async fn remove_track ( & self , sender : & Arc < RTCRtpSender > ) -> Result < ( ) > { if self . internal . is_closed . load ( Ordering :: SeqCst ) { return Err ( Error :: ErrConnectionClosed ) ; } let mut transceiver = None ; { let rtp_transceivers = self . internal . rtp_transceivers . lock ( ) . await ; for t in & * rtp_transceivers { if let Some ( s ) = t . sender ( ) . await { if s . id == sender . id { transceiver = Some ( t . clone ( ) ) ; break ; } } } } if let Some ( t ) = transceiver { if sender . stop ( ) . await . is_ok ( ) && t . set_sending_track ( None ) . await . is_ok ( ) { RTCPeerConnection :: do_negotiation_needed ( NegotiationNeededParams { on_negotiation_needed_handler : Arc :: clone ( & self . internal . on_negotiation_needed_handler , ) , is_closed : Arc :: clone ( & self . internal . is_closed ) , ops : Arc :: clone ( & self . internal . ops ) , negotiation_needed_state : Arc :: clone ( & self . internal . negotiation_needed_state ) , is_negotiation_needed : Arc :: clone ( & self . internal . is_negotiation_needed ) , signaling_state : Arc :: clone ( & self . internal . signaling_state ) , check_negotiation_needed_params : CheckNegotiationNeededParams { sctp_transport : Arc :: clone ( & self . internal . sctp_transport ) , rtp_transceivers : Arc :: clone ( & self . internal . rtp_transceivers ) , current_local_description : self . internal . current_local_description . clone ( ) , current_remote_description : self . internal . current_remote_description . clone ( ) , } , } ) . await ; } Ok ( ( ) ) } else { Err ( Error :: ErrSenderNotCreatedByConnection ) } }
remove_track removes a Track from the PeerConnection
remove_track removes a Track from the PeerConnection
&self
sender
&Arc<RTCRtpSender>