Skip to content

Commit

Permalink
Fix SDP attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
lookback-hugotunius authored and rainliu committed Dec 15, 2021
1 parent fc7e1ef commit c2ec154
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repository = "https://github.com/webrtc-rs/webrtc"

[dependencies]
util = { package = "webrtc-util", version = "0.5.2" }
sdp = "0.4.0"
sdp = "0.5.0"
mdns = { package = "webrtc-mdns", version = "0.4.1" }
stun = "0.4.1"
turn = "0.5.2"
Expand Down
5 changes: 2 additions & 3 deletions src/peer_connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,11 +434,10 @@ impl RTCPeerConnection {
|| t.direction() == RTCRtpTransceiverDirection::Sendonly
{
if let (Some(desc_msid), Some(sender)) =
(m.attribute(ATTR_KEY_MSID), t.sender().await)
(m.attribute(ATTR_KEY_MSID).and_then(|o| o), t.sender().await)
{
if let Some(track) = &sender.track().await {
if desc_msid.as_str()
!= track.stream_id().to_owned() + " " + track.id()
if desc_msid != track.stream_id().to_owned() + " " + track.id()
{
return true;
}
Expand Down
14 changes: 7 additions & 7 deletions src/peer_connection/sdp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -706,8 +706,8 @@ pub(crate) fn extract_fingerprint(desc: &SessionDescription) -> Result<(String,
}

for m in &desc.media_descriptions {
if let Some(fingerprint) = m.attribute("fingerprint") {
fingerprints.push(fingerprint.clone());
if let Some(fingerprint) = m.attribute("fingerprint").and_then(|o| o) {
fingerprints.push(fingerprint.to_owned());
}
}

Expand Down Expand Up @@ -744,11 +744,11 @@ pub(crate) async fn extract_ice_details(
}

for m in &desc.media_descriptions {
if let Some(ufrag) = m.attribute("ice-ufrag") {
remote_ufrags.push(ufrag.clone());
if let Some(ufrag) = m.attribute("ice-ufrag").and_then(|o| o) {
remote_ufrags.push(ufrag.to_owned());
}
if let Some(pwd) = m.attribute("ice-pwd") {
remote_pwds.push(pwd.clone());
if let Some(pwd) = m.attribute("ice-pwd").and_then(|o| o) {
remote_pwds.push(pwd.to_owned());
}

for a in &m.attributes {
Expand Down Expand Up @@ -800,7 +800,7 @@ pub(crate) fn get_by_mid<'a, 'b>(
) -> Option<&'b MediaDescription> {
if let Some(parsed) = &desc.parsed {
for m in &parsed.media_descriptions {
if let Some(mid) = m.attribute(ATTR_KEY_MID) {
if let Some(mid) = m.attribute(ATTR_KEY_MID).and_then(|o| o) {
if mid == search_mid {
return Some(m);
}
Expand Down

0 comments on commit c2ec154

Please sign in to comment.