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}
This commit is contained in:
@ -53,6 +53,7 @@ rtc_static_library("audio_format_conversion") {
|
||||
"../../rtc_base:checks",
|
||||
"../../rtc_base:rtc_base_approved",
|
||||
"../../rtc_base:sanitizer",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
@ -74,6 +75,7 @@ rtc_static_library("rent_a_codec") {
|
||||
deps = [
|
||||
"../../rtc_base:checks",
|
||||
"../../api:array_view",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
"../../api/audio_codecs:audio_codecs_api",
|
||||
"../..:webrtc_common",
|
||||
@ -136,6 +138,7 @@ rtc_static_library("audio_coding") {
|
||||
":rent_a_codec",
|
||||
"../../rtc_base:audio_format_to_string",
|
||||
"../../rtc_base:rtc_base_approved",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
"../../logging:rtc_event_log_api",
|
||||
]
|
||||
@ -829,6 +832,7 @@ rtc_static_library("webrtc_opus") {
|
||||
"../../rtc_base:safe_minmax",
|
||||
"../../system_wrappers:field_trial",
|
||||
"//third_party/abseil-cpp/absl/memory",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
public_deps = [
|
||||
@ -1068,6 +1072,7 @@ rtc_static_library("neteq") {
|
||||
"../../rtc_base/system:fallthrough",
|
||||
"../../system_wrappers:field_trial",
|
||||
"../../system_wrappers:metrics",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
@ -1362,6 +1367,7 @@ if (rtc_include_tests) {
|
||||
"../../system_wrappers",
|
||||
"../../test:fileutils",
|
||||
"../../test:test_support",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
defines = audio_coding_defines
|
||||
|
||||
@ -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 @@ int ACMCodecDB::CodecNumber(const CodecInst& codec_inst) {
|
||||
}
|
||||
|
||||
// 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 @@ int ACMCodecDB::CodecNumber(const CodecInst& codec_inst) {
|
||||
|
||||
// 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 @@ int ACMCodecDB::CodecId(const char* payload_name,
|
||||
// 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.
|
||||
|
||||
@ -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 @@ namespace {
|
||||
// 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 @@ bool RemapPltypeAndUseThisCodec(const char* plname,
|
||||
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.
|
||||
|
||||
@ -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 @@ int AcmReceiver::InsertPacket(const WebRtcRTPHeader& rtp_header,
|
||||
}
|
||||
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 @@ const absl::optional<CodecInst> AcmReceiver::RtpHeaderToDecoder(
|
||||
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 {
|
||||
|
||||
@ -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 @@ int AudioCodingModuleImpl::RegisterReceiveCodecUnlocked(
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
@ -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 @@ int IsValidSendCodec(const CodecInst& send_codec) {
|
||||
}
|
||||
|
||||
// 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 @@ int IsValidSendCodec(const CodecInst& send_codec) {
|
||||
bool IsOpus(const CodecInst& codec) {
|
||||
return
|
||||
#ifdef WEBRTC_CODEC_OPUS
|
||||
!STR_CASE_CMP(codec.plname, "opus") ||
|
||||
absl::EqualsIgnoreCase(codec.plname, "opus") ||
|
||||
#endif
|
||||
false;
|
||||
}
|
||||
|
||||
@ -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 @@ absl::optional<NetEqDecoder> RentACodec::NetEqDecoderFromCodecId(
|
||||
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::RegisterCngPayloadType(
|
||||
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 @@ std::unique_ptr<AudioEncoder> CreateEncoder(
|
||||
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;
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "absl/strings/match.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/array_view.h"
|
||||
#include "rtc_base/checks.h"
|
||||
@ -41,11 +42,11 @@ CodecInst MakeCodecInst(int payload_type,
|
||||
} // namespace
|
||||
|
||||
SdpAudioFormat CodecInstToSdp(const CodecInst& ci) {
|
||||
if (STR_CASE_CMP(ci.plname, "g722") == 0) {
|
||||
if (absl::EqualsIgnoreCase(ci.plname, "g722")) {
|
||||
RTC_CHECK_EQ(16000, ci.plfreq);
|
||||
RTC_CHECK(ci.channels == 1 || ci.channels == 2);
|
||||
return {"g722", 8000, ci.channels};
|
||||
} else if (STR_CASE_CMP(ci.plname, "opus") == 0) {
|
||||
} else if (absl::EqualsIgnoreCase(ci.plname, "opus")) {
|
||||
RTC_CHECK_EQ(48000, ci.plfreq);
|
||||
RTC_CHECK(ci.channels == 1 || ci.channels == 2);
|
||||
return ci.channels == 1
|
||||
@ -57,12 +58,12 @@ SdpAudioFormat CodecInstToSdp(const CodecInst& ci) {
|
||||
}
|
||||
|
||||
CodecInst SdpToCodecInst(int payload_type, const SdpAudioFormat& audio_format) {
|
||||
if (STR_CASE_CMP(audio_format.name.c_str(), "g722") == 0) {
|
||||
if (absl::EqualsIgnoreCase(audio_format.name, "g722")) {
|
||||
RTC_CHECK_EQ(8000, audio_format.clockrate_hz);
|
||||
RTC_CHECK(audio_format.num_channels == 1 || audio_format.num_channels == 2);
|
||||
return MakeCodecInst(payload_type, "g722", 16000,
|
||||
audio_format.num_channels);
|
||||
} else if (STR_CASE_CMP(audio_format.name.c_str(), "opus") == 0) {
|
||||
} else if (absl::EqualsIgnoreCase(audio_format.name, "opus")) {
|
||||
RTC_CHECK_EQ(48000, audio_format.clockrate_hz);
|
||||
RTC_CHECK_EQ(2, audio_format.num_channels);
|
||||
const int num_channels = [&] {
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "absl/strings/match.h"
|
||||
#include "modules/audio_coding/audio_network_adaptor/audio_network_adaptor_impl.h"
|
||||
#include "modules/audio_coding/audio_network_adaptor/controller_manager.h"
|
||||
#include "modules/audio_coding/codecs/opus/opus_interface.h"
|
||||
@ -316,7 +316,7 @@ std::unique_ptr<AudioEncoder> AudioEncoderOpusImpl::MakeAudioEncoder(
|
||||
|
||||
absl::optional<AudioCodecInfo> AudioEncoderOpusImpl::QueryAudioEncoder(
|
||||
const SdpAudioFormat& format) {
|
||||
if (STR_CASE_CMP(format.name.c_str(), GetPayloadName()) == 0 &&
|
||||
if (absl::EqualsIgnoreCase(format.name, GetPayloadName()) &&
|
||||
format.clockrate_hz == 48000 && format.num_channels == 2) {
|
||||
const size_t num_channels = GetChannelCount(format);
|
||||
const int bitrate =
|
||||
@ -348,7 +348,7 @@ AudioEncoderOpusConfig AudioEncoderOpusImpl::CreateConfig(
|
||||
|
||||
absl::optional<AudioEncoderOpusConfig> AudioEncoderOpusImpl::SdpToConfig(
|
||||
const SdpAudioFormat& format) {
|
||||
if (STR_CASE_CMP(format.name.c_str(), "opus") != 0 ||
|
||||
if (!absl::EqualsIgnoreCase(format.name, "opus") ||
|
||||
format.clockrate_hz != 48000 || format.num_channels != 2) {
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
|
||||
#include <utility> // pair
|
||||
|
||||
#include "absl/strings/match.h"
|
||||
#include "api/audio_codecs/audio_decoder.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/logging.h"
|
||||
@ -101,7 +102,7 @@ AudioDecoder* DecoderDatabase::DecoderInfo::GetDecoder() const {
|
||||
}
|
||||
|
||||
bool DecoderDatabase::DecoderInfo::IsType(const char* name) const {
|
||||
return STR_CASE_CMP(audio_format_.name.c_str(), name) == 0;
|
||||
return absl::EqualsIgnoreCase(audio_format_.name, name);
|
||||
}
|
||||
|
||||
bool DecoderDatabase::DecoderInfo::IsType(const std::string& name) const {
|
||||
@ -110,7 +111,7 @@ bool DecoderDatabase::DecoderInfo::IsType(const std::string& name) const {
|
||||
|
||||
absl::optional<DecoderDatabase::DecoderInfo::CngDecoder>
|
||||
DecoderDatabase::DecoderInfo::CngDecoder::Create(const SdpAudioFormat& format) {
|
||||
if (STR_CASE_CMP(format.name.c_str(), "CN") == 0) {
|
||||
if (absl::EqualsIgnoreCase(format.name, "CN")) {
|
||||
// CN has a 1:1 RTP clock rate to sample rate ratio.
|
||||
const int sample_rate_hz = format.clockrate_hz;
|
||||
RTC_DCHECK(sample_rate_hz == 8000 || sample_rate_hz == 16000 ||
|
||||
@ -123,11 +124,11 @@ DecoderDatabase::DecoderInfo::CngDecoder::Create(const SdpAudioFormat& format) {
|
||||
|
||||
DecoderDatabase::DecoderInfo::Subtype
|
||||
DecoderDatabase::DecoderInfo::SubtypeFromFormat(const SdpAudioFormat& format) {
|
||||
if (STR_CASE_CMP(format.name.c_str(), "CN") == 0) {
|
||||
if (absl::EqualsIgnoreCase(format.name, "CN")) {
|
||||
return Subtype::kComfortNoise;
|
||||
} else if (STR_CASE_CMP(format.name.c_str(), "telephone-event") == 0) {
|
||||
} else if (absl::EqualsIgnoreCase(format.name, "telephone-event")) {
|
||||
return Subtype::kDtmf;
|
||||
} else if (STR_CASE_CMP(format.name.c_str(), "red") == 0) {
|
||||
} else if (absl::EqualsIgnoreCase(format.name, "red")) {
|
||||
return Subtype::kRed;
|
||||
}
|
||||
|
||||
|
||||
@ -14,9 +14,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <memory>
|
||||
|
||||
#include "absl/strings/match.h"
|
||||
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
||||
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "modules/audio_coding/codecs/audio_format_conversion.h"
|
||||
#include "modules/audio_coding/include/audio_coding_module.h"
|
||||
#include "modules/audio_coding/test/utility.h"
|
||||
@ -248,11 +248,11 @@ void EncodeDecodeTest::Perform() {
|
||||
|
||||
for (int n = 0; n < numCodecs; n++) {
|
||||
EXPECT_EQ(0, acm->Codec(n, &sendCodecTmp));
|
||||
if (STR_CASE_CMP(sendCodecTmp.plname, "telephone-event") == 0) {
|
||||
if (absl::EqualsIgnoreCase(sendCodecTmp.plname, "telephone-event")) {
|
||||
numPars[n] = 0;
|
||||
} else if (STR_CASE_CMP(sendCodecTmp.plname, "cn") == 0) {
|
||||
} else if (absl::EqualsIgnoreCase(sendCodecTmp.plname, "cn")) {
|
||||
numPars[n] = 0;
|
||||
} else if (STR_CASE_CMP(sendCodecTmp.plname, "red") == 0) {
|
||||
} else if (absl::EqualsIgnoreCase(sendCodecTmp.plname, "red")) {
|
||||
numPars[n] = 0;
|
||||
} else if (sendCodecTmp.channels == 2) {
|
||||
numPars[n] = 0;
|
||||
|
||||
@ -173,7 +173,7 @@ void TestRedFec::RegisterSendCodec(
|
||||
auto encoder = encoder_factory_->MakeAudioEncoder(payload_type, codec_format,
|
||||
absl::nullopt);
|
||||
EXPECT_NE(encoder, nullptr);
|
||||
if (STR_CASE_CMP(codec_format.name.c_str(), "opus") != 0) {
|
||||
if (!absl::EqualsIgnoreCase(codec_format.name, "opus")) {
|
||||
if (vad_mode.has_value()) {
|
||||
AudioEncoderCng::Config config;
|
||||
config.speech_encoder = std::move(encoder);
|
||||
|
||||
@ -12,9 +12,9 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/match.h"
|
||||
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
||||
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "modules/audio_coding/codecs/audio_format_conversion.h"
|
||||
#include "modules/audio_coding/include/audio_coding_module_typedefs.h"
|
||||
#include "modules/audio_coding/test/utility.h"
|
||||
@ -626,14 +626,14 @@ void TestStereo::RegisterSendCodec(char side,
|
||||
ASSERT_TRUE(my_acm != NULL);
|
||||
|
||||
auto encoder_factory = CreateBuiltinAudioEncoderFactory();
|
||||
const int clockrate_hz = STR_CASE_CMP(codec_name, "g722") == 0
|
||||
const int clockrate_hz = absl::EqualsIgnoreCase(codec_name, "g722")
|
||||
? sampling_freq_hz / 2
|
||||
: sampling_freq_hz;
|
||||
const std::string ptime = rtc::ToString(rtc::CheckedDivExact(
|
||||
pack_size, rtc::CheckedDivExact(sampling_freq_hz, 1000)));
|
||||
SdpAudioFormat::Parameters params = {{"ptime", ptime}};
|
||||
RTC_CHECK(channels == 1 || channels == 2);
|
||||
if (STR_CASE_CMP(codec_name, "opus") == 0) {
|
||||
if (absl::EqualsIgnoreCase(codec_name, "opus")) {
|
||||
if (channels == 2) {
|
||||
params["stereo"] = "1";
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/match.h"
|
||||
#include "api/audio_codecs/audio_decoder_factory_template.h"
|
||||
#include "api/audio_codecs/audio_encoder_factory_template.h"
|
||||
#include "api/audio_codecs/ilbc/audio_decoder_ilbc.h"
|
||||
@ -81,7 +82,7 @@ bool TestVadDtx::RegisterCodec(const SdpAudioFormat& codec_format,
|
||||
auto encoder = encoder_factory_->MakeAudioEncoder(payload_type, codec_format,
|
||||
absl::nullopt);
|
||||
if (vad_mode.has_value() &&
|
||||
STR_CASE_CMP(codec_format.name.c_str(), "opus") != 0) {
|
||||
!absl::EqualsIgnoreCase(codec_format.name, "opus")) {
|
||||
AudioEncoderCng::Config config;
|
||||
config.speech_encoder = std::move(encoder);
|
||||
config.num_channels = 1;
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#include "absl/strings/match.h"
|
||||
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
||||
#include "api/audio_codecs/isac/audio_encoder_isac_float.h"
|
||||
#include "modules/audio_coding/codecs/audio_format_conversion.h"
|
||||
@ -92,12 +93,12 @@ void ISACTest::Setup() {
|
||||
for (codecCntr = 0; codecCntr < AudioCodingModule::NumberOfCodecs();
|
||||
codecCntr++) {
|
||||
EXPECT_EQ(0, AudioCodingModule::Codec(codecCntr, &codecParam));
|
||||
if (!STR_CASE_CMP(codecParam.plname, "ISAC") &&
|
||||
if (absl::EqualsIgnoreCase(codecParam.plname, "ISAC") &&
|
||||
codecParam.plfreq == 16000) {
|
||||
memcpy(&_paramISAC16kHz, &codecParam, sizeof(CodecInst));
|
||||
_idISAC16kHz = codecCntr;
|
||||
}
|
||||
if (!STR_CASE_CMP(codecParam.plname, "ISAC") &&
|
||||
if (absl::EqualsIgnoreCase(codecParam.plname, "ISAC") &&
|
||||
codecParam.plfreq == 32000) {
|
||||
memcpy(&_paramISAC32kHz, &codecParam, sizeof(CodecInst));
|
||||
_idISAC32kHz = codecCntr;
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "absl/strings/match.h"
|
||||
#include "modules/audio_coding/include/audio_coding_module.h"
|
||||
#include "test/gtest.h"
|
||||
|
||||
@ -268,7 +268,7 @@ bool FixedPayloadTypeCodec(const char* payloadName) {
|
||||
"G722", "QCELP", "CN", "MPA", "G728", "G729"};
|
||||
|
||||
for (int n = 0; n < NUM_CODECS_WITH_FIXED_PAYLOAD_TYPE; n++) {
|
||||
if (!STR_CASE_CMP(payloadName, fixPayloadTypeCodecs[n])) {
|
||||
if (absl::EqualsIgnoreCase(payloadName, fixPayloadTypeCodecs[n])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user