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

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

Cr-Commit-Position: refs/heads/master@{#10046}
This commit is contained in:
kwiberg
2015-09-24 03:18:40 -07:00
committed by Commit bot
parent 61e933eac7
commit f66a925142
8 changed files with 98 additions and 62 deletions

View File

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