pub(crate) async fn receive_for_rtx(
        &self,
        ssrc: SSRC,
        rsid: String,
        repair_stream: TrackStream,
    ) -> Result<()> {
        let mut tracks = self.internal.tracks.lock().await;
        let l = tracks.len();
        for t in &mut *tracks {
            if (ssrc != 0 && l == 1) || t.track.rid() == rsid {
                t.repair_stream = repair_stream;

                let receive_mtu = self.receive_mtu;
                let track = t.clone();
                tokio::spawn(async move {
                    let a = Attributes::new();
                    let mut b = vec![0u8; receive_mtu];
                    while let Some(repair_rtp_interceptor) = &track.repair_stream.rtp_interceptor {
                        //TODO: cancel repair_rtp_interceptor.read gracefully
                        //println!("repair_rtp_interceptor read begin with ssrc={}", ssrc);
                        if repair_rtp_interceptor.read(&mut b, &a).await.is_err() {
                            break;
                        }
                    }
                });

                return Ok(());
            }
        }

        Err(Error::ErrRTPReceiverForRIDTrackStreamNotFound)
    }
/// receiveForRtx starts a routine that processes the repair stream
/// These packets aren't exposed to the user yet, but we need to process them for
/// TWCC
receiveForRtx starts a routine that processes the repair stream
These packets aren't exposed to the user yet, but we need to process them for
TWCC
receiveForRtx starts a routine that processes the repair stream These packets aren ' t exposed to the user yet but we need to process them for TWCC
pub(crate) async fn receive_for_rtx(
        &self,
        ssrc: SSRC,
        rsid: String,
        repair_stream: TrackStream,
    ) -> Result<()> {
        let mut tracks = self.internal.tracks.lock().await;
        let l = tracks.len();
        for t in &mut *tracks {
            if (ssrc != 0 && l == 1) || t.track.rid() == rsid {
                t.repair_stream = repair_stream;
                let receive_mtu = self.receive_mtu;
                let track = t.clone();
                tokio::spawn(async move {
                    let a = Attributes::new();
                    let mut b = vec![0u8; receive_mtu];
                    while let Some(repair_rtp_interceptor) = &track.repair_stream.rtp_interceptor {
                        //TODO: cancel repair_rtp_interceptor.read gracefully
                        //println!("repair_rtp_interceptor read begin with ssrc={}", ssrc);
                        if repair_rtp_interceptor.read(&mut b, &a).await.is_err() {
                            break;
                        }
                    }
                });
                return Ok(());
            }
        }
        Err(Error::ErrRTPReceiverForRIDTrackStreamNotFound)
    }
pub ( crate ) async fn receive_for_rtx ( & self , ssrc : SSRC , rsid : String , repair_stream : TrackStream , ) -> Result < ( ) > { let mut tracks = self . internal . tracks . lock ( ) . await ; let l = tracks . len ( ) ; for t in & mut * tracks { if ( ssrc != 0 && l == 1 ) || t . track . rid ( ) == rsid { t . repair_stream = repair_stream ; let receive_mtu = self . receive_mtu ; let track = t . clone ( ) ; tokio :: spawn ( async move { let a = Attributes :: new ( ) ; let mut b = vec ! [ 0u8 receive_mtu ] ; while let Some ( repair_rtp_interceptor ) = & track . repair_stream . rtp_interceptor { //TODO: cancel repair_rtp_interceptor.read gracefully //println!("repair_rtp_interceptor read begin with ssrc={}", ssrc); if repair_rtp_interceptor . read ( & mut b , & a ) . await . is_err ( ) { break ; } } } ) ; return Ok ( ( ) ) ; } } Err ( Error :: ErrRTPReceiverForRIDTrackStreamNotFound ) }
receiveForRtx starts a routine that processes the repair stream
These packets aren't exposed to the user yet, but we need to process them for
TWCC
receiveForRtx starts a routine that processes the repair stream These packets aren ' t exposed to the user yet but we need to process them for TWCC
&self
ssrc
SSRC
rsid
String
repair_stream
TrackStream