sdp: reject duplicate codecs with the same id but different name or clockrate
since something like rtpmap:96 VP8/90000 rtpmap:96 VP9/90000 or rtpmap:97 ISAC/32000 rtpmap:97 ISAC/16000 is wrong. Note that fmtp or rtcp-fb are not taken into account. Also note that sending invalid static payload types now throws an error. Drive-by: replace "RtpMap" with "Rtpmap" for consistency. BUG=None Change-Id: I2574b82a6f1a0afe3edc866e514a5dbca0798e8c Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/263641 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com> Cr-Commit-Position: refs/heads/main@{#37028}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
fc2c24ef44
commit
ad6807805d
@ -2427,7 +2427,7 @@ TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithoutRtpmap) {
|
||||
// Codec that doesn't appear in the m= line will be ignored.
|
||||
"a=rtpmap:104 ISAC/32000\r\n"
|
||||
// The rtpmap line for static payload codec is optional.
|
||||
"a=rtpmap:18 G729/16000\r\n"
|
||||
"a=rtpmap:18 G729/8000\r\n"
|
||||
"a=rtpmap:103 ISAC/16000\r\n";
|
||||
|
||||
JsepSessionDescription jdesc(kDummyType);
|
||||
@ -2438,7 +2438,7 @@ TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithoutRtpmap) {
|
||||
// The codecs in the AudioContentDescription should be in the same order as
|
||||
// the payload types (<fmt>s) on the m= line.
|
||||
ref_codecs.push_back(AudioCodec(0, "PCMU", 8000, 0, 1));
|
||||
ref_codecs.push_back(AudioCodec(18, "G729", 16000, 0, 1));
|
||||
ref_codecs.push_back(AudioCodec(18, "G729", 8000, 0, 1));
|
||||
ref_codecs.push_back(AudioCodec(103, "ISAC", 16000, 0, 1));
|
||||
EXPECT_EQ(ref_codecs, audio->codecs());
|
||||
}
|
||||
@ -4658,6 +4658,33 @@ TEST_F(WebRtcSdpTest, MaxChannels) {
|
||||
ExpectParseFailure(sdp, "a=rtpmap:108 ISAC/16000/512");
|
||||
}
|
||||
|
||||
TEST_F(WebRtcSdpTest, DuplicateAudioRtpmapWithConflict) {
|
||||
std::string sdp =
|
||||
"v=0\r\n"
|
||||
"o=- 11 22 IN IP4 127.0.0.1\r\n"
|
||||
"s=-\r\n"
|
||||
"t=0 0\r\n"
|
||||
"m=audio 49232 RTP/AVP 108\r\n"
|
||||
// Same name but different payload type.
|
||||
"a=rtpmap:108 ISAC/16000\r\n"
|
||||
"a=rtpmap:108 ISAC/32000\r\n";
|
||||
|
||||
ExpectParseFailure(sdp, "a=rtpmap:108 ISAC/32000");
|
||||
}
|
||||
|
||||
TEST_F(WebRtcSdpTest, DuplicateVideoRtpmapWithConflict) {
|
||||
std::string sdp =
|
||||
"v=0\r\n"
|
||||
"o=- 11 22 IN IP4 127.0.0.1\r\n"
|
||||
"s=-\r\n"
|
||||
"t=0 0\r\n"
|
||||
"m=video 49232 RTP/AVP 108\r\n"
|
||||
"a=rtpmap:108 VP8/90000\r\n"
|
||||
"a=rtpmap:108 VP9/90000\r\n";
|
||||
|
||||
ExpectParseFailure(sdp, "a=rtpmap:108 VP9/90000");
|
||||
}
|
||||
|
||||
// This tests parsing of SDP with unknown ssrc-specific attributes.
|
||||
TEST_F(WebRtcSdpTest, ParseIgnoreUnknownSsrcSpecificAttribute) {
|
||||
std::string sdp = kSdpString;
|
||||
|
||||
Reference in New Issue
Block a user