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. (This was previously landed as revisions 10046 and 10060, and got reverted because it broke several of the Chromium FYI bots.) BUG=webrtc:4557 Review URL: https://codereview.webrtc.org/1368843003 Cr-Commit-Position: refs/heads/master@{#10127}
This commit is contained in:
@ -42,9 +42,13 @@
|
||||
'webrtc_vp9_dir%': '<(webrtc_root)/modules/video_coding/codecs/vp9',
|
||||
'include_opus%': 1,
|
||||
'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_libjingle%': '<(build_with_libjingle)',
|
||||
'build_with_mozilla%': '<(build_with_mozilla)',
|
||||
'webrtc_root%': '<(webrtc_root)',
|
||||
'apk_tests_path%': '<(apk_tests_path)',
|
||||
'modules_java_gyp_path%': '<(modules_java_gyp_path)',
|
||||
@ -98,9 +102,6 @@
|
||||
# Disable by default
|
||||
'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.
|
||||
'libvpx_dir%': '<(DEPTH)/third_party/libvpx_new',
|
||||
'libyuv_dir%': '<(DEPTH)/third_party/libyuv',
|
||||
|
||||
@ -17,27 +17,6 @@
|
||||
// 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
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@ -67,13 +67,8 @@ source_set("audio_coding") {
|
||||
deps = [
|
||||
":cng",
|
||||
":g711",
|
||||
":g722",
|
||||
":ilbc",
|
||||
":isac",
|
||||
":isac_fix",
|
||||
":neteq",
|
||||
":pcm16b",
|
||||
":red",
|
||||
"../..:rtc_event_log",
|
||||
"../..:webrtc_common",
|
||||
"../../common_audio",
|
||||
@ -84,6 +79,27 @@ source_set("audio_coding") {
|
||||
defines += [ "WEBRTC_CODEC_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") {
|
||||
@ -789,10 +805,6 @@ source_set("neteq") {
|
||||
":audio_decoder_interface",
|
||||
":cng",
|
||||
":g711",
|
||||
":g722",
|
||||
":ilbc",
|
||||
":isac",
|
||||
":isac_fix",
|
||||
":pcm16b",
|
||||
"../..:webrtc_common",
|
||||
"../../common_audio",
|
||||
@ -805,4 +817,19 @@ source_set("neteq") {
|
||||
defines += [ "WEBRTC_CODEC_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" ]
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,9 +38,13 @@ AcmReceiveTest::AcmReceiveTest(PacketSource* packet_source,
|
||||
}
|
||||
|
||||
void AcmReceiveTest::RegisterDefaultCodecs() {
|
||||
#ifdef WEBRTC_CODEC_OPUS
|
||||
ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kOpus, 120));
|
||||
#endif
|
||||
#if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
|
||||
ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kISAC, 103));
|
||||
#ifndef WEBRTC_ANDROID
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_ISAC
|
||||
ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kISACSWB, 104));
|
||||
ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kISACFB, 105));
|
||||
#endif
|
||||
@ -56,13 +60,19 @@ void AcmReceiveTest::RegisterDefaultCodecs() {
|
||||
ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kPCMA, 8));
|
||||
ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kPCMU_2ch, 110));
|
||||
ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kPCMA_2ch, 118));
|
||||
#ifdef WEBRTC_CODEC_ILBC
|
||||
ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kILBC, 102));
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_G722
|
||||
ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kG722, 9));
|
||||
ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kG722_2ch, 119));
|
||||
#endif
|
||||
ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kCNNB, 13));
|
||||
ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kCNWB, 98));
|
||||
ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kCNSWB, 99));
|
||||
#ifdef WEBRTC_CODEC_RED
|
||||
ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kRED, 127));
|
||||
#endif
|
||||
}
|
||||
|
||||
void AcmReceiveTest::RegisterNetEqTestCodecs() {
|
||||
|
||||
@ -293,7 +293,13 @@ TEST_F(AcmReceiverTest, DISABLED_ON_ANDROID(PostdecodingVad)) {
|
||||
EXPECT_EQ(AudioFrame::kVadUnknown, frame.vad_activity_);
|
||||
}
|
||||
|
||||
TEST_F(AcmReceiverTest, DISABLED_ON_ANDROID(LastAudioCodec)) {
|
||||
#ifdef WEBRTC_CODEC_ISAC
|
||||
#define IF_ISAC_FLOAT(x) x
|
||||
#else
|
||||
#define IF_ISAC_FLOAT(x) DISABLED_##x
|
||||
#endif
|
||||
|
||||
TEST_F(AcmReceiverTest, DISABLED_ON_ANDROID(IF_ISAC_FLOAT(LastAudioCodec))) {
|
||||
const int kCodecId[] = {
|
||||
ACMCodecDB::kISAC, ACMCodecDB::kPCMA, ACMCodecDB::kISACSWB,
|
||||
ACMCodecDB::kPCM16Bswb32kHz,
|
||||
|
||||
@ -292,7 +292,14 @@ TEST_F(AcmReceiverTestOldApi, DISABLED_ON_ANDROID(PostdecodingVad)) {
|
||||
EXPECT_EQ(AudioFrame::kVadUnknown, frame.vad_activity_);
|
||||
}
|
||||
|
||||
TEST_F(AcmReceiverTestOldApi, DISABLED_ON_ANDROID(LastAudioCodec)) {
|
||||
#ifdef WEBRTC_CODEC_ISAC
|
||||
#define IF_ISAC_FLOAT(x) x
|
||||
#else
|
||||
#define IF_ISAC_FLOAT(x) DISABLED_##x
|
||||
#endif
|
||||
|
||||
TEST_F(AcmReceiverTestOldApi,
|
||||
DISABLED_ON_ANDROID(IF_ISAC_FLOAT(LastAudioCodec))) {
|
||||
const int kCodecId[] = {
|
||||
ACMCodecDB::kISAC, ACMCodecDB::kPCMA, ACMCodecDB::kISACSWB,
|
||||
ACMCodecDB::kPCM16Bswb32kHz,
|
||||
|
||||
@ -504,7 +504,13 @@ class AcmIsacMtTest : public AudioCodingModuleMtTest {
|
||||
test::AudioLoop audio_loop_;
|
||||
};
|
||||
|
||||
TEST_F(AcmIsacMtTest, DoTest) {
|
||||
#if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
|
||||
#define IF_ISAC(x) x
|
||||
#else
|
||||
#define IF_ISAC(x) DISABLED_##x
|
||||
#endif
|
||||
|
||||
TEST_F(AcmIsacMtTest, IF_ISAC(DoTest)) {
|
||||
EXPECT_EQ(kEventSignaled, RunTest());
|
||||
}
|
||||
|
||||
@ -559,13 +565,20 @@ class AcmReceiverBitExactness : public ::testing::Test {
|
||||
}
|
||||
};
|
||||
|
||||
#if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISAC)) && \
|
||||
defined(WEBRTC_CODEC_ILBC) && defined(WEBRTC_CODEC_G722)
|
||||
#define IF_ALL_CODECS(x) x
|
||||
#else
|
||||
#define IF_ALL_CODECS(x) DISABLED_##x
|
||||
#endif
|
||||
|
||||
// Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199
|
||||
#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64)
|
||||
#define MAYBE_8kHzOutput DISABLED_8kHzOutput
|
||||
#else
|
||||
#define MAYBE_8kHzOutput 8kHzOutput
|
||||
#endif
|
||||
TEST_F(AcmReceiverBitExactness, MAYBE_8kHzOutput) {
|
||||
TEST_F(AcmReceiverBitExactness, IF_ALL_CODECS(MAYBE_8kHzOutput)) {
|
||||
Run(8000,
|
||||
PlatformChecksum("dcee98c623b147ebe1b40dd30efa896e",
|
||||
"adc92e173f908f93b96ba5844209815a",
|
||||
@ -578,7 +591,7 @@ TEST_F(AcmReceiverBitExactness, MAYBE_8kHzOutput) {
|
||||
#else
|
||||
#define MAYBE_16kHzOutput 16kHzOutput
|
||||
#endif
|
||||
TEST_F(AcmReceiverBitExactness, MAYBE_16kHzOutput) {
|
||||
TEST_F(AcmReceiverBitExactness, IF_ALL_CODECS(MAYBE_16kHzOutput)) {
|
||||
Run(16000,
|
||||
PlatformChecksum("f790e7a8cce4e2c8b7bb5e0e4c5dac0d",
|
||||
"8cffa6abcb3e18e33b9d857666dff66a",
|
||||
@ -591,7 +604,7 @@ TEST_F(AcmReceiverBitExactness, MAYBE_16kHzOutput) {
|
||||
#else
|
||||
#define MAYBE_32kHzOutput 32kHzOutput
|
||||
#endif
|
||||
TEST_F(AcmReceiverBitExactness, MAYBE_32kHzOutput) {
|
||||
TEST_F(AcmReceiverBitExactness, IF_ALL_CODECS(MAYBE_32kHzOutput)) {
|
||||
Run(32000,
|
||||
PlatformChecksum("306e0d990ee6e92de3fbecc0123ece37",
|
||||
"3e126fe894720c3f85edadcc91964ba5",
|
||||
@ -604,7 +617,7 @@ TEST_F(AcmReceiverBitExactness, MAYBE_32kHzOutput) {
|
||||
#else
|
||||
#define MAYBE_48kHzOutput 48kHzOutput
|
||||
#endif
|
||||
TEST_F(AcmReceiverBitExactness, MAYBE_48kHzOutput) {
|
||||
TEST_F(AcmReceiverBitExactness, IF_ALL_CODECS(MAYBE_48kHzOutput)) {
|
||||
Run(48000,
|
||||
PlatformChecksum("aa7c232f63a67b2a72703593bdd172e0",
|
||||
"0155665e93067c4e89256b944dd11999",
|
||||
@ -770,7 +783,7 @@ class AcmSenderBitExactness : public ::testing::Test,
|
||||
#else
|
||||
#define MAYBE_IsacWb30ms IsacWb30ms
|
||||
#endif
|
||||
TEST_F(AcmSenderBitExactness, MAYBE_IsacWb30ms) {
|
||||
TEST_F(AcmSenderBitExactness, IF_ISAC(MAYBE_IsacWb30ms)) {
|
||||
ASSERT_NO_FATAL_FAILURE(SetUpTest(acm2::ACMCodecDB::kISAC, 1, 103, 480, 480));
|
||||
Run(AcmReceiverBitExactness::PlatformChecksum(
|
||||
"c7e5bdadfa2871df95639fcc297cf23d",
|
||||
@ -790,7 +803,7 @@ TEST_F(AcmSenderBitExactness, MAYBE_IsacWb30ms) {
|
||||
#else
|
||||
#define MAYBE_IsacWb60ms IsacWb60ms
|
||||
#endif
|
||||
TEST_F(AcmSenderBitExactness, MAYBE_IsacWb60ms) {
|
||||
TEST_F(AcmSenderBitExactness, IF_ISAC(MAYBE_IsacWb60ms)) {
|
||||
ASSERT_NO_FATAL_FAILURE(SetUpTest(acm2::ACMCodecDB::kISAC, 1, 103, 960, 960));
|
||||
Run(AcmReceiverBitExactness::PlatformChecksum(
|
||||
"14d63c5f08127d280e722e3191b73bdd",
|
||||
@ -804,7 +817,13 @@ TEST_F(AcmSenderBitExactness, MAYBE_IsacWb60ms) {
|
||||
test::AcmReceiveTest::kMonoOutput);
|
||||
}
|
||||
|
||||
TEST_F(AcmSenderBitExactness, DISABLED_ON_ANDROID(IsacSwb30ms)) {
|
||||
#ifdef WEBRTC_CODEC_ISAC
|
||||
#define IF_ISAC_FLOAT(x) x
|
||||
#else
|
||||
#define IF_ISAC_FLOAT(x) DISABLED_##x
|
||||
#endif
|
||||
|
||||
TEST_F(AcmSenderBitExactness, DISABLED_ON_ANDROID(IF_ISAC_FLOAT(IsacSwb30ms))) {
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
SetUpTest(acm2::ACMCodecDB::kISACSWB, 1, 104, 960, 960));
|
||||
Run(AcmReceiverBitExactness::PlatformChecksum(
|
||||
@ -905,7 +924,13 @@ TEST_F(AcmSenderBitExactness, Pcma_stereo_20ms) {
|
||||
test::AcmReceiveTest::kStereoOutput);
|
||||
}
|
||||
|
||||
TEST_F(AcmSenderBitExactness, DISABLED_ON_ANDROID(Ilbc_30ms)) {
|
||||
#ifdef WEBRTC_CODEC_ILBC
|
||||
#define IF_ILBC(x) x
|
||||
#else
|
||||
#define IF_ILBC(x) DISABLED_##x
|
||||
#endif
|
||||
|
||||
TEST_F(AcmSenderBitExactness, DISABLED_ON_ANDROID(IF_ILBC(Ilbc_30ms))) {
|
||||
ASSERT_NO_FATAL_FAILURE(SetUpTest(acm2::ACMCodecDB::kILBC, 1, 102, 240, 240));
|
||||
Run(AcmReceiverBitExactness::PlatformChecksum(
|
||||
"7b6ec10910debd9af08011d3ed5249f7",
|
||||
@ -919,7 +944,13 @@ TEST_F(AcmSenderBitExactness, DISABLED_ON_ANDROID(Ilbc_30ms)) {
|
||||
test::AcmReceiveTest::kMonoOutput);
|
||||
}
|
||||
|
||||
TEST_F(AcmSenderBitExactness, DISABLED_ON_ANDROID(G722_20ms)) {
|
||||
#ifdef WEBRTC_CODEC_G722
|
||||
#define IF_G722(x) x
|
||||
#else
|
||||
#define IF_G722(x) DISABLED_##x
|
||||
#endif
|
||||
|
||||
TEST_F(AcmSenderBitExactness, DISABLED_ON_ANDROID(IF_G722(G722_20ms))) {
|
||||
ASSERT_NO_FATAL_FAILURE(SetUpTest(acm2::ACMCodecDB::kG722, 1, 9, 320, 160));
|
||||
Run(AcmReceiverBitExactness::PlatformChecksum(
|
||||
"7d759436f2533582950d148b5161a36c",
|
||||
@ -933,7 +964,7 @@ TEST_F(AcmSenderBitExactness, DISABLED_ON_ANDROID(G722_20ms)) {
|
||||
test::AcmReceiveTest::kMonoOutput);
|
||||
}
|
||||
|
||||
TEST_F(AcmSenderBitExactness, DISABLED_ON_ANDROID(G722_stereo_20ms)) {
|
||||
TEST_F(AcmSenderBitExactness, DISABLED_ON_ANDROID(IF_G722(G722_stereo_20ms))) {
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
SetUpTest(acm2::ACMCodecDB::kG722_2ch, 2, 119, 320, 160));
|
||||
Run(AcmReceiverBitExactness::PlatformChecksum(
|
||||
|
||||
@ -342,9 +342,16 @@ TEST_F(AudioCodingModuleTestOldApi, TransportCallbackIsInvokedForEachPacket) {
|
||||
EXPECT_EQ(kAudioFrameSpeech, packet_cb_.last_frame_type());
|
||||
}
|
||||
|
||||
#if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
|
||||
#define IF_ISAC(x) x
|
||||
#else
|
||||
#define IF_ISAC(x) DISABLED_##x
|
||||
#endif
|
||||
|
||||
// Verifies that the RTP timestamp series is not reset when the codec is
|
||||
// changed.
|
||||
TEST_F(AudioCodingModuleTestOldApi, TimestampSeriesContinuesWhenCodecChanges) {
|
||||
TEST_F(AudioCodingModuleTestOldApi,
|
||||
IF_ISAC(TimestampSeriesContinuesWhenCodecChanges)) {
|
||||
RegisterCodec(); // This registers the default codec.
|
||||
uint32_t expected_ts = input_frame_.timestamp_;
|
||||
int blocks_per_packet = codec_.pacsize / (kSampleRateHz / 100);
|
||||
@ -700,7 +707,7 @@ class AcmIsacMtTestOldApi : public AudioCodingModuleMtTestOldApi {
|
||||
test::AudioLoop audio_loop_;
|
||||
};
|
||||
|
||||
TEST_F(AcmIsacMtTestOldApi, DISABLED_ON_IOS(DoTest)) {
|
||||
TEST_F(AcmIsacMtTestOldApi, DISABLED_ON_IOS(IF_ISAC(DoTest))) {
|
||||
EXPECT_EQ(kEventSignaled, RunTest());
|
||||
}
|
||||
|
||||
@ -854,7 +861,7 @@ class AcmReRegisterIsacMtTestOldApi : public AudioCodingModuleTestOldApi {
|
||||
test::AudioLoop audio_loop_;
|
||||
};
|
||||
|
||||
TEST_F(AcmReRegisterIsacMtTestOldApi, DISABLED_ON_IOS(DoTest)) {
|
||||
TEST_F(AcmReRegisterIsacMtTestOldApi, DISABLED_ON_IOS(IF_ISAC(DoTest))) {
|
||||
EXPECT_EQ(kEventSignaled, RunTest());
|
||||
}
|
||||
|
||||
@ -926,13 +933,20 @@ class AcmReceiverBitExactnessOldApi : public ::testing::Test {
|
||||
}
|
||||
};
|
||||
|
||||
#if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISAC)) && \
|
||||
defined(WEBRTC_CODEC_ILBC) && defined(WEBRTC_CODEC_G722)
|
||||
#define IF_ALL_CODECS(x) x
|
||||
#else
|
||||
#define IF_ALL_CODECS(x) DISABLED_##x
|
||||
#endif
|
||||
|
||||
// Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199
|
||||
#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64)
|
||||
#define MAYBE_8kHzOutput DISABLED_8kHzOutput
|
||||
#else
|
||||
#define MAYBE_8kHzOutput 8kHzOutput
|
||||
#endif
|
||||
TEST_F(AcmReceiverBitExactnessOldApi, MAYBE_8kHzOutput) {
|
||||
TEST_F(AcmReceiverBitExactnessOldApi, IF_ALL_CODECS(MAYBE_8kHzOutput)) {
|
||||
Run(8000, PlatformChecksum("dcee98c623b147ebe1b40dd30efa896e",
|
||||
"adc92e173f908f93b96ba5844209815a",
|
||||
"908002dc01fc4eb1d2be24eb1d3f354b"),
|
||||
@ -945,7 +959,7 @@ TEST_F(AcmReceiverBitExactnessOldApi, MAYBE_8kHzOutput) {
|
||||
#else
|
||||
#define MAYBE_16kHzOutput 16kHzOutput
|
||||
#endif
|
||||
TEST_F(AcmReceiverBitExactnessOldApi, MAYBE_16kHzOutput) {
|
||||
TEST_F(AcmReceiverBitExactnessOldApi, IF_ALL_CODECS(MAYBE_16kHzOutput)) {
|
||||
Run(16000, PlatformChecksum("f790e7a8cce4e2c8b7bb5e0e4c5dac0d",
|
||||
"8cffa6abcb3e18e33b9d857666dff66a",
|
||||
"a909560b5ca49fa472b17b7b277195e9"),
|
||||
@ -958,7 +972,7 @@ TEST_F(AcmReceiverBitExactnessOldApi, MAYBE_16kHzOutput) {
|
||||
#else
|
||||
#define MAYBE_32kHzOutput 32kHzOutput
|
||||
#endif
|
||||
TEST_F(AcmReceiverBitExactnessOldApi, MAYBE_32kHzOutput) {
|
||||
TEST_F(AcmReceiverBitExactnessOldApi, IF_ALL_CODECS(MAYBE_32kHzOutput)) {
|
||||
Run(32000, PlatformChecksum("306e0d990ee6e92de3fbecc0123ece37",
|
||||
"3e126fe894720c3f85edadcc91964ba5",
|
||||
"441aab4b347fb3db4e9244337aca8d8e"),
|
||||
@ -971,7 +985,7 @@ TEST_F(AcmReceiverBitExactnessOldApi, MAYBE_32kHzOutput) {
|
||||
#else
|
||||
#define MAYBE_48kHzOutput 48kHzOutput
|
||||
#endif
|
||||
TEST_F(AcmReceiverBitExactnessOldApi, MAYBE_48kHzOutput) {
|
||||
TEST_F(AcmReceiverBitExactnessOldApi, IF_ALL_CODECS(MAYBE_48kHzOutput)) {
|
||||
Run(48000, PlatformChecksum("aa7c232f63a67b2a72703593bdd172e0",
|
||||
"0155665e93067c4e89256b944dd11999",
|
||||
"4ee2730fa1daae755e8a8fd3abd779ec"),
|
||||
@ -984,7 +998,8 @@ TEST_F(AcmReceiverBitExactnessOldApi, MAYBE_48kHzOutput) {
|
||||
#else
|
||||
#define MAYBE_48kHzOutputExternalDecoder 48kHzOutputExternalDecoder
|
||||
#endif
|
||||
TEST_F(AcmReceiverBitExactnessOldApi, MAYBE_48kHzOutputExternalDecoder) {
|
||||
TEST_F(AcmReceiverBitExactnessOldApi,
|
||||
IF_ALL_CODECS(MAYBE_48kHzOutputExternalDecoder)) {
|
||||
AudioDecoderPcmU decoder(1);
|
||||
MockAudioDecoder mock_decoder;
|
||||
// Set expectations on the mock decoder and also delegate the calls to the
|
||||
@ -1200,7 +1215,7 @@ class AcmSenderBitExactnessOldApi : public ::testing::Test,
|
||||
#else
|
||||
#define MAYBE_IsacWb30ms IsacWb30ms
|
||||
#endif
|
||||
TEST_F(AcmSenderBitExactnessOldApi, MAYBE_IsacWb30ms) {
|
||||
TEST_F(AcmSenderBitExactnessOldApi, IF_ISAC(MAYBE_IsacWb30ms)) {
|
||||
ASSERT_NO_FATAL_FAILURE(SetUpTest("ISAC", 16000, 1, 103, 480, 480));
|
||||
Run(AcmReceiverBitExactnessOldApi::PlatformChecksum(
|
||||
"c7e5bdadfa2871df95639fcc297cf23d",
|
||||
@ -1220,7 +1235,7 @@ TEST_F(AcmSenderBitExactnessOldApi, MAYBE_IsacWb30ms) {
|
||||
#else
|
||||
#define MAYBE_IsacWb60ms IsacWb60ms
|
||||
#endif
|
||||
TEST_F(AcmSenderBitExactnessOldApi, MAYBE_IsacWb60ms) {
|
||||
TEST_F(AcmSenderBitExactnessOldApi, IF_ISAC(MAYBE_IsacWb60ms)) {
|
||||
ASSERT_NO_FATAL_FAILURE(SetUpTest("ISAC", 16000, 1, 103, 960, 960));
|
||||
Run(AcmReceiverBitExactnessOldApi::PlatformChecksum(
|
||||
"14d63c5f08127d280e722e3191b73bdd",
|
||||
@ -1234,7 +1249,14 @@ TEST_F(AcmSenderBitExactnessOldApi, MAYBE_IsacWb60ms) {
|
||||
test::AcmReceiveTestOldApi::kMonoOutput);
|
||||
}
|
||||
|
||||
TEST_F(AcmSenderBitExactnessOldApi, DISABLED_ON_ANDROID(IsacSwb30ms)) {
|
||||
#ifdef WEBRTC_CODEC_ISAC
|
||||
#define IF_ISAC_FLOAT(x) x
|
||||
#else
|
||||
#define IF_ISAC_FLOAT(x) DISABLED_##x
|
||||
#endif
|
||||
|
||||
TEST_F(AcmSenderBitExactnessOldApi,
|
||||
DISABLED_ON_ANDROID(IF_ISAC_FLOAT(IsacSwb30ms))) {
|
||||
ASSERT_NO_FATAL_FAILURE(SetUpTest("ISAC", 32000, 1, 104, 960, 960));
|
||||
Run(AcmReceiverBitExactnessOldApi::PlatformChecksum(
|
||||
"2b3c387d06f00b7b7aad4c9be56fb83d",
|
||||
@ -1327,7 +1349,13 @@ TEST_F(AcmSenderBitExactnessOldApi, Pcma_stereo_20ms) {
|
||||
test::AcmReceiveTestOldApi::kStereoOutput);
|
||||
}
|
||||
|
||||
TEST_F(AcmSenderBitExactnessOldApi, DISABLED_ON_ANDROID(Ilbc_30ms)) {
|
||||
#ifdef WEBRTC_CODEC_ILBC
|
||||
#define IF_ILBC(x) x
|
||||
#else
|
||||
#define IF_ILBC(x) DISABLED_##x
|
||||
#endif
|
||||
|
||||
TEST_F(AcmSenderBitExactnessOldApi, DISABLED_ON_ANDROID(IF_ILBC(Ilbc_30ms))) {
|
||||
ASSERT_NO_FATAL_FAILURE(SetUpTest("ILBC", 8000, 1, 102, 240, 240));
|
||||
Run(AcmReceiverBitExactnessOldApi::PlatformChecksum(
|
||||
"7b6ec10910debd9af08011d3ed5249f7",
|
||||
@ -1341,7 +1369,13 @@ TEST_F(AcmSenderBitExactnessOldApi, DISABLED_ON_ANDROID(Ilbc_30ms)) {
|
||||
test::AcmReceiveTestOldApi::kMonoOutput);
|
||||
}
|
||||
|
||||
TEST_F(AcmSenderBitExactnessOldApi, DISABLED_ON_ANDROID(G722_20ms)) {
|
||||
#ifdef WEBRTC_CODEC_G722
|
||||
#define IF_G722(x) x
|
||||
#else
|
||||
#define IF_G722(x) DISABLED_##x
|
||||
#endif
|
||||
|
||||
TEST_F(AcmSenderBitExactnessOldApi, DISABLED_ON_ANDROID(IF_G722(G722_20ms))) {
|
||||
ASSERT_NO_FATAL_FAILURE(SetUpTest("G722", 16000, 1, 9, 320, 160));
|
||||
Run(AcmReceiverBitExactnessOldApi::PlatformChecksum(
|
||||
"7d759436f2533582950d148b5161a36c",
|
||||
@ -1355,7 +1389,8 @@ TEST_F(AcmSenderBitExactnessOldApi, DISABLED_ON_ANDROID(G722_20ms)) {
|
||||
test::AcmReceiveTestOldApi::kMonoOutput);
|
||||
}
|
||||
|
||||
TEST_F(AcmSenderBitExactnessOldApi, DISABLED_ON_ANDROID(G722_stereo_20ms)) {
|
||||
TEST_F(AcmSenderBitExactnessOldApi,
|
||||
DISABLED_ON_ANDROID(IF_G722(G722_stereo_20ms))) {
|
||||
ASSERT_NO_FATAL_FAILURE(SetUpTest("G722", 16000, 2, 119, 320, 160));
|
||||
Run(AcmReceiverBitExactnessOldApi::PlatformChecksum(
|
||||
"7190ee718ab3d80eca181e5f7140c210",
|
||||
|
||||
@ -15,65 +15,31 @@
|
||||
#include "webrtc/engine_configurations.h"
|
||||
#include "webrtc/modules/audio_coding/codecs/cng/include/audio_encoder_cng.h"
|
||||
#include "webrtc/modules/audio_coding/codecs/g711/include/audio_encoder_pcm.h"
|
||||
#ifdef WEBRTC_CODEC_G722
|
||||
#include "webrtc/modules/audio_coding/codecs/g722/include/audio_encoder_g722.h"
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_ILBC
|
||||
#include "webrtc/modules/audio_coding/codecs/ilbc/interface/audio_encoder_ilbc.h"
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_ISACFX
|
||||
#include "webrtc/modules/audio_coding/codecs/isac/fix/interface/audio_decoder_isacfix.h"
|
||||
#include "webrtc/modules/audio_coding/codecs/isac/fix/interface/audio_encoder_isacfix.h"
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_ISAC
|
||||
#include "webrtc/modules/audio_coding/codecs/isac/main/interface/audio_decoder_isac.h"
|
||||
#include "webrtc/modules/audio_coding/codecs/isac/main/interface/audio_encoder_isac.h"
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_OPUS
|
||||
#include "webrtc/modules/audio_coding/codecs/opus/interface/audio_encoder_opus.h"
|
||||
#endif
|
||||
#include "webrtc/modules/audio_coding/codecs/pcm16b/include/audio_encoder_pcm16b.h"
|
||||
#ifdef WEBRTC_CODEC_RED
|
||||
#include "webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.h"
|
||||
#endif
|
||||
|
||||
namespace webrtc {
|
||||
namespace acm2 {
|
||||
|
||||
namespace {
|
||||
bool IsIsac(const CodecInst& codec) {
|
||||
return
|
||||
#if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX))
|
||||
!STR_CASE_CMP(codec.plname, "isac") ||
|
||||
#endif
|
||||
false;
|
||||
}
|
||||
|
||||
bool IsOpus(const CodecInst& codec) {
|
||||
return
|
||||
#ifdef WEBRTC_CODEC_OPUS
|
||||
!STR_CASE_CMP(codec.plname, "opus") ||
|
||||
#endif
|
||||
false;
|
||||
}
|
||||
|
||||
bool IsPcmU(const CodecInst& codec) {
|
||||
return !STR_CASE_CMP(codec.plname, "pcmu");
|
||||
}
|
||||
|
||||
bool IsPcmA(const CodecInst& codec) {
|
||||
return !STR_CASE_CMP(codec.plname, "pcma");
|
||||
}
|
||||
|
||||
bool IsPcm16B(const CodecInst& codec) {
|
||||
return !STR_CASE_CMP(codec.plname, "l16");
|
||||
}
|
||||
|
||||
bool IsIlbc(const CodecInst& codec) {
|
||||
return
|
||||
#ifdef WEBRTC_CODEC_ILBC
|
||||
!STR_CASE_CMP(codec.plname, "ilbc") ||
|
||||
#endif
|
||||
false;
|
||||
}
|
||||
|
||||
bool IsG722(const CodecInst& codec) {
|
||||
return
|
||||
#ifdef WEBRTC_CODEC_G722
|
||||
!STR_CASE_CMP(codec.plname, "g722") ||
|
||||
#endif
|
||||
false;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
CodecOwner::CodecOwner() : external_speech_encoder_(nullptr) {
|
||||
}
|
||||
|
||||
@ -93,58 +59,57 @@ rtc::scoped_ptr<AudioDecoder> CreateIsacDecoder(
|
||||
#endif
|
||||
}
|
||||
|
||||
rtc::scoped_ptr<AudioEncoder> CreateIsacEncoder(
|
||||
const CodecInst& speech_inst,
|
||||
LockedIsacBandwidthInfo* bwinfo) {
|
||||
#if defined(WEBRTC_CODEC_ISACFX)
|
||||
return rtc_make_scoped_ptr(new AudioEncoderIsacFix(speech_inst, bwinfo));
|
||||
#elif defined(WEBRTC_CODEC_ISAC)
|
||||
return rtc_make_scoped_ptr(new AudioEncoderIsac(speech_inst, bwinfo));
|
||||
#else
|
||||
FATAL() << "iSAC is not supported.";
|
||||
return rtc::scoped_ptr<AudioEncoderMutable>();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Returns a new speech encoder, or null on error.
|
||||
// TODO(kwiberg): Don't handle errors here (bug 5033)
|
||||
rtc::scoped_ptr<AudioEncoder> CreateSpeechEncoder(
|
||||
const CodecInst& speech_inst,
|
||||
LockedIsacBandwidthInfo* bwinfo) {
|
||||
if (IsIsac(speech_inst)) {
|
||||
return CreateIsacEncoder(speech_inst, bwinfo);
|
||||
} else if (IsOpus(speech_inst)) {
|
||||
#if defined(WEBRTC_CODEC_ISACFX)
|
||||
if (STR_CASE_CMP(speech_inst.plname, "isac") == 0)
|
||||
return rtc_make_scoped_ptr(new AudioEncoderIsacFix(speech_inst, bwinfo));
|
||||
#endif
|
||||
#if defined(WEBRTC_CODEC_ISAC)
|
||||
if (STR_CASE_CMP(speech_inst.plname, "isac") == 0)
|
||||
return rtc_make_scoped_ptr(new AudioEncoderIsac(speech_inst, bwinfo));
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_OPUS
|
||||
if (STR_CASE_CMP(speech_inst.plname, "opus") == 0)
|
||||
return rtc_make_scoped_ptr(new AudioEncoderOpus(speech_inst));
|
||||
} else if (IsPcmU(speech_inst)) {
|
||||
#endif
|
||||
if (STR_CASE_CMP(speech_inst.plname, "pcmu") == 0)
|
||||
return rtc_make_scoped_ptr(new AudioEncoderPcmU(speech_inst));
|
||||
} else if (IsPcmA(speech_inst)) {
|
||||
if (STR_CASE_CMP(speech_inst.plname, "pcma") == 0)
|
||||
return rtc_make_scoped_ptr(new AudioEncoderPcmA(speech_inst));
|
||||
} else if (IsPcm16B(speech_inst)) {
|
||||
if (STR_CASE_CMP(speech_inst.plname, "l16") == 0)
|
||||
return rtc_make_scoped_ptr(new AudioEncoderPcm16B(speech_inst));
|
||||
} else if (IsIlbc(speech_inst)) {
|
||||
#ifdef WEBRTC_CODEC_ILBC
|
||||
if (STR_CASE_CMP(speech_inst.plname, "ilbc") == 0)
|
||||
return rtc_make_scoped_ptr(new AudioEncoderIlbc(speech_inst));
|
||||
} else if (IsG722(speech_inst)) {
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_G722
|
||||
if (STR_CASE_CMP(speech_inst.plname, "g722") == 0)
|
||||
return rtc_make_scoped_ptr(new AudioEncoderG722(speech_inst));
|
||||
} else {
|
||||
LOG_F(LS_ERROR) << "Could not create encoder of type "
|
||||
<< speech_inst.plname;
|
||||
#endif
|
||||
LOG_F(LS_ERROR) << "Could not create encoder of type " << speech_inst.plname;
|
||||
return rtc::scoped_ptr<AudioEncoder>();
|
||||
}
|
||||
}
|
||||
|
||||
AudioEncoder* CreateRedEncoder(int red_payload_type,
|
||||
AudioEncoder* encoder,
|
||||
rtc::scoped_ptr<AudioEncoder>* red_encoder) {
|
||||
if (red_payload_type == -1) {
|
||||
red_encoder->reset();
|
||||
return encoder;
|
||||
}
|
||||
#ifdef WEBRTC_CODEC_RED
|
||||
if (red_payload_type != -1) {
|
||||
AudioEncoderCopyRed::Config config;
|
||||
config.payload_type = red_payload_type;
|
||||
config.speech_encoder = encoder;
|
||||
red_encoder->reset(new AudioEncoderCopyRed(config));
|
||||
return red_encoder->get();
|
||||
}
|
||||
#endif
|
||||
|
||||
red_encoder->reset();
|
||||
return encoder;
|
||||
}
|
||||
|
||||
void CreateCngEncoder(int cng_payload_type,
|
||||
ACMVADMode vad_mode,
|
||||
|
||||
@ -15,13 +15,19 @@
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/common_types.h"
|
||||
#include "webrtc/modules/audio_coding/codecs/audio_encoder.h"
|
||||
#include "webrtc/modules/audio_coding/codecs/isac/main/interface/audio_encoder_isac.h"
|
||||
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
|
||||
#include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h"
|
||||
|
||||
#if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
|
||||
#include "webrtc/modules/audio_coding/codecs/isac/locked_bandwidth_info.h"
|
||||
#else
|
||||
// Dummy implementation, for when we don't have iSAC.
|
||||
namespace webrtc {
|
||||
class LockedIsacBandwidthInfo {};
|
||||
}
|
||||
#endif
|
||||
|
||||
class AudioDecoder;
|
||||
|
||||
namespace webrtc {
|
||||
namespace acm2 {
|
||||
|
||||
class CodecOwner {
|
||||
|
||||
@ -11,12 +11,7 @@
|
||||
'audio_coding_dependencies': [
|
||||
'cng',
|
||||
'g711',
|
||||
'g722',
|
||||
'ilbc',
|
||||
'isac',
|
||||
'isac_fix',
|
||||
'pcm16b',
|
||||
'red',
|
||||
'<(webrtc_root)/common.gyp:webrtc_common',
|
||||
'<(webrtc_root)/common_audio/common_audio.gyp:common_audio',
|
||||
'<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
|
||||
@ -27,6 +22,23 @@
|
||||
'audio_coding_dependencies': ['webrtc_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': [
|
||||
|
||||
@ -37,11 +37,15 @@ namespace webrtc {
|
||||
namespace {
|
||||
const char kNameL16[] = "L16";
|
||||
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";
|
||||
const char kNameCN[] = "CN";
|
||||
const char kNameRED[] = "RED";
|
||||
#endif
|
||||
}
|
||||
|
||||
TestRedFec::TestRedFec()
|
||||
@ -104,7 +108,7 @@ void TestRedFec::Perform() {
|
||||
EXPECT_TRUE(false);
|
||||
printf("G722 needs to be activated to run this test\n");
|
||||
return;
|
||||
#endif
|
||||
#else
|
||||
EXPECT_EQ(0, RegisterSendCodec('A', kNameG722, 16000));
|
||||
EXPECT_EQ(0, RegisterSendCodec('A', kNameCN, 16000));
|
||||
|
||||
@ -408,6 +412,8 @@ 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) {
|
||||
|
||||
@ -50,7 +50,13 @@ TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestEncodeDecode)) {
|
||||
Trace::ReturnTrace();
|
||||
}
|
||||
|
||||
TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestRedFec)) {
|
||||
#ifdef WEBRTC_CODEC_RED
|
||||
#define IF_RED(x) x
|
||||
#else
|
||||
#define IF_RED(x) DISABLED_##x
|
||||
#endif
|
||||
|
||||
TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(IF_RED(TestRedFec))) {
|
||||
Trace::CreateTrace();
|
||||
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
||||
"acm_fec_trace.txt").c_str());
|
||||
@ -58,7 +64,13 @@ TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestRedFec)) {
|
||||
Trace::ReturnTrace();
|
||||
}
|
||||
|
||||
TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestIsac)) {
|
||||
#if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
|
||||
#define IF_ISAC(x) x
|
||||
#else
|
||||
#define IF_ISAC(x) DISABLED_##x
|
||||
#endif
|
||||
|
||||
TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(IF_ISAC(TestIsac))) {
|
||||
Trace::CreateTrace();
|
||||
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
||||
"acm_isac_trace.txt").c_str());
|
||||
@ -66,7 +78,15 @@ TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestIsac)) {
|
||||
Trace::ReturnTrace();
|
||||
}
|
||||
|
||||
TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TwoWayCommunication)) {
|
||||
#if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) && \
|
||||
defined(WEBRTC_CODEC_ILBC) && defined(WEBRTC_CODEC_G722)
|
||||
#define IF_ALL_CODECS(x) x
|
||||
#else
|
||||
#define IF_ALL_CODECS(x) DISABLED_##x
|
||||
#endif
|
||||
|
||||
TEST(AudioCodingModuleTest,
|
||||
DISABLED_ON_ANDROID(IF_ALL_CODECS(TwoWayCommunication))) {
|
||||
Trace::CreateTrace();
|
||||
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
||||
"acm_twowaycom_trace.txt").c_str());
|
||||
|
||||
@ -13,11 +13,7 @@
|
||||
|
||||
#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"
|
||||
#endif
|
||||
#include "webrtc/base/constructormagic.h"
|
||||
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
|
||||
#include "webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h"
|
||||
|
||||
@ -475,7 +475,6 @@ class AudioDecoderOpusStereoTest : public AudioDecoderOpusTest {
|
||||
TEST_F(AudioDecoderPcmUTest, EncodeDecode) {
|
||||
int tolerance = 251;
|
||||
double mse = 1734.0;
|
||||
EXPECT_TRUE(CodecSupported(kDecoderPCMu));
|
||||
EncodeDecodeTest(data_length_, tolerance, mse);
|
||||
ReInitTest();
|
||||
EXPECT_FALSE(decoder_->HasDecodePlc());
|
||||
@ -502,7 +501,6 @@ TEST_F(AudioDecoderPcmUTest, SetTargetBitrate) {
|
||||
TEST_F(AudioDecoderPcmATest, EncodeDecode) {
|
||||
int tolerance = 308;
|
||||
double mse = 1931.0;
|
||||
EXPECT_TRUE(CodecSupported(kDecoderPCMa));
|
||||
EncodeDecodeTest(data_length_, tolerance, mse);
|
||||
ReInitTest();
|
||||
EXPECT_FALSE(decoder_->HasDecodePlc());
|
||||
@ -515,10 +513,6 @@ TEST_F(AudioDecoderPcmATest, SetTargetBitrate) {
|
||||
TEST_F(AudioDecoderPcm16BTest, EncodeDecode) {
|
||||
int tolerance = 0;
|
||||
double mse = 0.0;
|
||||
EXPECT_TRUE(CodecSupported(kDecoderPCM16B));
|
||||
EXPECT_TRUE(CodecSupported(kDecoderPCM16Bwb));
|
||||
EXPECT_TRUE(CodecSupported(kDecoderPCM16Bswb32kHz));
|
||||
EXPECT_TRUE(CodecSupported(kDecoderPCM16Bswb48kHz));
|
||||
EncodeDecodeTest(2 * data_length_, tolerance, mse);
|
||||
ReInitTest();
|
||||
EXPECT_FALSE(decoder_->HasDecodePlc());
|
||||
@ -533,7 +527,6 @@ TEST_F(AudioDecoderIlbcTest, EncodeDecode) {
|
||||
int tolerance = 6808;
|
||||
double mse = 2.13e6;
|
||||
int delay = 80; // Delay from input to output.
|
||||
EXPECT_TRUE(CodecSupported(kDecoderILBC));
|
||||
EncodeDecodeTest(500, tolerance, mse, delay);
|
||||
ReInitTest();
|
||||
EXPECT_TRUE(decoder_->HasDecodePlc());
|
||||
@ -548,7 +541,6 @@ TEST_F(AudioDecoderIsacFloatTest, EncodeDecode) {
|
||||
int tolerance = 3399;
|
||||
double mse = 434951.0;
|
||||
int delay = 48; // Delay from input to output.
|
||||
EXPECT_TRUE(CodecSupported(kDecoderISAC));
|
||||
EncodeDecodeTest(0, tolerance, mse, delay);
|
||||
ReInitTest();
|
||||
EXPECT_FALSE(decoder_->HasDecodePlc());
|
||||
@ -562,7 +554,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());
|
||||
@ -582,7 +573,6 @@ TEST_F(AudioDecoderIsacFixTest, MAYBE_EncodeDecode) {
|
||||
int tolerance = 11034;
|
||||
double mse = 3.46e6;
|
||||
int delay = 54; // Delay from input to output.
|
||||
EXPECT_TRUE(CodecSupported(kDecoderISAC));
|
||||
#ifdef WEBRTC_ANDROID
|
||||
static const int kEncodedBytes = 685;
|
||||
#else
|
||||
@ -601,7 +591,6 @@ TEST_F(AudioDecoderG722Test, EncodeDecode) {
|
||||
int tolerance = 6176;
|
||||
double mse = 238630.0;
|
||||
int delay = 22; // Delay from input to output.
|
||||
EXPECT_TRUE(CodecSupported(kDecoderG722));
|
||||
EncodeDecodeTest(data_length_ / 2, tolerance, mse, delay);
|
||||
ReInitTest();
|
||||
EXPECT_FALSE(decoder_->HasDecodePlc());
|
||||
@ -611,16 +600,11 @@ TEST_F(AudioDecoderG722Test, SetTargetBitrate) {
|
||||
TestSetAndGetTargetBitratesWithFixedCodec(audio_encoder_.get(), 64000);
|
||||
}
|
||||
|
||||
TEST_F(AudioDecoderG722StereoTest, CreateAndDestroy) {
|
||||
EXPECT_TRUE(CodecSupported(kDecoderG722_2ch));
|
||||
}
|
||||
|
||||
TEST_F(AudioDecoderG722StereoTest, EncodeDecode) {
|
||||
int tolerance = 6176;
|
||||
int channel_diff_tolerance = 0;
|
||||
double mse = 238630.0;
|
||||
int delay = 22; // Delay from input to output.
|
||||
EXPECT_TRUE(CodecSupported(kDecoderG722_2ch));
|
||||
EncodeDecodeTest(data_length_, tolerance, mse, delay, channel_diff_tolerance);
|
||||
ReInitTest();
|
||||
EXPECT_FALSE(decoder_->HasDecodePlc());
|
||||
@ -634,7 +618,6 @@ TEST_F(AudioDecoderOpusTest, EncodeDecode) {
|
||||
int tolerance = 6176;
|
||||
double mse = 238630.0;
|
||||
int delay = 22; // Delay from input to output.
|
||||
EXPECT_TRUE(CodecSupported(kDecoderOpus));
|
||||
EncodeDecodeTest(0, tolerance, mse, delay);
|
||||
ReInitTest();
|
||||
EXPECT_FALSE(decoder_->HasDecodePlc());
|
||||
@ -659,7 +642,6 @@ TEST_F(AudioDecoderOpusStereoTest, EncodeDecode) {
|
||||
int channel_diff_tolerance = 0;
|
||||
double mse = 238630.0;
|
||||
int delay = 22; // Delay from input to output.
|
||||
EXPECT_TRUE(CodecSupported(kDecoderOpus_2ch));
|
||||
EncodeDecodeTest(0, tolerance, mse, delay, channel_diff_tolerance);
|
||||
ReInitTest();
|
||||
EXPECT_FALSE(decoder_->HasDecodePlc());
|
||||
@ -669,15 +651,43 @@ TEST_F(AudioDecoderOpusStereoTest, SetTargetBitrate) {
|
||||
TestOpusSetTargetBitrates(audio_encoder_.get());
|
||||
}
|
||||
|
||||
namespace {
|
||||
#ifdef WEBRTC_CODEC_ILBC
|
||||
const bool has_ilbc = true;
|
||||
#else
|
||||
const bool has_ilbc = false;
|
||||
#endif
|
||||
#if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
|
||||
const bool has_isac = true;
|
||||
#else
|
||||
const bool has_isac = false;
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_ISAC
|
||||
const bool has_isac_swb = true;
|
||||
#else
|
||||
const bool has_isac_swb = false;
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_G722
|
||||
const bool has_g722 = true;
|
||||
#else
|
||||
const bool has_g722 = false;
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_OPUS
|
||||
const bool has_opus = true;
|
||||
#else
|
||||
const bool has_opus = false;
|
||||
#endif
|
||||
} // namespace
|
||||
|
||||
TEST(AudioDecoder, CodecSampleRateHz) {
|
||||
EXPECT_EQ(8000, CodecSampleRateHz(kDecoderPCMu));
|
||||
EXPECT_EQ(8000, CodecSampleRateHz(kDecoderPCMa));
|
||||
EXPECT_EQ(8000, CodecSampleRateHz(kDecoderPCMu_2ch));
|
||||
EXPECT_EQ(8000, CodecSampleRateHz(kDecoderPCMa_2ch));
|
||||
EXPECT_EQ(8000, CodecSampleRateHz(kDecoderILBC));
|
||||
EXPECT_EQ(16000, CodecSampleRateHz(kDecoderISAC));
|
||||
EXPECT_EQ(32000, CodecSampleRateHz(kDecoderISACswb));
|
||||
EXPECT_EQ(32000, CodecSampleRateHz(kDecoderISACfb));
|
||||
EXPECT_EQ(has_ilbc ? 8000 : -1, CodecSampleRateHz(kDecoderILBC));
|
||||
EXPECT_EQ(has_isac ? 16000 : -1, CodecSampleRateHz(kDecoderISAC));
|
||||
EXPECT_EQ(has_isac_swb ? 32000 : -1, CodecSampleRateHz(kDecoderISACswb));
|
||||
EXPECT_EQ(has_isac_swb ? 32000 : -1, CodecSampleRateHz(kDecoderISACfb));
|
||||
EXPECT_EQ(8000, CodecSampleRateHz(kDecoderPCM16B));
|
||||
EXPECT_EQ(16000, CodecSampleRateHz(kDecoderPCM16Bwb));
|
||||
EXPECT_EQ(32000, CodecSampleRateHz(kDecoderPCM16Bswb32kHz));
|
||||
@ -687,15 +697,15 @@ TEST(AudioDecoder, CodecSampleRateHz) {
|
||||
EXPECT_EQ(32000, CodecSampleRateHz(kDecoderPCM16Bswb32kHz_2ch));
|
||||
EXPECT_EQ(48000, CodecSampleRateHz(kDecoderPCM16Bswb48kHz_2ch));
|
||||
EXPECT_EQ(8000, CodecSampleRateHz(kDecoderPCM16B_5ch));
|
||||
EXPECT_EQ(16000, CodecSampleRateHz(kDecoderG722));
|
||||
EXPECT_EQ(16000, CodecSampleRateHz(kDecoderG722_2ch));
|
||||
EXPECT_EQ(has_g722 ? 16000 : -1, CodecSampleRateHz(kDecoderG722));
|
||||
EXPECT_EQ(has_g722 ? 16000 : -1, CodecSampleRateHz(kDecoderG722_2ch));
|
||||
EXPECT_EQ(-1, CodecSampleRateHz(kDecoderRED));
|
||||
EXPECT_EQ(-1, CodecSampleRateHz(kDecoderAVT));
|
||||
EXPECT_EQ(8000, CodecSampleRateHz(kDecoderCNGnb));
|
||||
EXPECT_EQ(16000, CodecSampleRateHz(kDecoderCNGwb));
|
||||
EXPECT_EQ(32000, CodecSampleRateHz(kDecoderCNGswb32kHz));
|
||||
EXPECT_EQ(48000, CodecSampleRateHz(kDecoderOpus));
|
||||
EXPECT_EQ(48000, CodecSampleRateHz(kDecoderOpus_2ch));
|
||||
EXPECT_EQ(has_opus ? 48000 : -1, CodecSampleRateHz(kDecoderOpus));
|
||||
EXPECT_EQ(has_opus ? 48000 : -1, CodecSampleRateHz(kDecoderOpus_2ch));
|
||||
// TODO(tlegrand): Change 32000 to 48000 below once ACM has 48 kHz support.
|
||||
EXPECT_EQ(32000, CodecSampleRateHz(kDecoderCNGswb48kHz));
|
||||
EXPECT_EQ(-1, CodecSampleRateHz(kDecoderArbitrary));
|
||||
@ -706,10 +716,10 @@ TEST(AudioDecoder, CodecSupported) {
|
||||
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_ilbc, CodecSupported(kDecoderILBC));
|
||||
EXPECT_EQ(has_isac, CodecSupported(kDecoderISAC));
|
||||
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));
|
||||
@ -719,8 +729,8 @@ TEST(AudioDecoder, CodecSupported) {
|
||||
EXPECT_TRUE(CodecSupported(kDecoderPCM16Bswb32kHz_2ch));
|
||||
EXPECT_TRUE(CodecSupported(kDecoderPCM16Bswb48kHz_2ch));
|
||||
EXPECT_TRUE(CodecSupported(kDecoderPCM16B_5ch));
|
||||
EXPECT_TRUE(CodecSupported(kDecoderG722));
|
||||
EXPECT_TRUE(CodecSupported(kDecoderG722_2ch));
|
||||
EXPECT_EQ(has_g722, CodecSupported(kDecoderG722));
|
||||
EXPECT_EQ(has_g722, CodecSupported(kDecoderG722_2ch));
|
||||
EXPECT_TRUE(CodecSupported(kDecoderRED));
|
||||
EXPECT_TRUE(CodecSupported(kDecoderAVT));
|
||||
EXPECT_TRUE(CodecSupported(kDecoderCNGnb));
|
||||
@ -728,8 +738,8 @@ TEST(AudioDecoder, CodecSupported) {
|
||||
EXPECT_TRUE(CodecSupported(kDecoderCNGswb32kHz));
|
||||
EXPECT_TRUE(CodecSupported(kDecoderCNGswb48kHz));
|
||||
EXPECT_TRUE(CodecSupported(kDecoderArbitrary));
|
||||
EXPECT_TRUE(CodecSupported(kDecoderOpus));
|
||||
EXPECT_TRUE(CodecSupported(kDecoderOpus_2ch));
|
||||
EXPECT_EQ(has_opus, CodecSupported(kDecoderOpus));
|
||||
EXPECT_EQ(has_opus, CodecSupported(kDecoderOpus_2ch));
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -172,8 +172,14 @@ TEST(DecoderDatabase, CheckPayloadTypes) {
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
|
||||
#define IF_ISAC(x) x
|
||||
#else
|
||||
#define IF_ISAC(x) DISABLED_##x
|
||||
#endif
|
||||
|
||||
// Test the methods for setting and getting active speech and CNG decoders.
|
||||
TEST(DecoderDatabase, ActiveDecoders) {
|
||||
TEST(DecoderDatabase, IF_ISAC(ActiveDecoders)) {
|
||||
DecoderDatabase db;
|
||||
// Load payload types.
|
||||
ASSERT_EQ(DecoderDatabase::kOK, db.RegisterPayload(0, kDecoderPCMu));
|
||||
|
||||
@ -11,10 +11,6 @@
|
||||
'codecs': [
|
||||
'cng',
|
||||
'g711',
|
||||
'g722',
|
||||
'ilbc',
|
||||
'isac',
|
||||
'isac_fix',
|
||||
'pcm16b',
|
||||
],
|
||||
'neteq_defines': [],
|
||||
@ -23,6 +19,23 @@
|
||||
'codecs': ['webrtc_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': [
|
||||
'<@(codecs)',
|
||||
@ -120,6 +133,10 @@
|
||||
'type': '<(gtest_target_type)',
|
||||
'dependencies': [
|
||||
'<@(codecs)',
|
||||
'g722',
|
||||
'ilbc',
|
||||
'isac',
|
||||
'isac_fix',
|
||||
'audio_decoder_interface',
|
||||
'neteq_unittest_tools',
|
||||
'<(DEPTH)/testing/gtest.gyp:gtest',
|
||||
@ -127,11 +144,6 @@
|
||||
'<(webrtc_root)/test/test.gyp:test_support_main',
|
||||
],
|
||||
'defines': [
|
||||
'AUDIO_DECODER_UNITTEST',
|
||||
'WEBRTC_CODEC_G722',
|
||||
'WEBRTC_CODEC_ILBC',
|
||||
'WEBRTC_CODEC_ISACFX',
|
||||
'WEBRTC_CODEC_ISAC',
|
||||
'<@(neteq_defines)',
|
||||
],
|
||||
'sources': [
|
||||
|
||||
@ -307,18 +307,20 @@ void NetEqDecodingTest::LoadDecoders() {
|
||||
ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderPCMu, 0));
|
||||
// Load PCMa.
|
||||
ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderPCMa, 8));
|
||||
#ifndef WEBRTC_ANDROID
|
||||
#ifdef WEBRTC_CODEC_ILBC
|
||||
// Load iLBC.
|
||||
ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderILBC, 102));
|
||||
#endif // WEBRTC_ANDROID
|
||||
#endif
|
||||
#if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
|
||||
// Load iSAC.
|
||||
ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderISAC, 103));
|
||||
#ifndef WEBRTC_ANDROID
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_ISAC
|
||||
// Load iSAC SWB.
|
||||
ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderISACswb, 104));
|
||||
// Load iSAC FB.
|
||||
ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderISACfb, 105));
|
||||
#endif // WEBRTC_ANDROID
|
||||
#endif
|
||||
// Load PCM16B nb.
|
||||
ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderPCM16B, 93));
|
||||
// Load PCM16B wb.
|
||||
@ -441,8 +443,15 @@ void NetEqDecodingTest::PopulateCng(int frame_index,
|
||||
*payload_len = 1; // Only noise level, no spectral parameters.
|
||||
}
|
||||
|
||||
#if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISAC)) && \
|
||||
defined(WEBRTC_CODEC_ILBC) && defined(WEBRTC_CODEC_G722)
|
||||
#define IF_ALL_CODECS(x) x
|
||||
#else
|
||||
#define IF_ALL_CODECS(x) DISABLED_##x
|
||||
#endif
|
||||
|
||||
TEST_F(NetEqDecodingTest,
|
||||
DISABLED_ON_IOS(DISABLED_ON_ANDROID(TestBitExactness))) {
|
||||
DISABLED_ON_IOS(DISABLED_ON_ANDROID(IF_ALL_CODECS(TestBitExactness)))) {
|
||||
const std::string input_rtp_file = webrtc::test::ProjectRootPath() +
|
||||
"resources/audio_coding/neteq_universal_new.rtp";
|
||||
// Note that neteq4_universal_ref.pcm and neteq4_universal_ref_win_32.pcm
|
||||
@ -820,7 +829,13 @@ TEST_F(NetEqDecodingTest, UnknownPayloadType) {
|
||||
EXPECT_EQ(NetEq::kUnknownRtpPayloadType, neteq_->LastError());
|
||||
}
|
||||
|
||||
TEST_F(NetEqDecodingTest, DISABLED_ON_ANDROID(DecoderError)) {
|
||||
#if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
|
||||
#define IF_ISAC(x) x
|
||||
#else
|
||||
#define IF_ISAC(x) DISABLED_##x
|
||||
#endif
|
||||
|
||||
TEST_F(NetEqDecodingTest, DISABLED_ON_ANDROID(IF_ISAC(DecoderError))) {
|
||||
const size_t kPayloadBytes = 100;
|
||||
uint8_t payload[kPayloadBytes] = {0};
|
||||
WebRtcRTPHeader rtp_info;
|
||||
@ -1051,7 +1066,7 @@ TEST_F(NetEqBgnTestFade, RunTest) {
|
||||
CheckBgn(32000);
|
||||
}
|
||||
|
||||
TEST_F(NetEqDecodingTest, SyncPacketInsert) {
|
||||
TEST_F(NetEqDecodingTest, IF_ISAC(SyncPacketInsert)) {
|
||||
WebRtcRTPHeader rtp_info;
|
||||
uint32_t receive_timestamp = 0;
|
||||
// For the readability use the following payloads instead of the defaults of
|
||||
|
||||
@ -140,6 +140,7 @@ source_set("audio_processing") {
|
||||
defines = []
|
||||
deps = [
|
||||
"../..:webrtc_common",
|
||||
"../audio_coding:isac",
|
||||
]
|
||||
|
||||
if (aec_debug_dump) {
|
||||
|
||||
Reference in New Issue
Block a user