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:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user