Skip to content

Commit

Permalink
sdp: Don't set track detail SSRCs when parsing rids
Browse files Browse the repository at this point in the history
This ends up tracks being "discovered" via SRTP session accept.
  • Loading branch information
haaspors committed Apr 21, 2024
1 parent 7db18eb commit e8d776f
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions webrtc/src/peer_connection/sdp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,26 +211,20 @@ pub(crate) fn track_details_from_sdp(
};
}

// If media line is using RTP Stream Identifier Source Description per RFC8851
// we will need to override tracks, and remove ssrcs.
// This is in particular important for Firefox, as it uses both 'rid', 'simulcast'
// and 'a=ssrc' lines.
let rids = get_rids(media);
if !rids.is_empty() && !track_id.is_empty() && !stream_id.is_empty() {
let mut simulcast_track = TrackDetails {
tracks_in_media_section = vec![TrackDetails {
mid: SmolStr::from(mid_value),
kind: codec_type,
stream_id: stream_id.to_owned(),
id: track_id.to_owned(),
rids: vec![],
rids: rids.iter().map(|r| SmolStr::from(&r.id)).collect(),
..Default::default()
};
for rid in &rids {
simulcast_track.rids.push(SmolStr::from(&rid.id));
}
if simulcast_track.rids.len() == tracks_in_media_section.len() {
for track in &tracks_in_media_section {
simulcast_track.ssrcs.extend(&track.ssrcs)
}
}

tracks_in_media_section = vec![simulcast_track];
}];
}

incoming_tracks.extend(tracks_in_media_section);
Expand Down

0 comments on commit e8d776f

Please sign in to comment.