pub(crate) async fn receive_for_rid(
        &self,
        rid: String,
        params: RTCRtpParameters,
        stream: TrackStream,
    ) -> Result<Arc<TrackRemote>> {
        let mut tracks = self.internal.tracks.lock().await;
        for t in &mut *tracks {
            if t.track.rid() == rid {
                t.track.set_kind(self.kind);
                if let Some(codec) = params.codecs.first() {
                    t.track.set_codec(codec.clone()).await;
                }
                t.track.set_params(params.clone()).await;
                t.track
                    .set_ssrc(stream.stream_info.as_ref().map_or(0, |s| s.ssrc));
                t.stream = stream;
                return Ok(Arc::clone(&t.track));
            }
        }

        Err(Error::ErrRTPReceiverForRIDTrackStreamNotFound)
    }
/// receive_for_rid is the sibling of Receive expect for RIDs instead of SSRCs
/// It populates all the internal state for the given RID
receive_for_rid is the sibling of Receive expect for RIDs instead of SSRCs
It populates all the internal state for the given RID
receive_for_rid is the sibling of Receive expect for RIDs instead of SSRCs It populates all the internal state for the given RID
pub(crate) async fn receive_for_rid(
        &self,
        rid: String,
        params: RTCRtpParameters,
        stream: TrackStream,
    ) -> Result<Arc<TrackRemote>> {
        let mut tracks = self.internal.tracks.lock().await;
        for t in &mut *tracks {
            if t.track.rid() == rid {
                t.track.set_kind(self.kind);
                if let Some(codec) = params.codecs.first() {
                    t.track.set_codec(codec.clone()).await;
                }
                t.track.set_params(params.clone()).await;
                t.track
                    .set_ssrc(stream.stream_info.as_ref().map_or(0, |s| s.ssrc));
                t.stream = stream;
                return Ok(Arc::clone(&t.track));
            }
        }
        Err(Error::ErrRTPReceiverForRIDTrackStreamNotFound)
    }
pub ( crate ) async fn receive_for_rid ( & self , rid : String , params : RTCRtpParameters , stream : TrackStream , ) -> Result < Arc < TrackRemote > > { let mut tracks = self . internal . tracks . lock ( ) . await ; for t in & mut * tracks { if t . track . rid ( ) == rid { t . track . set_kind ( self . kind ) ; if let Some ( codec ) = params . codecs . first ( ) { t . track . set_codec ( codec . clone ( ) ) . await ; } t . track . set_params ( params . clone ( ) ) . await ; t . track . set_ssrc ( stream . stream_info . as_ref ( ) . map_or ( 0 , | s | s . ssrc ) ) ; t . stream = stream ; return Ok ( Arc :: clone ( & t . track ) ) ; } } Err ( Error :: ErrRTPReceiverForRIDTrackStreamNotFound ) }
receive_for_rid is the sibling of Receive expect for RIDs instead of SSRCs
It populates all the internal state for the given RID
receive_for_rid is the sibling of Receive expect for RIDs instead of SSRCs It populates all the internal state for the given RID
&self
rid
String
params
RTCRtpParameters
stream
TrackStream