diff --git a/Cargo.toml b/Cargo.toml index c0b86b4ff..a878ffc45 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/src/peer_connection/mod.rs b/src/peer_connection/mod.rs index 499a833db..97487e61c 100644 --- a/src/peer_connection/mod.rs +++ b/src/peer_connection/mod.rs @@ -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; } diff --git a/src/peer_connection/sdp/mod.rs b/src/peer_connection/sdp/mod.rs index 3b5db09c2..34ccfebca 100644 --- a/src/peer_connection/sdp/mod.rs +++ b/src/peer_connection/sdp/mod.rs @@ -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()); } } @@ -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 { @@ -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); }