Add more tests for SDP parsing

showing that putting attribute lines before time information in the
session part is rejected and that unknown attribute lines do not
cause parsing errors

BUG=webrtc:15597

Change-Id: I291ee3d7d6c25ca63c86c1b4a92feb9083be408f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/324621
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#40999}
This commit is contained in:
Philipp Hancke 2023-10-23 11:59:39 +02:00 committed by WebRTC LUCI CQ
parent 6b0c5babe0
commit 581dc09008

View File

@ -5077,3 +5077,27 @@ TEST_F(WebRtcSdpTest, RejectDuplicateSsrcInSsrcGroup) {
JsepSessionDescription jdesc(kDummyType);
EXPECT_FALSE(SdpDeserialize(sdp, &jdesc));
}
TEST_F(WebRtcSdpTest, ExpectsTLineBeforeAttributeLine) {
// https://www.rfc-editor.org/rfc/rfc4566#page-9
// says a= attributes must come last.
std::string sdp =
"v=0\r\n"
"o=- 0 3 IN IP4 127.0.0.1\r\n"
"s=-\r\n"
"a=thisisnottherightplace\r\n"
"t=0 0\r\n";
JsepSessionDescription jdesc(kDummyType);
EXPECT_FALSE(SdpDeserialize(sdp, &jdesc));
}
TEST_F(WebRtcSdpTest, IgnoresUnknownAttributeLines) {
std::string sdp =
"v=0\r\n"
"o=- 0 3 IN IP4 127.0.0.1\r\n"
"s=-\r\n"
"t=0 0\r\n"
"a=somethingthatisnotunderstood\r\n";
JsepSessionDescription jdesc(kDummyType);
EXPECT_TRUE(SdpDeserialize(sdp, &jdesc));
}