Skip to content

Commit

Permalink
pc: make codec comparison for static codecs case-insensitive
Browse files Browse the repository at this point in the history
BUG=webrtc:14211,webrtc:14140

Change-Id: Ib51de4c8961a4cf7c71aea27a55c115613296aae
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/266371
Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37295}
  • Loading branch information
fippo authored and WebRTC LUCI CQ committed Jun 22, 2022
1 parent ac38249 commit dcc3d04
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pc/webrtc_sdp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
15 changes: 15 additions & 0 deletions pc/webrtc_sdp_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit dcc3d04

Please sign in to comment.