Skip to content

Commit 848d110

Browse files
committed
chore(rtc): swap function order into which they are called
1 parent 32b09e5 commit 848d110

1 file changed

Lines changed: 24 additions & 26 deletions

File tree

media/rtc/src/sdp/mod.rs

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ impl SdpSession {
568568
}
569569
}
570570

571-
// Try and to find a transport outside of the bundle group by looking a the address attribute
571+
// Try and match a transport using transport specific attributes
572572
if let Some(transport) =
573573
self.find_similar_looking_transport(session_desc, remote_media_desc)
574574
{
@@ -596,9 +596,29 @@ impl SdpSession {
596596
}))
597597
}
598598

599-
/// Some implementations like to replace the entire session description with their own mids but reuse the
600-
/// previously negotiated transport. This means that the transport is now "unused" from our point of view and
601-
/// the peer has created a new BUNDLE group. Following is a futile effort to try and catch that.
599+
fn find_bundled_transport(
600+
&self,
601+
new_state: &[Media],
602+
offer: &SessionDescription,
603+
mid: &BytesStr,
604+
) -> Option<EstablishedTransportId> {
605+
let group = offer
606+
.group
607+
.iter()
608+
.find(|g| g.typ == "BUNDLE" && g.mids.contains(mid))?;
609+
610+
new_state.iter().chain(&self.media).find_map(|media| {
611+
let mid = media.mid.as_ref()?;
612+
613+
group
614+
.mids
615+
.iter()
616+
.any(|v| v == mid.as_str())
617+
.then_some(media.transport_id)
618+
})
619+
}
620+
621+
/// Try and find a transport that matches the incoming SDP media using transport attributes instead of the BUNDLE group
602622
fn find_similar_looking_transport(
603623
&mut self,
604624
session_desc: &SessionDescription,
@@ -637,28 +657,6 @@ impl SdpSession {
637657
.map(|(t, _)| t)
638658
}
639659

640-
fn find_bundled_transport(
641-
&self,
642-
new_state: &[Media],
643-
offer: &SessionDescription,
644-
mid: &BytesStr,
645-
) -> Option<EstablishedTransportId> {
646-
let group = offer
647-
.group
648-
.iter()
649-
.find(|g| g.typ == "BUNDLE" && g.mids.contains(mid))?;
650-
651-
new_state.iter().chain(&self.media).find_map(|media| {
652-
let mid = media.mid.as_ref()?;
653-
654-
group
655-
.mids
656-
.iter()
657-
.any(|v| v == mid.as_str())
658-
.then_some(media.transport_id)
659-
})
660-
}
661-
662660
/// Receive a SDP answer after sending an offer.
663661
pub fn receive_sdp_answer(&mut self, answer: SessionDescription) -> Result<(), SdpError> {
664662
// Backlog of already received RTP/RTCP packets per transport before the setup was complete

0 commit comments

Comments
 (0)