Don't select audio codecs depending on GN vars build_with_{chromium|mozilla}

BUG=webrtc:8343

Change-Id: I5943006a4da17f72eb88eae9d7ea57574d54f680
Reviewed-on: https://webrtc-review.googlesource.com/9401
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20540}
This commit is contained in:
Karl Wiberg 2017-11-01 15:08:12 +01:00 committed by Commit Bot
parent e0aca5e320
commit eb254b40b3
18 changed files with 34 additions and 135 deletions

View File

@ -43,6 +43,8 @@ rtc_static_library("builtin_audio_decoder_factory") {
"../../rtc_base:rtc_base_approved",
"L16:audio_decoder_L16",
"g711:audio_decoder_g711",
"g722:audio_decoder_g722",
"isac:audio_decoder_isac",
]
defines = []
if (rtc_include_ilbc) {
@ -57,21 +59,6 @@ rtc_static_library("builtin_audio_decoder_factory") {
} else {
defines += [ "WEBRTC_USE_BUILTIN_OPUS=0" ]
}
if (build_with_mozilla) {
defines += [
"WEBRTC_USE_BUILTIN_G722=0",
"WEBRTC_USE_BUILTIN_ISAC=0",
]
} else {
deps += [
"g722:audio_decoder_g722",
"isac:audio_decoder_isac",
]
defines += [
"WEBRTC_USE_BUILTIN_G722=1",
"WEBRTC_USE_BUILTIN_ISAC=1",
]
}
}
rtc_static_library("builtin_audio_encoder_factory") {
@ -84,6 +71,8 @@ rtc_static_library("builtin_audio_encoder_factory") {
"../../rtc_base:rtc_base_approved",
"L16:audio_encoder_L16",
"g711:audio_encoder_g711",
"g722:audio_encoder_g722",
"isac:audio_encoder_isac",
]
defines = []
if (rtc_include_ilbc) {
@ -98,19 +87,4 @@ rtc_static_library("builtin_audio_encoder_factory") {
} else {
defines += [ "WEBRTC_USE_BUILTIN_OPUS=0" ]
}
if (build_with_mozilla) {
defines += [
"WEBRTC_USE_BUILTIN_G722=0",
"WEBRTC_USE_BUILTIN_ISAC=0",
]
} else {
deps += [
"g722:audio_encoder_g722",
"isac:audio_encoder_isac",
]
defines += [
"WEBRTC_USE_BUILTIN_G722=1",
"WEBRTC_USE_BUILTIN_ISAC=1",
]
}
}

View File

@ -16,15 +16,11 @@
#include "api/audio_codecs/L16/audio_decoder_L16.h"
#include "api/audio_codecs/audio_decoder_factory_template.h"
#include "api/audio_codecs/g711/audio_decoder_g711.h"
#if WEBRTC_USE_BUILTIN_G722
#include "api/audio_codecs/g722/audio_decoder_g722.h" // nogncheck
#endif
#include "api/audio_codecs/g722/audio_decoder_g722.h"
#if WEBRTC_USE_BUILTIN_ILBC
#include "api/audio_codecs/ilbc/audio_decoder_ilbc.h" // nogncheck
#endif
#if WEBRTC_USE_BUILTIN_ISAC
#include "api/audio_codecs/isac/audio_decoder_isac.h" // nogncheck
#endif
#include "api/audio_codecs/isac/audio_decoder_isac.h"
#if WEBRTC_USE_BUILTIN_OPUS
#include "api/audio_codecs/opus/audio_decoder_opus.h" // nogncheck
#endif
@ -57,13 +53,7 @@ rtc::scoped_refptr<AudioDecoderFactory> CreateBuiltinAudioDecoderFactory() {
AudioDecoderOpus,
#endif
#if WEBRTC_USE_BUILTIN_ISAC
AudioDecoderIsac,
#endif
#if WEBRTC_USE_BUILTIN_G722
AudioDecoderG722,
#endif
AudioDecoderIsac, AudioDecoderG722,
#if WEBRTC_USE_BUILTIN_ILBC
AudioDecoderIlbc,

View File

@ -16,15 +16,11 @@
#include "api/audio_codecs/L16/audio_encoder_L16.h"
#include "api/audio_codecs/audio_encoder_factory_template.h"
#include "api/audio_codecs/g711/audio_encoder_g711.h"
#if WEBRTC_USE_BUILTIN_G722
#include "api/audio_codecs/g722/audio_encoder_g722.h" // nogncheck
#endif
#include "api/audio_codecs/g722/audio_encoder_g722.h"
#if WEBRTC_USE_BUILTIN_ILBC
#include "api/audio_codecs/ilbc/audio_encoder_ilbc.h" // nogncheck
#endif
#if WEBRTC_USE_BUILTIN_ISAC
#include "api/audio_codecs/isac/audio_encoder_isac.h" // nogncheck
#endif
#include "api/audio_codecs/isac/audio_encoder_isac.h"
#if WEBRTC_USE_BUILTIN_OPUS
#include "api/audio_codecs/opus/audio_encoder_opus.h" // nogncheck
#endif
@ -61,13 +57,7 @@ rtc::scoped_refptr<AudioEncoderFactory> CreateBuiltinAudioEncoderFactory() {
AudioEncoderOpus,
#endif
#if WEBRTC_USE_BUILTIN_ISAC
AudioEncoderIsac,
#endif
#if WEBRTC_USE_BUILTIN_G722
AudioEncoderG722,
#endif
AudioEncoderIsac, AudioEncoderG722,
#if WEBRTC_USE_BUILTIN_ILBC
AudioEncoderIlbc,

View File

@ -22,14 +22,12 @@ if (rtc_include_ilbc) {
if (rtc_include_opus) {
audio_codec_deps += [ ":webrtc_opus" ]
}
if (!build_with_mozilla) {
if (current_cpu == "arm") {
audio_codec_deps += [ ":isac_fix" ]
} else {
audio_codec_deps += [ ":isac" ]
}
audio_codec_deps += [ ":g722" ]
}
if (!build_with_mozilla && !build_with_chromium) {
audio_codec_deps += [ ":red" ]
}

View File

@ -85,12 +85,10 @@ const CodecInst ACMCodecDB::database_[] = {
#ifdef WEBRTC_CODEC_ILBC
{102, "ILBC", 8000, 240, 1, 13300},
#endif
#ifdef WEBRTC_CODEC_G722
// Mono
{9, "G722", 16000, 320, 1, 64000},
// Stereo
{119, "G722", 16000, 320, 2, 64000},
#endif
#ifdef WEBRTC_CODEC_OPUS
// Opus internally supports 48, 24, 16, 12, 8 kHz.
// Mono and stereo.
@ -143,12 +141,10 @@ const ACMCodecDB::CodecSettings ACMCodecDB::codec_settings_[] = {
#ifdef WEBRTC_CODEC_ILBC
{4, {160, 240, 320, 480}, 0, 1},
#endif
#ifdef WEBRTC_CODEC_G722
// Mono
{6, {160, 320, 480, 640, 800, 960}, 0, 2},
// Stereo
{6, {160, 320, 480, 640, 800, 960}, 0, 2},
#endif
#ifdef WEBRTC_CODEC_OPUS
// Opus supports frames shorter than 10ms,
// but it doesn't help us to use them.
@ -200,12 +196,10 @@ const NetEqDecoder ACMCodecDB::neteq_decoders_[] = {
#ifdef WEBRTC_CODEC_ILBC
NetEqDecoder::kDecoderILBC,
#endif
#ifdef WEBRTC_CODEC_G722
// Mono
NetEqDecoder::kDecoderG722,
// Stereo
NetEqDecoder::kDecoderG722_2ch,
#endif
#ifdef WEBRTC_CODEC_OPUS
// Mono and stereo.
NetEqDecoder::kDecoderOpus,

View File

@ -980,7 +980,7 @@ class AcmReceiverBitExactnessOldApi : public ::testing::Test {
};
#if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) && \
defined(WEBRTC_CODEC_ILBC) && defined(WEBRTC_CODEC_G722)
defined(WEBRTC_CODEC_ILBC)
TEST_F(AcmReceiverBitExactnessOldApi, 8kHzOutput) {
Run(8000, PlatformChecksum("2adede965c6f87de7142c51552111d08",
"028c0fc414b1c9ab7e582dccdf381e98",
@ -1438,7 +1438,6 @@ TEST_F(AcmSenderBitExactnessOldApi, MAYBE_Ilbc_30ms) {
#else
#define MAYBE_G722_20ms G722_20ms
#endif
#if defined(WEBRTC_CODEC_G722)
TEST_F(AcmSenderBitExactnessOldApi, MAYBE_G722_20ms) {
ASSERT_NO_FATAL_FAILURE(SetUpTest("G722", 16000, 1, 9, 320, 160));
Run(AcmReceiverBitExactnessOldApi::PlatformChecksum(
@ -1451,14 +1450,12 @@ TEST_F(AcmSenderBitExactnessOldApi, MAYBE_G722_20ms) {
"android_arm64_payload", "android_arm64_clang_payload"),
50, test::AcmReceiveTestOldApi::kMonoOutput);
}
#endif
#if defined(WEBRTC_ANDROID)
#define MAYBE_G722_stereo_20ms DISABLED_G722_stereo_20ms
#else
#define MAYBE_G722_stereo_20ms G722_stereo_20ms
#endif
#if defined(WEBRTC_CODEC_G722)
TEST_F(AcmSenderBitExactnessOldApi, MAYBE_G722_stereo_20ms) {
ASSERT_NO_FATAL_FAILURE(SetUpTest("G722", 16000, 2, 119, 320, 160));
Run(AcmReceiverBitExactnessOldApi::PlatformChecksum(
@ -1471,7 +1468,6 @@ TEST_F(AcmSenderBitExactnessOldApi, MAYBE_G722_stereo_20ms) {
"android_arm64_payload", "android_arm64_clang_payload"),
50, test::AcmReceiveTestOldApi::kStereoOutput);
}
#endif
TEST_F(AcmSenderBitExactnessOldApi, Opus_stereo_20ms) {
ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 2, 120, 960, 960));

View File

@ -16,9 +16,7 @@
#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"
#ifdef WEBRTC_CODEC_G722
#include "modules/audio_coding/codecs/g722/audio_encoder_g722.h"
#endif
#ifdef WEBRTC_CODEC_ILBC
#include "modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.h"
#endif
@ -175,10 +173,8 @@ std::unique_ptr<AudioEncoder> CreateEncoder(
if (STR_CASE_CMP(speech_inst.plname, "ilbc") == 0)
return std::unique_ptr<AudioEncoder>(new AudioEncoderIlbcImpl(speech_inst));
#endif
#ifdef WEBRTC_CODEC_G722
if (STR_CASE_CMP(speech_inst.plname, "g722") == 0)
return std::unique_ptr<AudioEncoder>(new AudioEncoderG722Impl(speech_inst));
#endif
LOG_F(LS_ERROR) << "Could not create encoder of type " << speech_inst.plname;
return std::unique_ptr<AudioEncoder>();
}

View File

@ -58,10 +58,8 @@ class RentACodec {
#ifdef WEBRTC_CODEC_ILBC
kILBC,
#endif
#ifdef WEBRTC_CODEC_G722
kG722, // Mono
kG722_2ch, // Stereo
#endif
#ifdef WEBRTC_CODEC_OPUS
kOpus, // Mono and stereo
#endif
@ -92,10 +90,6 @@ class RentACodec {
#ifndef WEBRTC_CODEC_ILBC
kILBC = -1,
#endif
#ifndef WEBRTC_CODEC_G722
kG722 = -1, // Mono
kG722_2ch = -1, // Stereo
#endif
#ifndef WEBRTC_CODEC_OPUS
kOpus = -1, // Mono and stereo
#endif

View File

@ -20,14 +20,11 @@ if (rtc_opus_support_120ms_ptime) {
} else {
audio_codec_defines += [ "WEBRTC_OPUS_SUPPORT_120MS_PTIME=0" ]
}
if (!build_with_mozilla) {
if (current_cpu == "arm") {
audio_codec_defines += [ "WEBRTC_CODEC_ISACFX" ]
} else {
audio_codec_defines += [ "WEBRTC_CODEC_ISAC" ]
}
audio_codec_defines += [ "WEBRTC_CODEC_G722" ]
}
if (!build_with_mozilla && !build_with_chromium) {
audio_codec_defines += [ "WEBRTC_CODEC_RED" ]
}

View File

@ -131,9 +131,7 @@ TEST(BuiltinAudioEncoderFactoryTest, SupportsTheExpectedFormats) {
#ifdef WEBRTC_CODEC_ISAC
{"isac", 32000, 1},
#endif
#ifdef WEBRTC_CODEC_G722
{"G722", 8000, 1},
#endif
#ifdef WEBRTC_CODEC_ILBC
{"ilbc", 8000, 1},
#endif

View File

@ -450,8 +450,7 @@ void NetEqDecodingTest::PopulateCng(int frame_index,
#if !defined(WEBRTC_IOS) && defined(WEBRTC_NETEQ_UNITTEST_BITEXACT) && \
(defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) && \
defined(WEBRTC_CODEC_ILBC) && defined(WEBRTC_CODEC_G722) && \
!defined(WEBRTC_ARCH_ARM64)
defined(WEBRTC_CODEC_ILBC) && !defined(WEBRTC_ARCH_ARM64)
#define MAYBE_TestBitExactness TestBitExactness
#else
#define MAYBE_TestBitExactness DISABLED_TestBitExactness

View File

@ -151,7 +151,6 @@ void TestAllCodecs::Perform() {
// All codecs are tested for all allowed sampling frequencies, rates and
// packet sizes.
#ifdef WEBRTC_CODEC_G722
if (test_mode_ != 0) {
printf("===============================================================\n");
}
@ -171,7 +170,6 @@ void TestAllCodecs::Perform() {
RegisterSendCodec('A', codec_g722, 16000, 64000, 960, 0);
Run(channel_a_to_b_);
outfile_b_.Close();
#endif
#ifdef WEBRTC_CODEC_ILBC
if (test_mode_ != 0) {
printf("===============================================================\n");
@ -324,9 +322,6 @@ void TestAllCodecs::Perform() {
/* Print out all codecs that were not tested in the run */
printf("The following codecs was not included in the test:\n");
#ifndef WEBRTC_CODEC_G722
printf(" G.722\n");
#endif
#ifndef WEBRTC_CODEC_ILBC
printf(" iLBC\n");
#endif

View File

@ -38,13 +38,9 @@ namespace {
const char kNamePCMU[] = "PCMU";
const char kNameCN[] = "CN";
const char kNameRED[] = "RED";
// These three are only used by code #ifdeffed on WEBRTC_CODEC_G722.
#ifdef WEBRTC_CODEC_G722
const char kNameISAC[] = "ISAC";
const char kNameG722[] = "G722";
const char kNameOPUS[] = "opus";
#endif
}
TestRedFec::TestRedFec()
@ -104,11 +100,6 @@ void TestRedFec::Perform() {
Run();
_outFileB.Close();
#ifndef WEBRTC_CODEC_G722
EXPECT_TRUE(false);
printf("G722 needs to be activated to run this test\n");
return;
#else
EXPECT_EQ(0, RegisterSendCodec('A', kNameG722, 16000));
EXPECT_EQ(0, RegisterSendCodec('A', kNameCN, 16000));
@ -412,8 +403,6 @@ void TestRedFec::Perform() {
EXPECT_FALSE(_acmA->REDStatus());
EXPECT_EQ(0, _acmA->SetCodecFEC(false));
EXPECT_FALSE(_acmA->CodecFEC());
#endif // defined(WEBRTC_CODEC_G722)
}
int32_t TestRedFec::SetVAD(bool enableDTX, bool enableVAD, ACMVADMode vadMode) {

View File

@ -114,13 +114,11 @@ TestStereo::TestStereo(int test_mode)
test_cntr_(0),
pack_size_samp_(0),
pack_size_bytes_(0),
counter_(0)
#ifdef WEBRTC_CODEC_G722
, g722_pltype_(0)
#endif
, l16_8khz_pltype_(-1)
, l16_16khz_pltype_(-1)
, l16_32khz_pltype_(-1)
counter_(0),
g722_pltype_(0),
l16_8khz_pltype_(-1),
l16_16khz_pltype_(-1),
l16_32khz_pltype_(-1)
#ifdef PCMA_AND_PCMU
, pcma_pltype_(-1)
, pcmu_pltype_(-1)
@ -217,7 +215,6 @@ void TestStereo::Perform() {
// All codecs are tested for all allowed sampling frequencies, rates and
// packet sizes.
#ifdef WEBRTC_CODEC_G722
if (test_mode_ != 0) {
printf("===========================================================\n");
printf("Test number: %d\n", test_cntr_ + 1);
@ -246,7 +243,7 @@ void TestStereo::Perform() {
g722_pltype_);
Run(channel_a2b_, audio_channels, codec_channels);
out_file_.Close();
#endif
if (test_mode_ != 0) {
printf("===========================================================\n");
printf("Test number: %d\n", test_cntr_ + 1);
@ -419,7 +416,6 @@ void TestStereo::Perform() {
audio_channels = 1;
codec_channels = 2;
#ifdef WEBRTC_CODEC_G722
if (test_mode_ != 0) {
printf("===============================================================\n");
printf("Test number: %d\n", test_cntr_ + 1);
@ -432,7 +428,7 @@ void TestStereo::Perform() {
g722_pltype_);
Run(channel_a2b_, audio_channels, codec_channels);
out_file_.Close();
#endif
if (test_mode_ != 0) {
printf("===============================================================\n");
printf("Test number: %d\n", test_cntr_ + 1);
@ -512,7 +508,6 @@ void TestStereo::Perform() {
codec_channels = 1;
channel_a2b_->set_codec_mode(kMono);
#ifdef WEBRTC_CODEC_G722
// Run stereo audio and mono codec.
if (test_mode_ != 0) {
printf("===============================================================\n");
@ -533,7 +528,7 @@ void TestStereo::Perform() {
EXPECT_EQ(0, acm_a_->SetVAD(false, false, VADNormal));
Run(channel_a2b_, audio_channels, codec_channels);
out_file_.Close();
#endif
if (test_mode_ != 0) {
printf("===============================================================\n");
printf("Test number: %d\n", test_cntr_ + 1);
@ -659,9 +654,7 @@ void TestStereo::Perform() {
// Print out which codecs were tested, and which were not, in the run.
if (test_mode_ != 0) {
printf("\nThe following codecs was INCLUDED in the test:\n");
#ifdef WEBRTC_CODEC_G722
printf(" G.722\n");
#endif
printf(" PCM16\n");
printf(" G.711\n");
#ifdef WEBRTC_CODEC_OPUS

View File

@ -98,9 +98,7 @@ class TestStereo : public ACMTest {
char* send_codec_name_;
// Payload types for stereo codecs and CNG
#ifdef WEBRTC_CODEC_G722
int g722_pltype_;
#endif
int l16_8khz_pltype_;
int l16_16khz_pltype_;
int l16_32khz_pltype_;

View File

@ -63,7 +63,7 @@ TEST(AudioCodingModuleTest, TestIsac) {
#endif
#if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) && \
defined(WEBRTC_CODEC_ILBC) && defined(WEBRTC_CODEC_G722)
defined(WEBRTC_CODEC_ILBC)
#if defined(WEBRTC_ANDROID)
TEST(AudioCodingModuleTest, DISABLED_TwoWayCommunication) {
#else

View File

@ -1388,12 +1388,10 @@ int32_t ModuleFileUtility::set_codec_info(const CodecInst& codecInst)
}
}
#endif
#ifdef WEBRTC_CODEC_G722
else if(STR_CASE_CMP(codecInst.plname, "G722") == 0)
{
_codecId = kCodecG722;
}
#endif
if(_codecId == kCodecNoCodec)
{
return -1;

View File

@ -33,6 +33,9 @@ if (is_ios) {
}
declare_args() {
# Include the iLBC audio codec?
rtc_include_ilbc = true
# Disable this to avoid building the Opus audio codec.
rtc_include_opus = true
@ -173,9 +176,6 @@ declare_args() {
# depend on the possibly overridden variables in the first
# declare_args block.
declare_args() {
# Include the iLBC audio codec?
rtc_include_ilbc = !(build_with_chromium || build_with_mozilla)
rtc_restrict_logging = build_with_chromium
# Excluded in Chromium since its prerequisites don't require Pulse Audio.