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:
4
BUILD.gn
4
BUILD.gn
@ -434,10 +434,6 @@ rtc_source_set("webrtc_common") {
|
||||
"api/video:video_bitrate_allocation",
|
||||
"rtc_base:checks",
|
||||
"rtc_base:deprecation",
|
||||
|
||||
# TODO(nisse): Delete both of these together with STR_CASE_CMP and
|
||||
# STR_NCASE_CMP.
|
||||
"rtc_base:stringutils",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
]
|
||||
|
||||
|
@ -21,12 +21,12 @@ rtc_static_library("audio_encoder_L16") {
|
||||
]
|
||||
deps = [
|
||||
"..:audio_codecs_api",
|
||||
"../../..:webrtc_common",
|
||||
"../../../modules/audio_coding:pcm16b",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base:safe_minmax",
|
||||
"../../../rtc_base/system:rtc_export",
|
||||
"//third_party/abseil-cpp/absl/memory",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
@ -40,11 +40,11 @@ rtc_static_library("audio_decoder_L16") {
|
||||
]
|
||||
deps = [
|
||||
"..:audio_codecs_api",
|
||||
"../../..:webrtc_common",
|
||||
"../../../modules/audio_coding:pcm16b",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base/system:rtc_export",
|
||||
"//third_party/abseil-cpp/absl/memory",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "api/audio_codecs/L16/audio_decoder_L16.h"
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "absl/strings/match.h"
|
||||
#include "modules/audio_coding/codecs/pcm16b/audio_decoder_pcm16b.h"
|
||||
#include "modules/audio_coding/codecs/pcm16b/pcm16b_common.h"
|
||||
#include "rtc_base/numerics/safe_conversions.h"
|
||||
@ -23,7 +23,7 @@ absl::optional<AudioDecoderL16::Config> AudioDecoderL16::SdpToConfig(
|
||||
Config config;
|
||||
config.sample_rate_hz = format.clockrate_hz;
|
||||
config.num_channels = rtc::checked_cast<int>(format.num_channels);
|
||||
return STR_CASE_CMP(format.name.c_str(), "L16") == 0 && config.IsOk()
|
||||
return absl::EqualsIgnoreCase(format.name, "L16") && config.IsOk()
|
||||
? absl::optional<Config>(config)
|
||||
: absl::nullopt;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "api/audio_codecs/L16/audio_encoder_L16.h"
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "absl/strings/match.h"
|
||||
#include "modules/audio_coding/codecs/pcm16b/audio_encoder_pcm16b.h"
|
||||
#include "modules/audio_coding/codecs/pcm16b/pcm16b_common.h"
|
||||
#include "rtc_base/numerics/safe_conversions.h"
|
||||
@ -35,7 +35,7 @@ absl::optional<AudioEncoderL16::Config> AudioEncoderL16::SdpToConfig(
|
||||
config.frame_size_ms = rtc::SafeClamp(10 * (*ptime / 10), 10, 60);
|
||||
}
|
||||
}
|
||||
return STR_CASE_CMP(format.name.c_str(), "L16") == 0 && config.IsOk()
|
||||
return absl::EqualsIgnoreCase(format.name, "L16") && config.IsOk()
|
||||
? absl::optional<Config>(config)
|
||||
: absl::nullopt;
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "absl/strings/match.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -32,7 +32,7 @@ SdpAudioFormat::SdpAudioFormat(absl::string_view name,
|
||||
parameters(param) {}
|
||||
|
||||
bool SdpAudioFormat::Matches(const SdpAudioFormat& o) const {
|
||||
return STR_CASE_CMP(name.c_str(), o.name.c_str()) == 0 &&
|
||||
return absl::EqualsIgnoreCase(name, o.name) &&
|
||||
clockrate_hz == o.clockrate_hz && num_channels == o.num_channels;
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ SdpAudioFormat& SdpAudioFormat::operator=(const SdpAudioFormat&) = default;
|
||||
SdpAudioFormat& SdpAudioFormat::operator=(SdpAudioFormat&&) = default;
|
||||
|
||||
bool operator==(const SdpAudioFormat& a, const SdpAudioFormat& b) {
|
||||
return STR_CASE_CMP(a.name.c_str(), b.name.c_str()) == 0 &&
|
||||
return absl::EqualsIgnoreCase(a.name, b.name) &&
|
||||
a.clockrate_hz == b.clockrate_hz && a.num_channels == b.num_channels &&
|
||||
a.parameters == b.parameters;
|
||||
}
|
||||
|
@ -21,12 +21,12 @@ rtc_static_library("audio_encoder_g711") {
|
||||
]
|
||||
deps = [
|
||||
"..:audio_codecs_api",
|
||||
"../../..:webrtc_common",
|
||||
"../../../modules/audio_coding:g711",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base:safe_minmax",
|
||||
"../../../rtc_base/system:rtc_export",
|
||||
"//third_party/abseil-cpp/absl/memory",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
@ -40,11 +40,11 @@ rtc_static_library("audio_decoder_g711") {
|
||||
]
|
||||
deps = [
|
||||
"..:audio_codecs_api",
|
||||
"../../..:webrtc_common",
|
||||
"../../../modules/audio_coding:g711",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base/system:rtc_export",
|
||||
"//third_party/abseil-cpp/absl/memory",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "absl/strings/match.h"
|
||||
#include "modules/audio_coding/codecs/g711/audio_decoder_pcm.h"
|
||||
#include "rtc_base/numerics/safe_conversions.h"
|
||||
|
||||
@ -22,8 +22,8 @@ namespace webrtc {
|
||||
|
||||
absl::optional<AudioDecoderG711::Config> AudioDecoderG711::SdpToConfig(
|
||||
const SdpAudioFormat& format) {
|
||||
const bool is_pcmu = STR_CASE_CMP(format.name.c_str(), "PCMU") == 0;
|
||||
const bool is_pcma = STR_CASE_CMP(format.name.c_str(), "PCMA") == 0;
|
||||
const bool is_pcmu = absl::EqualsIgnoreCase(format.name, "PCMU");
|
||||
const bool is_pcma = absl::EqualsIgnoreCase(format.name, "PCMA");
|
||||
if (format.clockrate_hz == 8000 && format.num_channels >= 1 &&
|
||||
(is_pcmu || is_pcma)) {
|
||||
Config config;
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "absl/strings/match.h"
|
||||
#include "modules/audio_coding/codecs/g711/audio_encoder_pcm.h"
|
||||
#include "rtc_base/numerics/safe_conversions.h"
|
||||
#include "rtc_base/numerics/safe_minmax.h"
|
||||
@ -24,8 +24,8 @@ namespace webrtc {
|
||||
|
||||
absl::optional<AudioEncoderG711::Config> AudioEncoderG711::SdpToConfig(
|
||||
const SdpAudioFormat& format) {
|
||||
const bool is_pcmu = STR_CASE_CMP(format.name.c_str(), "PCMU") == 0;
|
||||
const bool is_pcma = STR_CASE_CMP(format.name.c_str(), "PCMA") == 0;
|
||||
const bool is_pcmu = absl::EqualsIgnoreCase(format.name, "PCMU");
|
||||
const bool is_pcma = absl::EqualsIgnoreCase(format.name, "PCMA");
|
||||
if (format.clockrate_hz == 8000 && format.num_channels >= 1 &&
|
||||
(is_pcmu || is_pcma)) {
|
||||
Config config;
|
||||
|
@ -29,12 +29,12 @@ rtc_static_library("audio_encoder_g722") {
|
||||
deps = [
|
||||
":audio_encoder_g722_config",
|
||||
"..:audio_codecs_api",
|
||||
"../../..:webrtc_common",
|
||||
"../../../modules/audio_coding:g722",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base:safe_minmax",
|
||||
"../../../rtc_base/system:rtc_export",
|
||||
"//third_party/abseil-cpp/absl/memory",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
@ -48,11 +48,11 @@ rtc_static_library("audio_decoder_g722") {
|
||||
]
|
||||
deps = [
|
||||
"..:audio_codecs_api",
|
||||
"../../..:webrtc_common",
|
||||
"../../../modules/audio_coding:g722",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base/system:rtc_export",
|
||||
"//third_party/abseil-cpp/absl/memory",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "absl/strings/match.h"
|
||||
#include "modules/audio_coding/codecs/g722/audio_decoder_g722.h"
|
||||
#include "rtc_base/numerics/safe_conversions.h"
|
||||
|
||||
@ -22,7 +22,7 @@ namespace webrtc {
|
||||
|
||||
absl::optional<AudioDecoderG722::Config> AudioDecoderG722::SdpToConfig(
|
||||
const SdpAudioFormat& format) {
|
||||
return STR_CASE_CMP(format.name.c_str(), "G722") == 0 &&
|
||||
return absl::EqualsIgnoreCase(format.name, "G722") &&
|
||||
format.clockrate_hz == 8000 &&
|
||||
(format.num_channels == 1 || format.num_channels == 2)
|
||||
? absl::optional<Config>(
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "absl/strings/match.h"
|
||||
#include "modules/audio_coding/codecs/g722/audio_encoder_g722.h"
|
||||
#include "rtc_base/numerics/safe_conversions.h"
|
||||
#include "rtc_base/numerics/safe_minmax.h"
|
||||
@ -24,7 +24,7 @@ namespace webrtc {
|
||||
|
||||
absl::optional<AudioEncoderG722Config> AudioEncoderG722::SdpToConfig(
|
||||
const SdpAudioFormat& format) {
|
||||
if (STR_CASE_CMP(format.name.c_str(), "g722") != 0 ||
|
||||
if (!absl::EqualsIgnoreCase(format.name, "g722") ||
|
||||
format.clockrate_hz != 8000) {
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
@ -29,11 +29,11 @@ rtc_static_library("audio_encoder_ilbc") {
|
||||
deps = [
|
||||
":audio_encoder_ilbc_config",
|
||||
"..:audio_codecs_api",
|
||||
"../../..:webrtc_common",
|
||||
"../../../modules/audio_coding:ilbc",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base:safe_minmax",
|
||||
"//third_party/abseil-cpp/absl/memory",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
@ -47,10 +47,10 @@ rtc_static_library("audio_decoder_ilbc") {
|
||||
]
|
||||
deps = [
|
||||
"..:audio_codecs_api",
|
||||
"../../..:webrtc_common",
|
||||
"../../../modules/audio_coding:ilbc",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"//third_party/abseil-cpp/absl/memory",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
@ -14,14 +14,14 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "absl/strings/match.h"
|
||||
#include "modules/audio_coding/codecs/ilbc/audio_decoder_ilbc.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
absl::optional<AudioDecoderIlbc::Config> AudioDecoderIlbc::SdpToConfig(
|
||||
const SdpAudioFormat& format) {
|
||||
return STR_CASE_CMP(format.name.c_str(), "ILBC") == 0 &&
|
||||
return absl::EqualsIgnoreCase(format.name, "ILBC") &&
|
||||
format.clockrate_hz == 8000 && format.num_channels == 1
|
||||
? absl::optional<Config>(Config())
|
||||
: absl::nullopt;
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "absl/strings/match.h"
|
||||
#include "modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.h"
|
||||
#include "rtc_base/numerics/safe_conversions.h"
|
||||
#include "rtc_base/numerics/safe_minmax.h"
|
||||
@ -40,7 +40,7 @@ int GetIlbcBitrate(int ptime) {
|
||||
|
||||
absl::optional<AudioEncoderIlbcConfig> AudioEncoderIlbc::SdpToConfig(
|
||||
const SdpAudioFormat& format) {
|
||||
if (STR_CASE_CMP(format.name.c_str(), "ILBC") != 0 ||
|
||||
if (!absl::EqualsIgnoreCase(format.name.c_str(), "ILBC") ||
|
||||
format.clockrate_hz != 8000 || format.num_channels != 1) {
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
@ -77,10 +77,10 @@ rtc_static_library("audio_encoder_isac_fix") {
|
||||
]
|
||||
deps = [
|
||||
"..:audio_codecs_api",
|
||||
"../../..:webrtc_common",
|
||||
"../../../modules/audio_coding:isac_fix",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"//third_party/abseil-cpp/absl/memory",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
@ -94,10 +94,10 @@ rtc_static_library("audio_decoder_isac_fix") {
|
||||
]
|
||||
deps = [
|
||||
"..:audio_codecs_api",
|
||||
"../../..:webrtc_common",
|
||||
"../../../modules/audio_coding:isac_fix",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"//third_party/abseil-cpp/absl/memory",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
@ -111,11 +111,11 @@ rtc_static_library("audio_encoder_isac_float") {
|
||||
]
|
||||
deps = [
|
||||
"..:audio_codecs_api",
|
||||
"../../..:webrtc_common",
|
||||
"../../../modules/audio_coding:isac",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base/system:rtc_export",
|
||||
"//third_party/abseil-cpp/absl/memory",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
@ -129,11 +129,11 @@ rtc_static_library("audio_decoder_isac_float") {
|
||||
]
|
||||
deps = [
|
||||
"..:audio_codecs_api",
|
||||
"../../..:webrtc_common",
|
||||
"../../../modules/audio_coding:isac",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base/system:rtc_export",
|
||||
"//third_party/abseil-cpp/absl/memory",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
@ -11,14 +11,14 @@
|
||||
#include "api/audio_codecs/isac/audio_decoder_isac_fix.h"
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "absl/strings/match.h"
|
||||
#include "modules/audio_coding/codecs/isac/fix/include/audio_decoder_isacfix.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
absl::optional<AudioDecoderIsacFix::Config> AudioDecoderIsacFix::SdpToConfig(
|
||||
const SdpAudioFormat& format) {
|
||||
return STR_CASE_CMP(format.name.c_str(), "ISAC") == 0 &&
|
||||
return absl::EqualsIgnoreCase(format.name, "ISAC") &&
|
||||
format.clockrate_hz == 16000 && format.num_channels == 1
|
||||
? absl::optional<Config>(Config())
|
||||
: absl::nullopt;
|
||||
|
@ -11,14 +11,14 @@
|
||||
#include "api/audio_codecs/isac/audio_decoder_isac_float.h"
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "absl/strings/match.h"
|
||||
#include "modules/audio_coding/codecs/isac/main/include/audio_decoder_isac.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
absl::optional<AudioDecoderIsacFloat::Config>
|
||||
AudioDecoderIsacFloat::SdpToConfig(const SdpAudioFormat& format) {
|
||||
if (STR_CASE_CMP(format.name.c_str(), "ISAC") == 0 &&
|
||||
if (absl::EqualsIgnoreCase(format.name, "ISAC") &&
|
||||
(format.clockrate_hz == 16000 || format.clockrate_hz == 32000) &&
|
||||
format.num_channels == 1) {
|
||||
Config config;
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "api/audio_codecs/isac/audio_encoder_isac_fix.h"
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "absl/strings/match.h"
|
||||
#include "modules/audio_coding/codecs/isac/fix/include/audio_encoder_isacfix.h"
|
||||
#include "rtc_base/string_to_number.h"
|
||||
|
||||
@ -19,7 +19,7 @@ namespace webrtc {
|
||||
|
||||
absl::optional<AudioEncoderIsacFix::Config> AudioEncoderIsacFix::SdpToConfig(
|
||||
const SdpAudioFormat& format) {
|
||||
if (STR_CASE_CMP(format.name.c_str(), "ISAC") == 0 &&
|
||||
if (absl::EqualsIgnoreCase(format.name, "ISAC") &&
|
||||
format.clockrate_hz == 16000 && format.num_channels == 1) {
|
||||
Config config;
|
||||
const auto ptime_iter = format.parameters.find("ptime");
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "api/audio_codecs/isac/audio_encoder_isac_float.h"
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "absl/strings/match.h"
|
||||
#include "modules/audio_coding/codecs/isac/main/include/audio_encoder_isac.h"
|
||||
#include "rtc_base/string_to_number.h"
|
||||
|
||||
@ -19,7 +19,7 @@ namespace webrtc {
|
||||
|
||||
absl::optional<AudioEncoderIsacFloat::Config>
|
||||
AudioEncoderIsacFloat::SdpToConfig(const SdpAudioFormat& format) {
|
||||
if (STR_CASE_CMP(format.name.c_str(), "ISAC") == 0 &&
|
||||
if (absl::EqualsIgnoreCase(format.name, "ISAC") &&
|
||||
(format.clockrate_hz == 16000 || format.clockrate_hz == 32000) &&
|
||||
format.num_channels == 1) {
|
||||
Config config;
|
||||
|
@ -46,6 +46,7 @@ rtc_source_set("audio_encoder_opus") {
|
||||
"../../../modules/audio_coding:webrtc_opus",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base/system:rtc_export",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
@ -59,11 +60,11 @@ rtc_static_library("audio_decoder_opus") {
|
||||
]
|
||||
deps = [
|
||||
"..:audio_codecs_api",
|
||||
"../../..:webrtc_common",
|
||||
"../../../modules/audio_coding:webrtc_opus",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base/system:rtc_export",
|
||||
"//third_party/abseil-cpp/absl/memory",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "absl/strings/match.h"
|
||||
#include "modules/audio_coding/codecs/opus/audio_decoder_opus.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -35,7 +35,7 @@ absl::optional<AudioDecoderOpus::Config> AudioDecoderOpus::SdpToConfig(
|
||||
}
|
||||
return 1; // Default to mono.
|
||||
}();
|
||||
if (STR_CASE_CMP(format.name.c_str(), "opus") == 0 &&
|
||||
if (absl::EqualsIgnoreCase(format.name, "opus") &&
|
||||
format.clockrate_hz == 48000 && format.num_channels == 2 &&
|
||||
num_channels) {
|
||||
return Config{*num_channels};
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
// TODO(nisse): Delete include together with STR_CASE_CMP
|
||||
#include "absl/strings/match.h"
|
||||
#include "api/array_view.h"
|
||||
// TODO(sprang): Remove this include when all usage includes it directly.
|
||||
@ -31,18 +30,6 @@
|
||||
|
||||
#define RTP_PAYLOAD_NAME_SIZE 32u
|
||||
|
||||
// Compares two strings without regard to case.
|
||||
// TODO(nisse): Delete, implementation using EqualsIgnoreCase is misleading
|
||||
// since this can't be used for sorting.
|
||||
#define STR_CASE_CMP(s1, s2) (absl::EqualsIgnoreCase(s1, s2) ? 0 : 1)
|
||||
|
||||
#if defined(WEBRTC_WIN) || defined(WIN32)
|
||||
// Compares characters of two strings without regard to case.
|
||||
#define STR_NCASE_CMP(s1, s2, n) ::_strnicmp(s1, s2, n)
|
||||
#else
|
||||
#define STR_NCASE_CMP(s1, s2, n) ::strncasecmp(s1, s2, n)
|
||||
#endif
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
enum FrameType {
|
||||
@ -210,7 +197,7 @@ struct CodecInst {
|
||||
|
||||
bool operator==(const CodecInst& other) const {
|
||||
return pltype == other.pltype &&
|
||||
(STR_CASE_CMP(plname, other.plname) == 0) &&
|
||||
absl::EqualsIgnoreCase(plname, other.plname) &&
|
||||
plfreq == other.plfreq && pacsize == other.pacsize &&
|
||||
channels == other.channels && rate == other.rate;
|
||||
}
|
||||
|
@ -968,7 +968,7 @@ class WebRtcVoiceMediaChannel::WebRtcAudioSendStream
|
||||
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
|
||||
const bool is_opus =
|
||||
config_.send_codec_spec &&
|
||||
!STR_CASE_CMP(config_.send_codec_spec->format.name.c_str(),
|
||||
absl::EqualsIgnoreCase(config_.send_codec_spec->format.name,
|
||||
kOpusCodecName);
|
||||
if (is_opus && webrtc::field_trial::IsEnabled("WebRTC-Audio-SendSideBwe")) {
|
||||
config_.min_bitrate_bps = kOpusMinBitrateBps;
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/strings/match.h"
|
||||
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
||||
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
|
||||
#include "api/rtpparameters.h"
|
||||
@ -3467,7 +3468,7 @@ TEST(WebRtcVoiceEngineTest, HasCorrectPayloadTypeMapping) {
|
||||
engine.Init();
|
||||
for (const cricket::AudioCodec& codec : engine.send_codecs()) {
|
||||
auto is_codec = [&codec](const char* name, int clockrate = 0) {
|
||||
return STR_CASE_CMP(codec.name.c_str(), name) == 0 &&
|
||||
return absl::EqualsIgnoreCase(codec.name, name) &&
|
||||
(clockrate == 0 || codec.clockrate == clockrate);
|
||||
};
|
||||
if (is_codec("CN", 16000)) {
|
||||
@ -3616,7 +3617,7 @@ TEST(WebRtcVoiceEngineTest, CollectRecvCodecs) {
|
||||
auto find_codec = [&codecs](const webrtc::SdpAudioFormat& format) -> int {
|
||||
for (size_t i = 0; i != codecs.size(); ++i) {
|
||||
const cricket::AudioCodec& codec = codecs[i];
|
||||
if (STR_CASE_CMP(codec.name.c_str(), format.name.c_str()) == 0 &&
|
||||
if (absl::EqualsIgnoreCase(codec.name, format.name) &&
|
||||
codec.clockrate == format.clockrate_hz &&
|
||||
codec.channels == format.num_channels) {
|
||||
return rtc::checked_cast<int>(i);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -18,9 +18,9 @@
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/strings/match.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/cryptoparams.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "media/base/h264_profile_level_id.h"
|
||||
#include "media/base/mediaconstants.h"
|
||||
#include "p2p/base/p2pconstants.h"
|
||||
@ -653,7 +653,7 @@ static bool ContainsRtxCodec(const std::vector<C>& codecs) {
|
||||
|
||||
template <class C>
|
||||
static bool IsRtxCodec(const C& codec) {
|
||||
return STR_CASE_CMP(codec.name.c_str(), kRtxCodecName) == 0;
|
||||
return absl::EqualsIgnoreCase(codec.name, kRtxCodecName);
|
||||
}
|
||||
|
||||
template <class C>
|
||||
@ -668,7 +668,7 @@ static bool ContainsFlexfecCodec(const std::vector<C>& codecs) {
|
||||
|
||||
template <class C>
|
||||
static bool IsFlexfecCodec(const C& codec) {
|
||||
return STR_CASE_CMP(codec.name.c_str(), kFlexfecCodecName) == 0;
|
||||
return absl::EqualsIgnoreCase(codec.name, kFlexfecCodecName);
|
||||
}
|
||||
|
||||
// Create a media content to be offered for the given |sender_options|,
|
||||
@ -1041,9 +1041,8 @@ static void NegotiateRtpHeaderExtensions(
|
||||
static void StripCNCodecs(AudioCodecs* audio_codecs) {
|
||||
audio_codecs->erase(std::remove_if(audio_codecs->begin(), audio_codecs->end(),
|
||||
[](const AudioCodec& codec) {
|
||||
return STR_CASE_CMP(
|
||||
codec.name.c_str(),
|
||||
kComfortNoiseCodecName) == 0;
|
||||
return absl::EqualsIgnoreCase(
|
||||
codec.name, kComfortNoiseCodecName);
|
||||
}),
|
||||
audio_codecs->end());
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <memory>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/match.h"
|
||||
#include "api/audio_codecs/L16/audio_decoder_L16.h"
|
||||
#include "api/audio_codecs/L16/audio_encoder_L16.h"
|
||||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||
@ -299,7 +300,7 @@ CreateForwardingMockDecoderFactory(
|
||||
struct AudioEncoderUnicornSparklesRainbow {
|
||||
using Config = webrtc::AudioEncoderL16::Config;
|
||||
static absl::optional<Config> SdpToConfig(webrtc::SdpAudioFormat format) {
|
||||
if (STR_CASE_CMP(format.name.c_str(), "UnicornSparklesRainbow") == 0) {
|
||||
if (absl::EqualsIgnoreCase(format.name, "UnicornSparklesRainbow")) {
|
||||
const webrtc::SdpAudioFormat::Parameters expected_params = {
|
||||
{"num_horns", "1"}};
|
||||
EXPECT_EQ(expected_params, format.parameters);
|
||||
@ -336,7 +337,7 @@ struct AudioEncoderUnicornSparklesRainbow {
|
||||
struct AudioDecoderUnicornSparklesRainbow {
|
||||
using Config = webrtc::AudioDecoderL16::Config;
|
||||
static absl::optional<Config> SdpToConfig(webrtc::SdpAudioFormat format) {
|
||||
if (STR_CASE_CMP(format.name.c_str(), "UnicornSparklesRainbow") == 0) {
|
||||
if (absl::EqualsIgnoreCase(format.name, "UnicornSparklesRainbow")) {
|
||||
const webrtc::SdpAudioFormat::Parameters expected_params = {
|
||||
{"num_horns", "1"}};
|
||||
EXPECT_EQ(expected_params, format.parameters);
|
||||
|
Reference in New Issue
Block a user