Bug 1432934: Added sanity check for recvonly attribute. r=bwc draft
authorJohannes Willbold <j.willbold@mozilla.com>
Mon, 04 Jun 2018 14:07:28 -0700
changeset 803804 67aa4d6cea6a
parent 803775 25738ca87ac5
push id112194
push userbmo:johannes.willbold@rub.de
push dateMon, 04 Jun 2018 21:08:03 +0000
reviewersbwc
bugs1432934
milestone62.0a1
Bug 1432934: Added sanity check for recvonly attribute. r=bwc Added a sanity check, that checks for recvonly and whether simulcast defines send options MozReview-Commit-ID: Hi5U9ZZVKY8
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
@@ -3803,17 +3803,16 @@ TEST_P(NewSdpTest, ParseInvalidSimulcast
            "a=rtpmap:120 VP8/90000" CRLF
            "a=sendrecv" CRLF
            "a=simulcast: send pt=9" CRLF,
            false);
   ASSERT_NE("", GetParseErrors());
 }
 
 TEST_P(NewSdpTest, ParseInvalidSimulcastNotSending) {
-  SKIP_TEST_WITH_RUST_PARSER; // See Bug 1432934
   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
@@ -611,16 +611,26 @@ fn sanity_check_sdp_session(session: &Sd
                 if x.receive.len() > 0 {
                     return Err(SdpParserError::Sequence {
                         message: "Simulcast can't define send parameters for recvonly".to_string(),
                         line_number: 0,
                     });
                 }
             }
         }
+        if msection.get_attribute(SdpAttributeType::Recvonly).is_some() {
+            if let Some(&SdpAttribute::Simulcast(ref x)) = msection.get_attribute(SdpAttributeType::Simulcast) {
+                if x.send.len() > 0 {
+                    return Err(SdpParserError::Sequence {
+                        message: "Simulcast can't define send parameters for recvonly".to_string(),
+                        line_number: 0,
+                    });
+                }
+            }
+        }
     }
 
     Ok(())
 }
 
 #[cfg(test)]
 fn create_dummy_sdp_session() -> SdpSession {
     let origin = parse_origin("mozilla 506705521068071134 0 IN IP4 0.0.0.0");