From 1d848e1c2e211b7646b929b9f605609ab9f00723 Mon Sep 17 00:00:00 2001 From: Andrey Logvin Date: Wed, 22 Jun 2022 09:39:19 +0000 Subject: [PATCH] Reland "pc: make codec comparison for static codecs case-insensitive" This reverts commit e130f29aaaf1be0fb97271847137fb07ddafee0d. Reason for revert: Reland as the downstream project error turned out to be unrelated to the CL Original change's description: > Revert "pc: make codec comparison for static codecs case-insensitive" > > This reverts commit dcc3d046e2209a455fdf1c47045146f32204219b. > > Reason for revert: Speculative revert. Presumably breaks downstream project > > Original change's description: > > pc: make codec comparison for static codecs case-insensitive > > > > BUG=webrtc:14211,webrtc:14140 > > > > Change-Id: Ib51de4c8961a4cf7c71aea27a55c115613296aae > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/266371 > > Commit-Queue: Philipp Hancke > > Reviewed-by: Harald Alvestrand > > Cr-Commit-Position: refs/heads/main@{#37295} > > Bug: webrtc:14211,webrtc:14140 > Change-Id: Iead89fc597a634fe24a3d0e0f65f60215b62262d > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/266483 > Owners-Override: Andrey Logvin > Bot-Commit: rubber-stamper@appspot.gserviceaccount.com > Auto-Submit: Andrey Logvin > Commit-Queue: Andrey Logvin > Cr-Commit-Position: refs/heads/main@{#37300} Bug: webrtc:14211,webrtc:14140 Change-Id: I74d4c1099182612d26b34ca983054688c7e67c42 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/266484 Auto-Submit: Andrey Logvin Reviewed-by: Harald Alvestrand Commit-Queue: Harald Alvestrand Bot-Commit: rubber-stamper@appspot.gserviceaccount.com Owners-Override: Andrey Logvin Cr-Commit-Position: refs/heads/main@{#37304} --- pc/webrtc_sdp.cc | 5 +++-- pc/webrtc_sdp_unittest.cc | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/pc/webrtc_sdp.cc b/pc/webrtc_sdp.cc index 3f1c83736e..8e4552476b 100644 --- a/pc/webrtc_sdp.cc +++ b/pc/webrtc_sdp.cc @@ -26,6 +26,7 @@ #include "absl/algorithm/container.h" #include "absl/strings/ascii.h" +#include "absl/strings/match.h" #include "api/candidate.h" #include "api/crypto_params.h" #include "api/jsep_ice_candidate.h" @@ -3601,7 +3602,7 @@ bool ParseRtpmapAttribute(absl::string_view line, VideoContentDescription* video_desc = media_desc->as_video(); for (const cricket::VideoCodec& existing_codec : video_desc->codecs()) { if (!existing_codec.name.empty() && payload_type == existing_codec.id && - (encoding_name != existing_codec.name || + (!absl::EqualsIgnoreCase(encoding_name, existing_codec.name) || clock_rate != existing_codec.clockrate)) { rtc::StringBuilder description; description @@ -3633,7 +3634,7 @@ bool ParseRtpmapAttribute(absl::string_view line, AudioContentDescription* audio_desc = media_desc->as_audio(); for (const cricket::AudioCodec& existing_codec : audio_desc->codecs()) { if (!existing_codec.name.empty() && payload_type == existing_codec.id && - (encoding_name != existing_codec.name || + (!absl::EqualsIgnoreCase(encoding_name, existing_codec.name) || clock_rate != existing_codec.clockrate || channels != existing_codec.channels)) { rtc::StringBuilder description; diff --git a/pc/webrtc_sdp_unittest.cc b/pc/webrtc_sdp_unittest.cc index 306b16281c..02f990b381 100644 --- a/pc/webrtc_sdp_unittest.cc +++ b/pc/webrtc_sdp_unittest.cc @@ -4699,6 +4699,21 @@ TEST_F(WebRtcSdpTest, FmtpBeforeRtpMap) { EXPECT_TRUE(SdpDeserialize(sdp, &jdesc_output)); } +TEST_F(WebRtcSdpTest, StaticallyAssignedPayloadTypeWithDifferentCasing) { + 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 18\r\n" + // Casing differs from statically assigned type, this should + // still be accepted. + "a=rtpmap:18 g729/8000\r\n"; + + JsepSessionDescription jdesc_output(kDummyType); + EXPECT_TRUE(SdpDeserialize(sdp, &jdesc_output)); +} + // This tests parsing of SDP with unknown ssrc-specific attributes. TEST_F(WebRtcSdpTest, ParseIgnoreUnknownSsrcSpecificAttribute) { std::string sdp = kSdpString;