Delete use of STR_CASE_CMP, replaced with absl::EqualsIgnoreCase.
Bug: webrtc:5876
Change-Id: Ica2d47ca45b8ef01a548d8dbe31dbed740a0ebda
Reviewed-on: https://webrtc-review.googlesource.com/c/106820
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25306}
diff --git a/modules/audio_coding/acm2/acm_codec_database.cc b/modules/audio_coding/acm2/acm_codec_database.cc
index 311af2d..e109cc7 100644
--- a/modules/audio_coding/acm2/acm_codec_database.cc
+++ b/modules/audio_coding/acm2/acm_codec_database.cc
@@ -17,6 +17,7 @@
// references, where appropriate.
#include "modules/audio_coding/acm2/acm_codec_database.h"
+#include "absl/strings/match.h"
#include "rtc_base/checks.h"
#if ((defined WEBRTC_CODEC_ISAC) && (defined WEBRTC_CODEC_ISACFX))
@@ -239,12 +240,12 @@
}
// Comfort Noise is special case, packet-size & rate is not checked.
- if (STR_CASE_CMP(database_[codec_id].plname, "CN") == 0) {
+ if (absl::EqualsIgnoreCase(database_[codec_id].plname, "CN")) {
return codec_id;
}
// RED is special case, packet-size & rate is not checked.
- if (STR_CASE_CMP(database_[codec_id].plname, "red") == 0) {
+ if (absl::EqualsIgnoreCase(database_[codec_id].plname, "red")) {
return codec_id;
}
@@ -272,12 +273,12 @@
// Check the validity of rate. Codecs with multiple rates have their own
// function for this.
- if (STR_CASE_CMP("isac", codec_inst.plname) == 0) {
+ if (absl::EqualsIgnoreCase("isac", codec_inst.plname)) {
return IsISACRateValid(codec_inst.rate) ? codec_id : kInvalidRate;
- } else if (STR_CASE_CMP("ilbc", codec_inst.plname) == 0) {
+ } else if (absl::EqualsIgnoreCase("ilbc", codec_inst.plname)) {
return IsILBCRateValid(codec_inst.rate, codec_inst.pacsize) ? codec_id
: kInvalidRate;
- } else if (STR_CASE_CMP("opus", codec_inst.plname) == 0) {
+ } else if (absl::EqualsIgnoreCase("opus", codec_inst.plname)) {
return IsOpusRateValid(codec_inst.rate) ? codec_id : kInvalidRate;
}
@@ -304,10 +305,10 @@
// Payload name, sampling frequency and number of channels need to match.
// NOTE! If |frequency| is -1, the frequency is not applicable, and is
// always treated as true, like for RED.
- name_match = (STR_CASE_CMP(ci.plname, payload_name) == 0);
+ name_match = absl::EqualsIgnoreCase(ci.plname, payload_name);
frequency_match = (frequency == ci.plfreq) || (frequency == -1);
// The number of channels must match for all codecs but Opus.
- if (STR_CASE_CMP(payload_name, "opus") != 0) {
+ if (!absl::EqualsIgnoreCase(payload_name, "opus")) {
channels_match = (channels == ci.channels);
} else {
// For opus we just check that number of channels is valid.
diff --git a/modules/audio_coding/acm2/acm_receive_test.cc b/modules/audio_coding/acm2/acm_receive_test.cc
index 2d7f296..c149ec1 100644
--- a/modules/audio_coding/acm2/acm_receive_test.cc
+++ b/modules/audio_coding/acm2/acm_receive_test.cc
@@ -14,6 +14,7 @@
#include <memory>
+#include "absl/strings/match.h"
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "modules/audio_coding/codecs/audio_format_conversion.h"
#include "modules/audio_coding/include/audio_coding_module.h"
@@ -30,11 +31,11 @@
// Returns true if the codec should be registered, otherwise false. Changes
// the number of channels for the Opus codec to always be 1.
bool ModifyAndUseThisCodec(CodecInst* codec_param) {
- if (STR_CASE_CMP(codec_param->plname, "CN") == 0 &&
+ if (absl::EqualsIgnoreCase(codec_param->plname, "CN") &&
codec_param->plfreq == 48000)
return false; // Skip 48 kHz comfort noise.
- if (STR_CASE_CMP(codec_param->plname, "telephone-event") == 0)
+ if (absl::EqualsIgnoreCase(codec_param->plname, "telephone-event"))
return false; // Skip DTFM.
return true;
@@ -65,39 +66,43 @@
return false; // Don't use non-mono codecs.
// Re-map pltypes to those used in the NetEq test files.
- if (STR_CASE_CMP(plname, "PCMU") == 0 && plfreq == 8000) {
+ if (absl::EqualsIgnoreCase(plname, "PCMU") && plfreq == 8000) {
*pltype = 0;
- } else if (STR_CASE_CMP(plname, "PCMA") == 0 && plfreq == 8000) {
+ } else if (absl::EqualsIgnoreCase(plname, "PCMA") && plfreq == 8000) {
*pltype = 8;
- } else if (STR_CASE_CMP(plname, "CN") == 0 && plfreq == 8000) {
+ } else if (absl::EqualsIgnoreCase(plname, "CN") && plfreq == 8000) {
*pltype = 13;
- } else if (STR_CASE_CMP(plname, "CN") == 0 && plfreq == 16000) {
+ } else if (absl::EqualsIgnoreCase(plname, "CN") && plfreq == 16000) {
*pltype = 98;
- } else if (STR_CASE_CMP(plname, "CN") == 0 && plfreq == 32000) {
+ } else if (absl::EqualsIgnoreCase(plname, "CN") && plfreq == 32000) {
*pltype = 99;
- } else if (STR_CASE_CMP(plname, "ILBC") == 0) {
+ } else if (absl::EqualsIgnoreCase(plname, "ILBC")) {
*pltype = 102;
- } else if (STR_CASE_CMP(plname, "ISAC") == 0 && plfreq == 16000) {
+ } else if (absl::EqualsIgnoreCase(plname, "ISAC") && plfreq == 16000) {
*pltype = 103;
- } else if (STR_CASE_CMP(plname, "ISAC") == 0 && plfreq == 32000) {
+ } else if (absl::EqualsIgnoreCase(plname, "ISAC") && plfreq == 32000) {
*pltype = 104;
- } else if (STR_CASE_CMP(plname, "telephone-event") == 0 && plfreq == 8000) {
+ } else if (absl::EqualsIgnoreCase(plname, "telephone-event") &&
+ plfreq == 8000) {
*pltype = 106;
- } else if (STR_CASE_CMP(plname, "telephone-event") == 0 && plfreq == 16000) {
+ } else if (absl::EqualsIgnoreCase(plname, "telephone-event") &&
+ plfreq == 16000) {
*pltype = 114;
- } else if (STR_CASE_CMP(plname, "telephone-event") == 0 && plfreq == 32000) {
+ } else if (absl::EqualsIgnoreCase(plname, "telephone-event") &&
+ plfreq == 32000) {
*pltype = 115;
- } else if (STR_CASE_CMP(plname, "telephone-event") == 0 && plfreq == 48000) {
+ } else if (absl::EqualsIgnoreCase(plname, "telephone-event") &&
+ plfreq == 48000) {
*pltype = 116;
- } else if (STR_CASE_CMP(plname, "red") == 0) {
+ } else if (absl::EqualsIgnoreCase(plname, "red")) {
*pltype = 117;
- } else if (STR_CASE_CMP(plname, "L16") == 0 && plfreq == 8000) {
+ } else if (absl::EqualsIgnoreCase(plname, "L16") && plfreq == 8000) {
*pltype = 93;
- } else if (STR_CASE_CMP(plname, "L16") == 0 && plfreq == 16000) {
+ } else if (absl::EqualsIgnoreCase(plname, "L16") && plfreq == 16000) {
*pltype = 94;
- } else if (STR_CASE_CMP(plname, "L16") == 0 && plfreq == 32000) {
+ } else if (absl::EqualsIgnoreCase(plname, "L16") && plfreq == 32000) {
*pltype = 95;
- } else if (STR_CASE_CMP(plname, "G722") == 0) {
+ } else if (absl::EqualsIgnoreCase(plname, "G722")) {
*pltype = 9;
} else {
// Don't use any other codecs.
diff --git a/modules/audio_coding/acm2/acm_receiver.cc b/modules/audio_coding/acm2/acm_receiver.cc
index f631746..93fa27c 100644
--- a/modules/audio_coding/acm2/acm_receiver.cc
+++ b/modules/audio_coding/acm2/acm_receiver.cc
@@ -15,9 +15,9 @@
#include <algorithm> // sort
#include <vector>
+#include "absl/strings/match.h"
#include "api/audio_codecs/audio_decoder.h"
#include "common_audio/signal_processing/include/signal_processing_library.h"
-#include "common_types.h" // NOLINT(build/include)
#include "modules/audio_coding/acm2/acm_resampler.h"
#include "modules/audio_coding/acm2/call_statistics.h"
#include "modules/audio_coding/acm2/rent_a_codec.h"
@@ -92,7 +92,7 @@
}
receive_timestamp = NowInTimestamp(ci->plfreq);
- if (STR_CASE_CMP(ci->plname, "cn") == 0) {
+ if (absl::EqualsIgnoreCase(ci->plname, "cn")) {
if (last_audio_decoder_ && last_audio_decoder_->channels > 1) {
// This is a CNG and the audio codec is not mono, so skip pushing in
// packets into NetEq.
@@ -391,7 +391,7 @@
uint8_t first_payload_byte) const {
const absl::optional<CodecInst> ci =
neteq_->GetDecoder(rtp_header.payloadType);
- if (ci && STR_CASE_CMP(ci->plname, "red") == 0) {
+ if (ci && absl::EqualsIgnoreCase(ci->plname, "red")) {
// This is a RED packet. Get the payload of the audio codec.
return neteq_->GetDecoder(first_payload_byte & 0x7f);
} else {
diff --git a/modules/audio_coding/acm2/audio_coding_module.cc b/modules/audio_coding/acm2/audio_coding_module.cc
index 60afeb6..d675203 100644
--- a/modules/audio_coding/acm2/audio_coding_module.cc
+++ b/modules/audio_coding/acm2/audio_coding_module.cc
@@ -12,6 +12,7 @@
#include <algorithm>
+#include "absl/strings/match.h"
#include "modules/audio_coding/acm2/acm_receiver.h"
#include "modules/audio_coding/acm2/acm_resampler.h"
#include "modules/audio_coding/acm2/codec_manager.h"
@@ -990,7 +991,7 @@
}
AudioDecoder* isac_decoder = nullptr;
- if (STR_CASE_CMP(codec.plname, "isac") == 0) {
+ if (absl::EqualsIgnoreCase(codec.plname, "isac")) {
std::unique_ptr<AudioDecoder>& saved_isac_decoder =
codec.plfreq == 16000 ? isac_decoder_16k_ : isac_decoder_32k_;
if (!saved_isac_decoder) {
diff --git a/modules/audio_coding/acm2/codec_manager.cc b/modules/audio_coding/acm2/codec_manager.cc
index f29e0f1..5094e21 100644
--- a/modules/audio_coding/acm2/codec_manager.cc
+++ b/modules/audio_coding/acm2/codec_manager.cc
@@ -10,6 +10,7 @@
#include "modules/audio_coding/acm2/codec_manager.h"
+#include "absl/strings/match.h"
#include "rtc_base/checks.h"
//#include "rtc_base/format_macros.h"
#include "modules/audio_coding/acm2/rent_a_codec.h"
@@ -35,7 +36,7 @@
}
// Telephone-event cannot be a send codec.
- if (!STR_CASE_CMP(send_codec.plname, "telephone-event")) {
+ if (absl::EqualsIgnoreCase(send_codec.plname, "telephone-event")) {
RTC_LOG(LS_ERROR) << "telephone-event cannot be a send codec";
return -1;
}
@@ -53,7 +54,7 @@
bool IsOpus(const CodecInst& codec) {
return
#ifdef WEBRTC_CODEC_OPUS
- !STR_CASE_CMP(codec.plname, "opus") ||
+ absl::EqualsIgnoreCase(codec.plname, "opus") ||
#endif
false;
}
diff --git a/modules/audio_coding/acm2/rent_a_codec.cc b/modules/audio_coding/acm2/rent_a_codec.cc
index 0a9ce11..b904eb8 100644
--- a/modules/audio_coding/acm2/rent_a_codec.cc
+++ b/modules/audio_coding/acm2/rent_a_codec.cc
@@ -13,10 +13,11 @@
#include <memory>
#include <utility>
+#include "absl/strings/match.h"
#include "modules/audio_coding/codecs/cng/audio_encoder_cng.h"
#include "modules/audio_coding/codecs/g711/audio_encoder_pcm.h"
-#include "rtc_base/logging.h"
#include "modules/audio_coding/codecs/g722/audio_encoder_g722.h"
+#include "rtc_base/logging.h"
#ifdef WEBRTC_CODEC_ILBC
#include "modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.h" // nogncheck
#endif
@@ -109,7 +110,7 @@
RentACodec::RegistrationResult RentACodec::RegisterCngPayloadType(
std::map<int, int>* pt_map,
const CodecInst& codec_inst) {
- if (STR_CASE_CMP(codec_inst.plname, "CN") != 0)
+ if (!absl::EqualsIgnoreCase(codec_inst.plname, "CN"))
return RegistrationResult::kSkip;
switch (codec_inst.plfreq) {
case 8000:
@@ -126,7 +127,7 @@
RentACodec::RegistrationResult RentACodec::RegisterRedPayloadType(
std::map<int, int>* pt_map,
const CodecInst& codec_inst) {
- if (STR_CASE_CMP(codec_inst.plname, "RED") != 0)
+ if (!absl::EqualsIgnoreCase(codec_inst.plname, "RED"))
return RegistrationResult::kSkip;
switch (codec_inst.plfreq) {
case 8000:
@@ -145,30 +146,30 @@
const CodecInst& speech_inst,
const rtc::scoped_refptr<LockedIsacBandwidthInfo>& bwinfo) {
#if defined(WEBRTC_CODEC_ISACFX)
- if (STR_CASE_CMP(speech_inst.plname, "isac") == 0)
+ if (absl::EqualsIgnoreCase(speech_inst.plname, "isac"))
return std::unique_ptr<AudioEncoder>(
new AudioEncoderIsacFixImpl(speech_inst, bwinfo));
#endif
#if defined(WEBRTC_CODEC_ISAC)
- if (STR_CASE_CMP(speech_inst.plname, "isac") == 0)
+ if (absl::EqualsIgnoreCase(speech_inst.plname, "isac"))
return std::unique_ptr<AudioEncoder>(
new AudioEncoderIsacFloatImpl(speech_inst, bwinfo));
#endif
#ifdef WEBRTC_CODEC_OPUS
- if (STR_CASE_CMP(speech_inst.plname, "opus") == 0)
+ if (absl::EqualsIgnoreCase(speech_inst.plname, "opus"))
return std::unique_ptr<AudioEncoder>(new AudioEncoderOpusImpl(speech_inst));
#endif
- if (STR_CASE_CMP(speech_inst.plname, "pcmu") == 0)
+ if (absl::EqualsIgnoreCase(speech_inst.plname, "pcmu"))
return std::unique_ptr<AudioEncoder>(new AudioEncoderPcmU(speech_inst));
- if (STR_CASE_CMP(speech_inst.plname, "pcma") == 0)
+ if (absl::EqualsIgnoreCase(speech_inst.plname, "pcma"))
return std::unique_ptr<AudioEncoder>(new AudioEncoderPcmA(speech_inst));
- if (STR_CASE_CMP(speech_inst.plname, "l16") == 0)
+ if (absl::EqualsIgnoreCase(speech_inst.plname, "l16"))
return std::unique_ptr<AudioEncoder>(new AudioEncoderPcm16B(speech_inst));
#ifdef WEBRTC_CODEC_ILBC
- if (STR_CASE_CMP(speech_inst.plname, "ilbc") == 0)
+ if (absl::EqualsIgnoreCase(speech_inst.plname, "ilbc"))
return std::unique_ptr<AudioEncoder>(new AudioEncoderIlbcImpl(speech_inst));
#endif
- if (STR_CASE_CMP(speech_inst.plname, "g722") == 0)
+ if (absl::EqualsIgnoreCase(speech_inst.plname, "g722"))
return std::unique_ptr<AudioEncoder>(new AudioEncoderG722Impl(speech_inst));
RTC_LOG_F(LS_ERROR) << "Could not create encoder of type "
<< speech_inst.plname;