Bug 1432931: Added sanity check for simulcast send rid. r=bwc
authorJohannes Willbold <j.willbold@mozilla.com>
Thu, 28 Jun 2018 10:55:50 -0700
changeset 424954 49927e1a2c9fd0500cb5e441341f46aa4193b75b
parent 424953 f8f4551a1c46e718a502d68e45f9a9ed1b4199ce
child 424955 9c75cab2e32295ee037f0a8f1af2f61ac86f8b8c
push id104946
push userrgurzau@mozilla.com
push dateWed, 04 Jul 2018 10:03:16 +0000
treeherdermozilla-inbound@796893f4d2f5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbwc
bugs1432931
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1432931: Added sanity check for simulcast send rid. r=bwc Added sanity check to check if the send rid in simulcast is defined by any send rid. MozReview-Commit-ID: GISzaQqdqBI
media/webrtc/signaling/gtest/sdp_unittests.cpp
media/webrtc/signaling/src/sdp/rsdparsa/src/lib.rs
--- a/media/webrtc/signaling/gtest/sdp_unittests.cpp
+++ b/media/webrtc/signaling/gtest/sdp_unittests.cpp
@@ -3732,17 +3732,16 @@ TEST_P(NewSdpTest, CheckMalformedImageat
     return;
   }
 
   ParseSdp(kMalformedImageattr, false);
   ASSERT_NE("", GetParseErrors());
 }
 
 TEST_P(NewSdpTest, ParseInvalidSimulcastNoSuchSendRid) {
-  SKIP_TEST_WITH_RUST_PARSER; // See Bug 1432931
   ParseSdp("v=0" CRLF
            "o=- 4294967296 2 IN IP4 127.0.0.1" CRLF
            "s=SIP Call" CRLF
            "c=IN IP4 198.51.100.7" CRLF
            "b=CT:5000" CRLF
            "t=0 0" CRLF
            "m=video 56436 RTP/SAVPF 120" CRLF
            "a=rtpmap:120 VP8/90000" CRLF
--- a/media/webrtc/signaling/src/sdp/rsdparsa/src/lib.rs
+++ b/media/webrtc/signaling/src/sdp/rsdparsa/src/lib.rs
@@ -694,16 +694,22 @@ fn sanity_check_sdp_session(session: &Sd
                                                          }
                                                   }).collect();
         let recv_rids:Vec<&str> = rids.iter().filter_map(|rid| {
           match rid.direction {
               SdpSingleDirection::Recv => Some(rid.id.as_str()),
               _ => None,
           }
         }).collect();
+        let send_rids:Vec<&str> = rids.iter().filter_map(|rid| {
+          match rid.direction {
+              SdpSingleDirection::Send => Some(rid.id.as_str()),
+              _ => None,
+          }
+        }).collect();
 
 
         for rid_format in rids.iter().flat_map(|rid| &rid.formats) {
             match msection.get_formats() {
                 &SdpFormatList::Integers(ref int_fmt) => {
                     if !int_fmt.contains(&(*rid_format as u32))  {
                         return Err(make_error("Rid pts must be declared in the media section"));
                     }
@@ -713,29 +719,29 @@ fn sanity_check_sdp_session(session: &Sd
                         return Err(make_error("Rid pts must be declared in the media section"));
                     }
                 }
             }
         }
 
         if let Some(&SdpAttribute::Simulcast(ref simulcast)) =
                                             msection.get_attribute(SdpAttributeType::Simulcast) {
-            // This is already a closure as the next Bug 1432931 will require the same procedure
             let check_defined_rids = |simulcast_version_list: &Vec<SdpAttributeSimulcastVersion>,
                                       rid_ids: &[&str]| -> Result<(),SdpParserError> {
                 for simulcast_rid in simulcast_version_list.iter().flat_map(|x| &x.ids) {
                     if !rid_ids.contains(&simulcast_rid.id.as_str()) {
                         return Err(make_error(
                                        "Simulcast RIDs must be defined in any rid attribute"));
                     }
                 }
                 Ok(())
             };
 
-            check_defined_rids(&simulcast.receive, &recv_rids)?
+            check_defined_rids(&simulcast.receive, &recv_rids)?;
+            check_defined_rids(&simulcast.send, &send_rids)?;
         }
     }
 
     Ok(())
 }
 
 #[cfg(test)]
 fn create_dummy_sdp_session() -> SdpSession {