Revert of Don't link with audio codecs that we don't use (patchset #4 id:60001 of https://codereview.webrtc.org/1349393003/ )

Reason for revert:
Breaking Chromium FYI bots.

Original issue's description:
> Don't link with audio codecs that we don't use
>
> We used to link with all audio codecs unconditionally (except Opus);
> this patch makes gyp and gn only link to the ones that are used.
>
> (This unfortunately fails to have a measurable impact on Chromium
> binary size, at least on x86_64 Linux; it turns out that iLBC and iSAC
> fix were already being excluded from Chromium by some other means
> (likely just the linker omitting compilation units with no incoming
> references).)
>
> BUG=webrtc:4557
>
> Committed: https://crrev.com/f66a9251424351ea6d631c54dd1feb64cc13d809
> Cr-Commit-Position: refs/heads/master@{#10046}

TBR=henrik.lundin@webrtc.org,tina.legrand@webrtc.org,kjellander@webrtc.org,kwiberg@webrtc.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:4557

Review URL: https://codereview.webrtc.org/1368933002

Cr-Commit-Position: refs/heads/master@{#10069}
This commit is contained in:
solenberg
2015-09-25 01:36:02 -07:00
committed by Commit bot
parent a53e383d7d
commit 3fd7be4cb1
8 changed files with 62 additions and 98 deletions

View File

@ -42,13 +42,9 @@
'webrtc_vp9_dir%': '<(webrtc_root)/modules/video_coding/codecs/vp9', 'webrtc_vp9_dir%': '<(webrtc_root)/modules/video_coding/codecs/vp9',
'include_opus%': 1, 'include_opus%': 1,
'opus_dir%': '<(DEPTH)/third_party/opus', 'opus_dir%': '<(DEPTH)/third_party/opus',
# Enable to use the Mozilla internal settings.
'build_with_mozilla%': 0,
}, },
'build_with_chromium%': '<(build_with_chromium)', 'build_with_chromium%': '<(build_with_chromium)',
'build_with_libjingle%': '<(build_with_libjingle)', 'build_with_libjingle%': '<(build_with_libjingle)',
'build_with_mozilla%': '<(build_with_mozilla)',
'webrtc_root%': '<(webrtc_root)', 'webrtc_root%': '<(webrtc_root)',
'apk_tests_path%': '<(apk_tests_path)', 'apk_tests_path%': '<(apk_tests_path)',
'modules_java_gyp_path%': '<(modules_java_gyp_path)', 'modules_java_gyp_path%': '<(modules_java_gyp_path)',
@ -102,6 +98,9 @@
# Disable by default # Disable by default
'have_dbus_glib%': 0, 'have_dbus_glib%': 0,
# Enable to use the Mozilla internal settings.
'build_with_mozilla%': 0,
# Make it possible to provide custom locations for some libraries. # Make it possible to provide custom locations for some libraries.
'libvpx_dir%': '<(DEPTH)/third_party/libvpx', 'libvpx_dir%': '<(DEPTH)/third_party/libvpx',
'libyuv_dir%': '<(DEPTH)/third_party/libyuv', 'libyuv_dir%': '<(DEPTH)/third_party/libyuv',

View File

@ -17,6 +17,27 @@
// Voice and Video // Voice and Video
// ============================================================================ // ============================================================================
// ----------------------------------------------------------------------------
// [Voice] Codec settings
// ----------------------------------------------------------------------------
// iSAC and G722 are not included in the Mozilla build, but in all other builds.
#ifndef WEBRTC_MOZILLA_BUILD
#ifdef WEBRTC_ARCH_ARM
#define WEBRTC_CODEC_ISACFX // Fix-point iSAC implementation.
#else
#define WEBRTC_CODEC_ISAC // Floating-point iSAC implementation (default).
#endif // WEBRTC_ARCH_ARM
#define WEBRTC_CODEC_G722
#endif // !WEBRTC_MOZILLA_BUILD
// iLBC and Redundancy coding are excluded from Chromium and Mozilla
// builds to reduce binary size.
#if !defined(WEBRTC_CHROMIUM_BUILD) && !defined(WEBRTC_MOZILLA_BUILD)
#define WEBRTC_CODEC_ILBC
#define WEBRTC_CODEC_RED
#endif // !WEBRTC_CHROMIUM_BUILD && !WEBRTC_MOZILLA_BUILD
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// [Video] Codec settings // [Video] Codec settings
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@ -67,8 +67,13 @@ source_set("audio_coding") {
deps = [ deps = [
":cng", ":cng",
":g711", ":g711",
":g722",
":ilbc",
":isac",
":isac_fix",
":neteq", ":neteq",
":pcm16b", ":pcm16b",
":red",
"../..:rtc_event_log", "../..:rtc_event_log",
"../..:webrtc_common", "../..:webrtc_common",
"../../common_audio", "../../common_audio",
@ -79,27 +84,6 @@ source_set("audio_coding") {
defines += [ "WEBRTC_CODEC_OPUS" ] defines += [ "WEBRTC_CODEC_OPUS" ]
deps += [ ":webrtc_opus" ] deps += [ ":webrtc_opus" ]
} }
if (!build_with_mozilla) {
if (current_cpu == "arm") {
defines += [ "WEBRTC_CODEC_ISACFX" ]
deps += [ ":isac_fix" ]
} else {
defines += [ "WEBRTC_CODEC_ISAC" ]
deps += [ ":isac" ]
}
defines += [ "WEBRTC_CODEC_G722" ]
deps += [ ":g722" ]
}
if (!build_with_mozilla && !build_with_chromium) {
defines += [
"WEBRTC_CODEC_ILBC",
"WEBRTC_CODEC_RED",
]
deps += [
":ilbc",
":red",
]
}
} }
source_set("audio_decoder_interface") { source_set("audio_decoder_interface") {
@ -804,6 +788,10 @@ source_set("neteq") {
":audio_decoder_interface", ":audio_decoder_interface",
":cng", ":cng",
":g711", ":g711",
":g722",
":ilbc",
":isac",
":isac_fix",
":pcm16b", ":pcm16b",
"../..:webrtc_common", "../..:webrtc_common",
"../../common_audio", "../../common_audio",
@ -816,19 +804,4 @@ source_set("neteq") {
defines += [ "WEBRTC_CODEC_OPUS" ] defines += [ "WEBRTC_CODEC_OPUS" ]
deps += [ ":webrtc_opus" ] deps += [ ":webrtc_opus" ]
} }
if (!build_with_mozilla) {
if (current_cpu == "arm") {
defines += [ "WEBRTC_CODEC_ISACFX" ]
deps += [ ":isac_fix" ]
} else {
defines += [ "WEBRTC_CODEC_ISAC" ]
deps += [ ":isac" ]
}
defines += [ "WEBRTC_CODEC_G722" ]
deps += [ ":g722" ]
}
if (!build_with_mozilla && !build_with_chromium) {
defines += [ "WEBRTC_CODEC_ILBC" ]
deps += [ ":ilbc" ]
}
} }

View File

@ -135,18 +135,15 @@ rtc::scoped_ptr<AudioEncoder> CreateSpeechEncoder(
AudioEncoder* CreateRedEncoder(int red_payload_type, AudioEncoder* CreateRedEncoder(int red_payload_type,
AudioEncoder* encoder, AudioEncoder* encoder,
rtc::scoped_ptr<AudioEncoder>* red_encoder) { rtc::scoped_ptr<AudioEncoder>* red_encoder) {
#ifdef WEBRTC_CODEC_RED if (red_payload_type == -1) {
if (red_payload_type != -1) { red_encoder->reset();
return encoder;
}
AudioEncoderCopyRed::Config config; AudioEncoderCopyRed::Config config;
config.payload_type = red_payload_type; config.payload_type = red_payload_type;
config.speech_encoder = encoder; config.speech_encoder = encoder;
red_encoder->reset(new AudioEncoderCopyRed(config)); red_encoder->reset(new AudioEncoderCopyRed(config));
return red_encoder->get(); return red_encoder->get();
}
#endif
red_encoder->reset();
return encoder;
} }
void CreateCngEncoder(int cng_payload_type, void CreateCngEncoder(int cng_payload_type,

View File

@ -11,7 +11,12 @@
'audio_coding_dependencies': [ 'audio_coding_dependencies': [
'cng', 'cng',
'g711', 'g711',
'g722',
'ilbc',
'isac',
'isac_fix',
'pcm16b', 'pcm16b',
'red',
'<(webrtc_root)/common.gyp:webrtc_common', '<(webrtc_root)/common.gyp:webrtc_common',
'<(webrtc_root)/common_audio/common_audio.gyp:common_audio', '<(webrtc_root)/common_audio/common_audio.gyp:common_audio',
'<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers', '<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
@ -22,23 +27,6 @@
'audio_coding_dependencies': ['webrtc_opus',], 'audio_coding_dependencies': ['webrtc_opus',],
'audio_coding_defines': ['WEBRTC_CODEC_OPUS',], 'audio_coding_defines': ['WEBRTC_CODEC_OPUS',],
}], }],
['build_with_mozilla==0', {
'conditions': [
['target_arch=="arm"', {
'audio_coding_dependencies': ['isac_fix',],
'audio_coding_defines': ['WEBRTC_CODEC_ISACFX',],
}, {
'audio_coding_dependencies': ['isac',],
'audio_coding_defines': ['WEBRTC_CODEC_ISAC',],
}],
],
'audio_coding_dependencies': ['g722',],
'audio_coding_defines': ['WEBRTC_CODEC_G722',],
}],
['build_with_mozilla==0 and build_with_chromium==0', {
'audio_coding_dependencies': ['ilbc', 'red',],
'audio_coding_defines': ['WEBRTC_CODEC_ILBC', 'WEBRTC_CODEC_RED',],
}],
], ],
}, },
'targets': [ 'targets': [

View File

@ -13,7 +13,11 @@
#include <assert.h> #include <assert.h>
#ifndef AUDIO_DECODER_UNITTEST
// If this is compiled as a part of the audio_deoder_unittest, the codec
// selection is made in the gypi file instead of in engine_configurations.h.
#include "webrtc/engine_configurations.h" #include "webrtc/engine_configurations.h"
#endif
#include "webrtc/base/constructormagic.h" #include "webrtc/base/constructormagic.h"
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h" #include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
#include "webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h" #include "webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h"

View File

@ -562,6 +562,7 @@ TEST_F(AudioDecoderIsacSwbTest, EncodeDecode) {
int tolerance = 19757; int tolerance = 19757;
double mse = 8.18e6; double mse = 8.18e6;
int delay = 160; // Delay from input to output. int delay = 160; // Delay from input to output.
EXPECT_TRUE(CodecSupported(kDecoderISACswb));
EncodeDecodeTest(0, tolerance, mse, delay); EncodeDecodeTest(0, tolerance, mse, delay);
ReInitTest(); ReInitTest();
EXPECT_FALSE(decoder_->HasDecodePlc()); EXPECT_FALSE(decoder_->HasDecodePlc());
@ -675,10 +676,8 @@ TEST(AudioDecoder, CodecSampleRateHz) {
EXPECT_EQ(8000, CodecSampleRateHz(kDecoderPCMa_2ch)); EXPECT_EQ(8000, CodecSampleRateHz(kDecoderPCMa_2ch));
EXPECT_EQ(8000, CodecSampleRateHz(kDecoderILBC)); EXPECT_EQ(8000, CodecSampleRateHz(kDecoderILBC));
EXPECT_EQ(16000, CodecSampleRateHz(kDecoderISAC)); EXPECT_EQ(16000, CodecSampleRateHz(kDecoderISAC));
#ifndef WEBRTC_ARCH_ARM
EXPECT_EQ(32000, CodecSampleRateHz(kDecoderISACswb)); EXPECT_EQ(32000, CodecSampleRateHz(kDecoderISACswb));
EXPECT_EQ(32000, CodecSampleRateHz(kDecoderISACfb)); EXPECT_EQ(32000, CodecSampleRateHz(kDecoderISACfb));
#endif
EXPECT_EQ(8000, CodecSampleRateHz(kDecoderPCM16B)); EXPECT_EQ(8000, CodecSampleRateHz(kDecoderPCM16B));
EXPECT_EQ(16000, CodecSampleRateHz(kDecoderPCM16Bwb)); EXPECT_EQ(16000, CodecSampleRateHz(kDecoderPCM16Bwb));
EXPECT_EQ(32000, CodecSampleRateHz(kDecoderPCM16Bswb32kHz)); EXPECT_EQ(32000, CodecSampleRateHz(kDecoderPCM16Bswb32kHz));
@ -703,19 +702,14 @@ TEST(AudioDecoder, CodecSampleRateHz) {
} }
TEST(AudioDecoder, CodecSupported) { TEST(AudioDecoder, CodecSupported) {
#ifdef WEBRTC_ARCH_ARM
static const bool has_isac_swb = false;
#else
static const bool has_isac_swb = true;
#endif
EXPECT_TRUE(CodecSupported(kDecoderPCMu)); EXPECT_TRUE(CodecSupported(kDecoderPCMu));
EXPECT_TRUE(CodecSupported(kDecoderPCMa)); EXPECT_TRUE(CodecSupported(kDecoderPCMa));
EXPECT_TRUE(CodecSupported(kDecoderPCMu_2ch)); EXPECT_TRUE(CodecSupported(kDecoderPCMu_2ch));
EXPECT_TRUE(CodecSupported(kDecoderPCMa_2ch)); EXPECT_TRUE(CodecSupported(kDecoderPCMa_2ch));
EXPECT_TRUE(CodecSupported(kDecoderILBC)); EXPECT_TRUE(CodecSupported(kDecoderILBC));
EXPECT_TRUE(CodecSupported(kDecoderISAC)); EXPECT_TRUE(CodecSupported(kDecoderISAC));
EXPECT_EQ(has_isac_swb, CodecSupported(kDecoderISACswb)); EXPECT_TRUE(CodecSupported(kDecoderISACswb));
EXPECT_EQ(has_isac_swb, CodecSupported(kDecoderISACfb)); EXPECT_TRUE(CodecSupported(kDecoderISACfb));
EXPECT_TRUE(CodecSupported(kDecoderPCM16B)); EXPECT_TRUE(CodecSupported(kDecoderPCM16B));
EXPECT_TRUE(CodecSupported(kDecoderPCM16Bwb)); EXPECT_TRUE(CodecSupported(kDecoderPCM16Bwb));
EXPECT_TRUE(CodecSupported(kDecoderPCM16Bswb32kHz)); EXPECT_TRUE(CodecSupported(kDecoderPCM16Bswb32kHz));

View File

@ -11,6 +11,10 @@
'codecs': [ 'codecs': [
'cng', 'cng',
'g711', 'g711',
'g722',
'ilbc',
'isac',
'isac_fix',
'pcm16b', 'pcm16b',
], ],
'neteq_defines': [], 'neteq_defines': [],
@ -19,23 +23,6 @@
'codecs': ['webrtc_opus',], 'codecs': ['webrtc_opus',],
'neteq_defines': ['WEBRTC_CODEC_OPUS',], 'neteq_defines': ['WEBRTC_CODEC_OPUS',],
}], }],
['build_with_mozilla==0', {
'conditions': [
['target_arch=="arm"', {
'codecs': ['isac_fix',],
'neteq_defines': ['WEBRTC_CODEC_ISACFX',],
}, {
'codecs': ['isac',],
'neteq_defines': ['WEBRTC_CODEC_ISAC',],
}],
],
'codecs': ['g722',],
'neteq_defines': ['WEBRTC_CODEC_G722',],
}],
['build_with_mozilla==0 and build_with_chromium==0', {
'codecs': ['ilbc',],
'neteq_defines': ['WEBRTC_CODEC_ILBC',],
}],
], ],
'neteq_dependencies': [ 'neteq_dependencies': [
'<@(codecs)', '<@(codecs)',
@ -133,10 +120,6 @@
'type': '<(gtest_target_type)', 'type': '<(gtest_target_type)',
'dependencies': [ 'dependencies': [
'<@(codecs)', '<@(codecs)',
'g722',
'ilbc',
'isac',
'isac_fix',
'audio_decoder_interface', 'audio_decoder_interface',
'neteq_unittest_tools', 'neteq_unittest_tools',
'<(DEPTH)/testing/gtest.gyp:gtest', '<(DEPTH)/testing/gtest.gyp:gtest',
@ -144,6 +127,11 @@
'<(webrtc_root)/test/test.gyp:test_support_main', '<(webrtc_root)/test/test.gyp:test_support_main',
], ],
'defines': [ 'defines': [
'AUDIO_DECODER_UNITTEST',
'WEBRTC_CODEC_G722',
'WEBRTC_CODEC_ILBC',
'WEBRTC_CODEC_ISACFX',
'WEBRTC_CODEC_ISAC',
'<@(neteq_defines)', '<@(neteq_defines)',
], ],
'sources': [ 'sources': [