From 80cd25bcfb2264fa0f1192de942a6f063879dd42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Tue, 23 Oct 2018 10:07:25 +0200 Subject: [PATCH] Delete CodecNamesEq, replaced with absl::EqualsIgnoreCase Bug: None Change-Id: I225fe1e16a3c96e5a03e3ae8fe975f368be7e6ad Reviewed-on: https://webrtc-review.googlesource.com/c/107303 Commit-Queue: Niels Moller Reviewed-by: Karl Wiberg Cr-Commit-Position: refs/heads/master@{#25312} --- api/video_codecs/BUILD.gn | 1 + .../builtin_video_encoder_factory.cc | 3 +- api/video_codecs/video_codec.cc | 15 ++++------ media/BUILD.gn | 1 + media/base/codec.cc | 19 ++++-------- media/base/codec.h | 3 -- media/engine/convert_legacy_video_factory.cc | 5 ++-- media/engine/fakewebrtcvideoengine.cc | 3 +- media/engine/internaldecoderfactory.cc | 7 +++-- media/engine/internalencoderfactory.cc | 7 +++-- media/engine/multiplexcodecfactory.cc | 9 +++--- media/engine/webrtcvideoengine.cc | 30 ++++++++++--------- media/engine/webrtcvideoengine_unittest.cc | 9 +++--- modules/video_coding/BUILD.gn | 1 + .../codecs/h264/h264_encoder_impl.cc | 3 +- pc/BUILD.gn | 1 + pc/mediasession.cc | 5 ++-- pc/webrtcsdp.cc | 9 +++--- 18 files changed, 65 insertions(+), 66 deletions(-) diff --git a/api/video_codecs/BUILD.gn b/api/video_codecs/BUILD.gn index 129336be58..916e7da5e6 100644 --- a/api/video_codecs/BUILD.gn +++ b/api/video_codecs/BUILD.gn @@ -82,6 +82,7 @@ rtc_static_library("builtin_video_encoder_factory") { "../../rtc_base:ptr_util", "../../rtc_base/system:rtc_export", "//third_party/abseil-cpp/absl/memory", + "//third_party/abseil-cpp/absl/strings", ] } diff --git a/api/video_codecs/builtin_video_encoder_factory.cc b/api/video_codecs/builtin_video_encoder_factory.cc index ca389b99e3..1d0827cbc0 100644 --- a/api/video_codecs/builtin_video_encoder_factory.cc +++ b/api/video_codecs/builtin_video_encoder_factory.cc @@ -13,6 +13,7 @@ #include #include "absl/memory/memory.h" +#include "absl/strings/match.h" #include "api/video_codecs/sdp_video_format.h" #include "media/base/codec.h" #include "media/base/mediaconstants.h" @@ -59,7 +60,7 @@ class BuiltinVideoEncoderFactory : public VideoEncoderFactory { if (IsFormatSupported(internal_encoder_factory_->GetSupportedFormats(), format)) { internal_encoder = - cricket::CodecNamesEq(format.name.c_str(), cricket::kVp8CodecName) + absl::EqualsIgnoreCase(format.name, cricket::kVp8CodecName) ? absl::make_unique( internal_encoder_factory_.get(), format) : internal_encoder_factory_->CreateVideoEncoder(format); diff --git a/api/video_codecs/video_codec.cc b/api/video_codecs/video_codec.cc index ea8dfa74d5..0819c822a0 100644 --- a/api/video_codecs/video_codec.cc +++ b/api/video_codecs/video_codec.cc @@ -115,11 +115,6 @@ static const char* kPayloadNameI420 = "I420"; static const char* kPayloadNameGeneric = "Generic"; static const char* kPayloadNameMultiplex = "Multiplex"; -// TODO(nisse): Delete this wrapper. -static bool CodecNamesEq(const char* name1, const char* name2) { - return absl::EqualsIgnoreCase(name1, name2); -} - const char* CodecTypeToPayloadString(VideoCodecType type) { switch (type) { case kVideoCodecVP8: @@ -137,15 +132,15 @@ const char* CodecTypeToPayloadString(VideoCodecType type) { } VideoCodecType PayloadStringToCodecType(const std::string& name) { - if (CodecNamesEq(name.c_str(), kPayloadNameVp8)) + if (absl::EqualsIgnoreCase(name, kPayloadNameVp8)) return kVideoCodecVP8; - if (CodecNamesEq(name.c_str(), kPayloadNameVp9)) + if (absl::EqualsIgnoreCase(name, kPayloadNameVp9)) return kVideoCodecVP9; - if (CodecNamesEq(name.c_str(), kPayloadNameH264)) + if (absl::EqualsIgnoreCase(name, kPayloadNameH264)) return kVideoCodecH264; - if (CodecNamesEq(name.c_str(), kPayloadNameI420)) + if (absl::EqualsIgnoreCase(name, kPayloadNameI420)) return kVideoCodecI420; - if (CodecNamesEq(name.c_str(), kPayloadNameMultiplex)) + if (absl::EqualsIgnoreCase(name, kPayloadNameMultiplex)) return kVideoCodecMultiplex; return kVideoCodecGeneric; } diff --git a/media/BUILD.gn b/media/BUILD.gn index 5ea7b1e7e6..01345f8f6f 100644 --- a/media/BUILD.gn +++ b/media/BUILD.gn @@ -250,6 +250,7 @@ rtc_static_library("rtc_internal_video_codecs") { "../rtc_base:rtc_base_approved", "../rtc_base:sequenced_task_checker", "../rtc_base/system:rtc_export", + "//third_party/abseil-cpp/absl/strings", "//third_party/abseil-cpp/absl/types:optional", ] } diff --git a/media/base/codec.cc b/media/base/codec.cc index 56a918d399..0a1c7156af 100644 --- a/media/base/codec.cc +++ b/media/base/codec.cc @@ -268,10 +268,10 @@ static bool IsSameH264PacketizationMode(const CodecParameterMap& ours, bool VideoCodec::Matches(const VideoCodec& other) const { if (!Codec::Matches(other)) return false; - if (CodecNamesEq(name.c_str(), kH264CodecName)) + if (absl::EqualsIgnoreCase(name, kH264CodecName)) return webrtc::H264::IsSameH264Profile(params, other.params) && IsSameH264PacketizationMode(params, other.params); - if (CodecNamesEq(name.c_str(), kVp9CodecName)) + if (absl::EqualsIgnoreCase(name, kVp9CodecName)) return webrtc::IsSameVP9Profile(params, other.params); return true; } @@ -362,15 +362,6 @@ bool HasTransportCc(const Codec& codec) { FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty)); } -// TODO(nisse): Delete these wrappers. -bool CodecNamesEq(const std::string& name1, const std::string& name2) { - return CodecNamesEq(name1.c_str(), name2.c_str()); -} - -bool CodecNamesEq(const char* name1, const char* name2) { - return absl::EqualsIgnoreCase(name1, name2); -} - const VideoCodec* FindMatchingCodec( const std::vector& supported_codecs, const VideoCodec& codec) { @@ -388,12 +379,12 @@ bool IsSameCodec(const std::string& name1, const std::string& name2, const CodecParameterMap& params2) { // If different names (case insensitive), then not same formats. - if (!CodecNamesEq(name1, name2)) + if (!absl::EqualsIgnoreCase(name1, name2)) return false; // For every format besides H264 and VP9, comparing names is enough. - if (CodecNamesEq(name1.c_str(), kH264CodecName)) + if (absl::EqualsIgnoreCase(name1, kH264CodecName)) return webrtc::H264::IsSameH264Profile(params1, params2); - if (CodecNamesEq(name1.c_str(), kVp9CodecName)) + if (absl::EqualsIgnoreCase(name1, kVp9CodecName)) return webrtc::IsSameVP9Profile(params1, params2); return true; } diff --git a/media/base/codec.h b/media/base/codec.h index 82885e9967..dd44f186a5 100644 --- a/media/base/codec.h +++ b/media/base/codec.h @@ -216,9 +216,6 @@ const Codec* FindCodecById(const std::vector& codecs, int payload_type) { return nullptr; } -RTC_EXPORT bool CodecNamesEq(const std::string& name1, - const std::string& name2); -RTC_EXPORT bool CodecNamesEq(const char* name1, const char* name2); bool HasNack(const Codec& codec); bool HasRemb(const Codec& codec); bool HasRrtr(const Codec& codec); diff --git a/media/engine/convert_legacy_video_factory.cc b/media/engine/convert_legacy_video_factory.cc index 7da1b0fe2f..297a143425 100644 --- a/media/engine/convert_legacy_video_factory.cc +++ b/media/engine/convert_legacy_video_factory.cc @@ -15,6 +15,7 @@ #include #include "absl/memory/memory.h" +#include "absl/strings/match.h" #include "api/video_codecs/video_decoder_factory.h" #include "api/video_codecs/video_decoder_software_fallback_wrapper.h" #include "api/video_codecs/video_encoder_factory.h" @@ -130,7 +131,7 @@ class EncoderAdapter : public webrtc::VideoEncoderFactory { if (IsFormatSupported(internal_encoder_factory_->GetSupportedFormats(), format)) { internal_encoder = - CodecNamesEq(format.name.c_str(), kVp8CodecName) + absl::EqualsIgnoreCase(format.name, kVp8CodecName) ? absl::make_unique( internal_encoder_factory_.get(), format) : internal_encoder_factory_->CreateVideoEncoder(format); @@ -141,7 +142,7 @@ class EncoderAdapter : public webrtc::VideoEncoderFactory { if (IsFormatSupported(external_encoder_factory_->GetSupportedFormats(), format)) { external_encoder = - CodecNamesEq(format.name.c_str(), kVp8CodecName) + absl::EqualsIgnoreCase(format.name, kVp8CodecName) ? absl::make_unique( external_encoder_factory_.get(), format) : external_encoder_factory_->CreateVideoEncoder(format); diff --git a/media/engine/fakewebrtcvideoengine.cc b/media/engine/fakewebrtcvideoengine.cc index 7081b64933..aabfc8fb6d 100644 --- a/media/engine/fakewebrtcvideoengine.cc +++ b/media/engine/fakewebrtcvideoengine.cc @@ -10,6 +10,7 @@ #include "media/engine/fakewebrtcvideoengine.h" +#include "absl/strings/match.h" #include "media/base/codec.h" #include "media/engine/simulcast_encoder_adapter.h" #include "media/engine/webrtcvideodecoderfactory.h" @@ -218,7 +219,7 @@ FakeWebRtcVideoEncoderFactory::CreateVideoEncoder( rtc::CritScope lock(&crit_); std::unique_ptr encoder; if (IsFormatSupported(formats_, format)) { - if (CodecNamesEq(format.name.c_str(), kVp8CodecName) && + if (absl::EqualsIgnoreCase(format.name, kVp8CodecName) && !vp8_factory_mode_) { // The simulcast adapter will ask this factory for multiple VP8 // encoders. Enter vp8_factory_mode so that we now create these encoders diff --git a/media/engine/internaldecoderfactory.cc b/media/engine/internaldecoderfactory.cc index df74773c86..722413338e 100644 --- a/media/engine/internaldecoderfactory.cc +++ b/media/engine/internaldecoderfactory.cc @@ -10,6 +10,7 @@ #include "media/engine/internaldecoderfactory.h" +#include "absl/strings/match.h" #include "api/video_codecs/sdp_video_format.h" #include "media/base/mediaconstants.h" #include "modules/video_coding/codecs/h264/include/h264.h" @@ -55,11 +56,11 @@ std::unique_ptr InternalDecoderFactory::CreateVideoDecoder( return nullptr; } - if (cricket::CodecNamesEq(format.name, cricket::kVp8CodecName)) + if (absl::EqualsIgnoreCase(format.name, cricket::kVp8CodecName)) return VP8Decoder::Create(); - if (cricket::CodecNamesEq(format.name, cricket::kVp9CodecName)) + if (absl::EqualsIgnoreCase(format.name, cricket::kVp9CodecName)) return VP9Decoder::Create(); - if (cricket::CodecNamesEq(format.name, cricket::kH264CodecName)) + if (absl::EqualsIgnoreCase(format.name, cricket::kH264CodecName)) return H264Decoder::Create(); RTC_NOTREACHED(); diff --git a/media/engine/internalencoderfactory.cc b/media/engine/internalencoderfactory.cc index e6c3c2e72f..e81b73d5e3 100644 --- a/media/engine/internalencoderfactory.cc +++ b/media/engine/internalencoderfactory.cc @@ -12,6 +12,7 @@ #include +#include "absl/strings/match.h" #include "api/video_codecs/sdp_video_format.h" #include "modules/video_coding/codecs/h264/include/h264.h" #include "modules/video_coding/codecs/vp8/include/vp8.h" @@ -41,11 +42,11 @@ VideoEncoderFactory::CodecInfo InternalEncoderFactory::QueryVideoEncoder( std::unique_ptr InternalEncoderFactory::CreateVideoEncoder( const SdpVideoFormat& format) { - if (cricket::CodecNamesEq(format.name, cricket::kVp8CodecName)) + if (absl::EqualsIgnoreCase(format.name, cricket::kVp8CodecName)) return VP8Encoder::Create(); - if (cricket::CodecNamesEq(format.name, cricket::kVp9CodecName)) + if (absl::EqualsIgnoreCase(format.name, cricket::kVp9CodecName)) return VP9Encoder::Create(cricket::VideoCodec(format)); - if (cricket::CodecNamesEq(format.name, cricket::kH264CodecName)) + if (absl::EqualsIgnoreCase(format.name, cricket::kH264CodecName)) return H264Encoder::Create(cricket::VideoCodec(format)); RTC_LOG(LS_ERROR) << "Trying to created encoder of unsupported format " << format.name; diff --git a/media/engine/multiplexcodecfactory.cc b/media/engine/multiplexcodecfactory.cc index 236a2e81ac..b3913243ed 100644 --- a/media/engine/multiplexcodecfactory.cc +++ b/media/engine/multiplexcodecfactory.cc @@ -12,6 +12,7 @@ #include +#include "absl/strings/match.h" #include "api/video_codecs/sdp_video_format.h" #include "media/base/codec.h" #include "media/base/mediaconstants.h" @@ -22,8 +23,8 @@ namespace { bool IsMultiplexCodec(const cricket::VideoCodec& codec) { - return cricket::CodecNamesEq(codec.name.c_str(), - cricket::kMultiplexCodecName); + return absl::EqualsIgnoreCase(codec.name.c_str(), + cricket::kMultiplexCodecName); } } // anonymous namespace @@ -42,7 +43,7 @@ std::vector MultiplexEncoderFactory::GetSupportedFormats() const { std::vector formats = factory_->GetSupportedFormats(); for (const auto& format : formats) { - if (cricket::CodecNamesEq(format.name, kMultiplexAssociatedCodecName)) { + if (absl::EqualsIgnoreCase(format.name, kMultiplexAssociatedCodecName)) { SdpVideoFormat multiplex_format = format; multiplex_format.parameters[cricket::kCodecParamAssociatedCodecName] = format.name; @@ -88,7 +89,7 @@ std::vector MultiplexDecoderFactory::GetSupportedFormats() const { std::vector formats = factory_->GetSupportedFormats(); for (const auto& format : formats) { - if (cricket::CodecNamesEq(format.name, kMultiplexAssociatedCodecName)) { + if (absl::EqualsIgnoreCase(format.name, kMultiplexAssociatedCodecName)) { SdpVideoFormat multiplex_format = format; multiplex_format.parameters[cricket::kCodecParamAssociatedCodecName] = format.name; diff --git a/media/engine/webrtcvideoengine.cc b/media/engine/webrtcvideoengine.cc index e99886e2d7..d1458ff1ed 100644 --- a/media/engine/webrtcvideoengine.cc +++ b/media/engine/webrtcvideoengine.cc @@ -16,6 +16,7 @@ #include #include +#include "absl/strings/match.h" #include "api/video_codecs/sdp_video_format.h" #include "api/video_codecs/video_decoder_factory.h" #include "api/video_codecs/video_encoder.h" @@ -111,8 +112,8 @@ std::vector AssignPayloadTypesAndDefaultCodecs( } // Add associated RTX codec for non-FEC codecs. - if (!CodecNamesEq(codec.name, kUlpfecCodecName) && - !CodecNamesEq(codec.name, kFlexfecCodecName)) { + if (!absl::EqualsIgnoreCase(codec.name, kUlpfecCodecName) && + !absl::EqualsIgnoreCase(codec.name, kFlexfecCodecName)) { output_codecs.push_back( VideoCodec::CreateRtxCodec(payload_type, codec.id)); @@ -147,8 +148,8 @@ int GetMaxFramerate(const webrtc::VideoEncoderConfig& encoder_config, } bool IsTemporalLayersSupported(const std::string& codec_name) { - return CodecNamesEq(codec_name, kVp8CodecName) || - CodecNamesEq(codec_name, kVp9CodecName); + return absl::EqualsIgnoreCase(codec_name, kVp8CodecName) || + absl::EqualsIgnoreCase(codec_name, kVp9CodecName); } static std::string CodecVectorToString(const std::vector& codecs) { @@ -220,9 +221,9 @@ static bool ValidateStreamParams(const StreamParams& sp) { // Returns true if the given codec is disallowed from doing simulcast. bool IsCodecBlacklistedForSimulcast(const std::string& codec_name) { return webrtc::field_trial::IsEnabled("WebRTC-H264Simulcast") - ? CodecNamesEq(codec_name, kVp9CodecName) - : CodecNamesEq(codec_name, kH264CodecName) || - CodecNamesEq(codec_name, kVp9CodecName); + ? absl::EqualsIgnoreCase(codec_name, kVp9CodecName) + : absl::EqualsIgnoreCase(codec_name, kH264CodecName) || + absl::EqualsIgnoreCase(codec_name, kVp9CodecName); } // The selected thresholds for QVGA and VGA corresponded to a QP around 10. @@ -337,14 +338,14 @@ WebRtcVideoChannel::WebRtcVideoSendStream::ConfigureVideoEncoderSettings( denoising = parameters_.options.video_noise_reduction.value_or(false); } - if (CodecNamesEq(codec.name, kH264CodecName)) { + if (absl::EqualsIgnoreCase(codec.name, kH264CodecName)) { webrtc::VideoCodecH264 h264_settings = webrtc::VideoEncoder::GetDefaultH264Settings(); h264_settings.frameDroppingOn = frame_dropping; return new rtc::RefCountedObject< webrtc::VideoEncoderConfig::H264EncoderSpecificSettings>(h264_settings); } - if (CodecNamesEq(codec.name, kVp8CodecName)) { + if (absl::EqualsIgnoreCase(codec.name, kVp8CodecName)) { webrtc::VideoCodecVP8 vp8_settings = webrtc::VideoEncoder::GetDefaultVp8Settings(); vp8_settings.automaticResizeOn = automatic_resize; @@ -354,7 +355,7 @@ WebRtcVideoChannel::WebRtcVideoSendStream::ConfigureVideoEncoderSettings( return new rtc::RefCountedObject< webrtc::VideoEncoderConfig::Vp8EncoderSpecificSettings>(vp8_settings); } - if (CodecNamesEq(codec.name, kVp9CodecName)) { + if (absl::EqualsIgnoreCase(codec.name, kVp9CodecName)) { webrtc::VideoCodecVP9 vp9_settings = webrtc::VideoEncoder::GetDefaultVp9Settings(); const size_t default_num_spatial_layers = @@ -2696,10 +2697,11 @@ std::vector EncoderStreamFactory::CreateEncoderStreams( std::vector layers; if (encoder_config.number_of_streams > 1 || - ((CodecNamesEq(codec_name_, kVp8CodecName) || - CodecNamesEq(codec_name_, kH264CodecName)) && + ((absl::EqualsIgnoreCase(codec_name_, kVp8CodecName) || + absl::EqualsIgnoreCase(codec_name_, kH264CodecName)) && is_screenshare_ && screenshare_config_explicitly_enabled_)) { - bool temporal_layers_supported = CodecNamesEq(codec_name_, kVp8CodecName); + bool temporal_layers_supported = + absl::EqualsIgnoreCase(codec_name_, kVp8CodecName); layers = GetSimulcastConfig(encoder_config.number_of_streams, width, height, 0 /*not used*/, encoder_config.bitrate_priority, max_qp_, 0 /*not_used*/, is_screenshare_, @@ -2792,7 +2794,7 @@ std::vector EncoderStreamFactory::CreateEncoderStreams( layer.max_qp = max_qp_; layer.bitrate_priority = encoder_config.bitrate_priority; - if (CodecNamesEq(codec_name_, kVp9CodecName)) { + if (absl::EqualsIgnoreCase(codec_name_, kVp9CodecName)) { RTC_DCHECK(encoder_config.encoder_specific_settings); // Use VP9 SVC layering from codec settings which might be initialized // though field trial in ConfigureVideoEncoderSettings. diff --git a/media/engine/webrtcvideoengine_unittest.cc b/media/engine/webrtcvideoengine_unittest.cc index ceac3f7f7a..2cb6c97064 100644 --- a/media/engine/webrtcvideoengine_unittest.cc +++ b/media/engine/webrtcvideoengine_unittest.cc @@ -14,6 +14,7 @@ #include #include +#include "absl/strings/match.h" #include "api/rtpparameters.h" #include "api/test/mock_video_decoder_factory.h" #include "api/test/mock_video_encoder_factory.h" @@ -101,7 +102,7 @@ bool HasRtxCodec(const std::vector& codecs, int payload_type) { for (const cricket::VideoCodec& codec : codecs) { int associated_payload_type; - if (cricket::CodecNamesEq(codec.name.c_str(), "rtx") && + if (absl::EqualsIgnoreCase(codec.name.c_str(), "rtx") && codec.GetParam(cricket::kCodecParamAssociatedPayloadType, &associated_payload_type) && associated_payload_type == payload_type) { @@ -650,11 +651,11 @@ size_t WebRtcVideoEngineTest::GetEngineCodecIndex( const std::vector codecs = engine_.codecs(); for (size_t i = 0; i < codecs.size(); ++i) { const cricket::VideoCodec engine_codec = codecs[i]; - if (!CodecNamesEq(name, engine_codec.name)) + if (!absl::EqualsIgnoreCase(name, engine_codec.name)) continue; // The tests only use H264 Constrained Baseline. Make sure we don't return // an internal H264 codec from the engine with a different H264 profile. - if (CodecNamesEq(name.c_str(), kH264CodecName)) { + if (absl::EqualsIgnoreCase(name.c_str(), kH264CodecName)) { const absl::optional profile_level_id = webrtc::H264::ParseSdpProfileLevelId(engine_codec.params); if (profile_level_id->profile != @@ -1431,7 +1432,7 @@ class WebRtcVideoChannelBaseTest : public testing::Test { cricket::VideoCodec GetEngineCodec(const std::string& name) { for (const cricket::VideoCodec& engine_codec : engine_.codecs()) { - if (CodecNamesEq(name, engine_codec.name)) + if (absl::EqualsIgnoreCase(name, engine_codec.name)) return engine_codec; } // This point should never be reached. diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn index f09c91f753..27f7f3d646 100644 --- a/modules/video_coding/BUILD.gn +++ b/modules/video_coding/BUILD.gn @@ -306,6 +306,7 @@ rtc_static_library("webrtc_h264") { "../../rtc_base/system:rtc_export", "../../system_wrappers:metrics", "//third_party/abseil-cpp/absl/memory", + "//third_party/abseil-cpp/absl/strings", "//third_party/libyuv", ] diff --git a/modules/video_coding/codecs/h264/h264_encoder_impl.cc b/modules/video_coding/codecs/h264/h264_encoder_impl.cc index 4effcdbc52..423d4fa541 100644 --- a/modules/video_coding/codecs/h264/h264_encoder_impl.cc +++ b/modules/video_coding/codecs/h264/h264_encoder_impl.cc @@ -19,6 +19,7 @@ #include "third_party/openh264/src/codec/api/svc/codec_def.h" #include "third_party/openh264/src/codec/api/svc/codec_ver.h" +#include "absl/strings/match.h" #include "common_video/libyuv/include/webrtc_libyuv.h" #include "modules/video_coding/utility/simulcast_rate_allocator.h" #include "modules/video_coding/utility/simulcast_utility.h" @@ -167,7 +168,7 @@ H264EncoderImpl::H264EncoderImpl(const cricket::VideoCodec& codec) encoded_image_callback_(nullptr), has_reported_init_(false), has_reported_error_(false) { - RTC_CHECK(cricket::CodecNamesEq(codec.name, cricket::kH264CodecName)); + RTC_CHECK(absl::EqualsIgnoreCase(codec.name, cricket::kH264CodecName)); std::string packetization_mode_string; if (codec.GetParam(cricket::kH264FmtpPacketizationMode, &packetization_mode_string) && diff --git a/pc/BUILD.gn b/pc/BUILD.gn index b8542d9f6c..c6884b952e 100644 --- a/pc/BUILD.gn +++ b/pc/BUILD.gn @@ -212,6 +212,7 @@ rtc_static_library("peerconnection") { "../system_wrappers:field_trial", "../system_wrappers:metrics", "//third_party/abseil-cpp/absl/memory", + "//third_party/abseil-cpp/absl/strings", "//third_party/abseil-cpp/absl/types:optional", ] } diff --git a/pc/mediasession.cc b/pc/mediasession.cc index 024bf1ebc2..b9afca07eb 100644 --- a/pc/mediasession.cc +++ b/pc/mediasession.cc @@ -312,7 +312,8 @@ void FilterDataCodecs(std::vector* codecs, bool sctp) { sctp ? kGoogleRtpDataCodecName : kGoogleSctpDataCodecName; codecs->erase(std::remove_if(codecs->begin(), codecs->end(), [&codec_name](const DataCodec& codec) { - return CodecNamesEq(codec.name, codec_name); + return absl::EqualsIgnoreCase(codec.name, + codec_name); }), codecs->end()); } @@ -746,7 +747,7 @@ static void NegotiateCodecs(const std::vector& local_codecs, RTC_DCHECK(apt_it != theirs.params.end()); negotiated.SetParam(kCodecParamAssociatedPayloadType, apt_it->second); } - if (CodecNamesEq(ours.name.c_str(), kH264CodecName)) { + if (absl::EqualsIgnoreCase(ours.name, kH264CodecName)) { webrtc::H264::GenerateProfileLevelIdForAnswer( ours.params, theirs.params, &negotiated.params); } diff --git a/pc/webrtcsdp.cc b/pc/webrtcsdp.cc index 40f78747cf..0cd6beceef 100644 --- a/pc/webrtcsdp.cc +++ b/pc/webrtcsdp.cc @@ -23,11 +23,12 @@ #include #include -#include "api/mediatypes.h" +#include "absl/strings/match.h" #include "api/candidate.h" #include "api/cryptoparams.h" #include "api/jsepicecandidate.h" #include "api/jsepsessiondescription.h" +#include "api/mediatypes.h" // for RtpExtension #include "api/rtpparameters.h" #include "media/base/codec.h" @@ -1312,8 +1313,8 @@ void BuildMediaDescription(const ContentInfo* content_info, if (data_desc->use_sctpmap()) { for (const cricket::DataCodec& codec : data_desc->codecs()) { - if (cricket::CodecNamesEq(codec.name, - cricket::kGoogleSctpDataCodecName) && + if (absl::EqualsIgnoreCase(codec.name, + cricket::kGoogleSctpDataCodecName) && codec.GetParam(cricket::kCodecParamPort, &sctp_port)) { break; } @@ -1751,7 +1752,7 @@ void AddRtcpFbLines(const T& codec, std::string* message) { bool AddSctpDataCodec(DataContentDescription* media_desc, int sctp_port) { for (const auto& codec : media_desc->codecs()) { - if (cricket::CodecNamesEq(codec.name, cricket::kGoogleSctpDataCodecName)) { + if (absl::EqualsIgnoreCase(codec.name, cricket::kGoogleSctpDataCodecName)) { return ParseFailed("", "Can't have multiple sctp port attributes.", NULL); } }