Choose RTX codec PT in lower range if codec is in lower range pc1 video mline without this change (and the previous one): 96 97 107 108 109 114 115 116 117 118 119 120 37 121 40 124 98 99 100 101 127 42 43 with this change: 96 97 103 104 107 108 109 114 115 116 117 118 39 40 45 46 98 99 100 101 119 120 121 BUG=webrtc:360058654 Change-Id: I4021daf1c62f0edf9650e12a74619035040291a8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/376022 Reviewed-by: Henrik Boström <hbos@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#43838}
diff --git a/call/BUILD.gn b/call/BUILD.gn index 8f37af0..484b772 100644 --- a/call/BUILD.gn +++ b/call/BUILD.gn
@@ -396,6 +396,7 @@ "../media:media_constants", "../rtc_base:checks", "../rtc_base:logging", + "../rtc_base:stringutils", "../rtc_base:strong_alias", "//third_party/abseil-cpp/absl/strings", ]
diff --git a/call/payload_type_picker.cc b/call/payload_type_picker.cc index eb8ed45..c7983ce 100644 --- a/call/payload_type_picker.cc +++ b/call/payload_type_picker.cc
@@ -25,6 +25,7 @@ #include "media/base/media_constants.h" #include "rtc_base/checks.h" #include "rtc_base/logging.h" +#include "rtc_base/string_encode.h" namespace webrtc { @@ -80,6 +81,15 @@ return true; } } + } else if (absl::EqualsIgnoreCase(codec.name, cricket::kRtxCodecName)) { + // For RTX prefer lower range if the associated codec is in that range. + std::string associated_pt_str; + int associated_pt; + return codec.GetParam(cricket::kCodecParamAssociatedPayloadType, + &associated_pt_str) && + rtc::FromString(associated_pt_str, &associated_pt) && + associated_pt >= kFirstDynamicPayloadTypeLowerRange && + associated_pt <= kLastDynamicPayloadTypeLowerRange; } return false; }
diff --git a/call/payload_type_picker_unittest.cc b/call/payload_type_picker_unittest.cc index fd64923..5a3e39b 100644 --- a/call/payload_type_picker_unittest.cc +++ b/call/payload_type_picker_unittest.cc
@@ -10,6 +10,7 @@ #include "call/payload_type_picker.h" +#include "api/video_codecs/sdp_video_format.h" #include "call/payload_type.h" #include "media/base/codec.h" #include "media/base/media_constants.h" @@ -205,9 +206,14 @@ // Valid for high range only. EXPECT_THAT(picker.SuggestMapping(h264_constrained, nullptr).value(), Ge(96)); EXPECT_THAT(picker.SuggestMapping(vp9_profile_2, nullptr).value(), Ge(96)); - // Valud for lower range. + // Valid for lower range. EXPECT_THAT(picker.SuggestMapping(h264_yuv444, nullptr).value(), Lt(63)); EXPECT_THAT(picker.SuggestMapping(vp9_profile_3, nullptr).value(), Lt(63)); + + // RTX with a primary codec in the lower range is valid for lower range. + cricket::Codec lower_range_rtx = + cricket::CreateVideoRtxCodec(cricket::Codec::kIdNotSet, 63); + EXPECT_THAT(picker.SuggestMapping(lower_range_rtx, nullptr).value(), Lt(63)); } TEST(PayloadTypePicker, ChoosingH264Profiles) {