Skip to content

Commit c2ec154

Browse files
lookback-hugotuniusrainliu
authored andcommitted
Fix SDP attributes
1 parent fc7e1ef commit c2ec154

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ repository = "https://github.com/webrtc-rs/webrtc"
1313

1414
[dependencies]
1515
util = { package = "webrtc-util", version = "0.5.2" }
16-
sdp = "0.4.0"
16+
sdp = "0.5.0"
1717
mdns = { package = "webrtc-mdns", version = "0.4.1" }
1818
stun = "0.4.1"
1919
turn = "0.5.2"

src/peer_connection/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,11 +434,10 @@ impl RTCPeerConnection {
434434
|| t.direction() == RTCRtpTransceiverDirection::Sendonly
435435
{
436436
if let (Some(desc_msid), Some(sender)) =
437-
(m.attribute(ATTR_KEY_MSID), t.sender().await)
437+
(m.attribute(ATTR_KEY_MSID).and_then(|o| o), t.sender().await)
438438
{
439439
if let Some(track) = &sender.track().await {
440-
if desc_msid.as_str()
441-
!= track.stream_id().to_owned() + " " + track.id()
440+
if desc_msid != track.stream_id().to_owned() + " " + track.id()
442441
{
443442
return true;
444443
}

src/peer_connection/sdp/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -706,8 +706,8 @@ pub(crate) fn extract_fingerprint(desc: &SessionDescription) -> Result<(String,
706706
}
707707

708708
for m in &desc.media_descriptions {
709-
if let Some(fingerprint) = m.attribute("fingerprint") {
710-
fingerprints.push(fingerprint.clone());
709+
if let Some(fingerprint) = m.attribute("fingerprint").and_then(|o| o) {
710+
fingerprints.push(fingerprint.to_owned());
711711
}
712712
}
713713

@@ -744,11 +744,11 @@ pub(crate) async fn extract_ice_details(
744744
}
745745

746746
for m in &desc.media_descriptions {
747-
if let Some(ufrag) = m.attribute("ice-ufrag") {
748-
remote_ufrags.push(ufrag.clone());
747+
if let Some(ufrag) = m.attribute("ice-ufrag").and_then(|o| o) {
748+
remote_ufrags.push(ufrag.to_owned());
749749
}
750-
if let Some(pwd) = m.attribute("ice-pwd") {
751-
remote_pwds.push(pwd.clone());
750+
if let Some(pwd) = m.attribute("ice-pwd").and_then(|o| o) {
751+
remote_pwds.push(pwd.to_owned());
752752
}
753753

754754
for a in &m.attributes {
@@ -800,7 +800,7 @@ pub(crate) fn get_by_mid<'a, 'b>(
800800
) -> Option<&'b MediaDescription> {
801801
if let Some(parsed) = &desc.parsed {
802802
for m in &parsed.media_descriptions {
803-
if let Some(mid) = m.attribute(ATTR_KEY_MID) {
803+
if let Some(mid) = m.attribute(ATTR_KEY_MID).and_then(|o| o) {
804804
if mid == search_mid {
805805
return Some(m);
806806
}

0 commit comments

Comments
 (0)