From f8c2baca4e7d61d90a73ef1145a359a4b6166b62 Mon Sep 17 00:00:00 2001 From: kwiberg Date: Mon, 18 Jan 2016 06:38:32 -0800 Subject: [PATCH] Add a gyp/gn variable for whether to use iLBC or not BUG=webrtc:5415 Review URL: https://codereview.webrtc.org/1578953003 Cr-Commit-Position: refs/heads/master@{#11291} --- webrtc/build/common.gypi | 15 ++++++++-- webrtc/build/webrtc.gni | 8 +++++ webrtc/modules/audio_coding/BUILD.gn | 30 +++++++++---------- webrtc/modules/audio_coding/audio_coding.gypi | 8 +++-- webrtc/modules/audio_coding/neteq/neteq.gypi | 8 ++--- 5 files changed, 45 insertions(+), 24 deletions(-) diff --git a/webrtc/build/common.gypi b/webrtc/build/common.gypi index 8d8583f9a4..2c24963f4f 100644 --- a/webrtc/build/common.gypi +++ b/webrtc/build/common.gypi @@ -19,6 +19,9 @@ }, 'build_with_chromium%': '<(build_with_chromium)', + # Enable to use the Mozilla internal settings. + 'build_with_mozilla%': 0, + 'conditions': [ ['build_with_chromium==1', { 'webrtc_root%': '<(DEPTH)/third_party/webrtc', @@ -32,6 +35,7 @@ ], }, 'build_with_chromium%': '<(build_with_chromium)', + 'build_with_mozilla%': '<(build_with_mozilla)', 'webrtc_root%': '<(webrtc_root)', 'apk_tests_path%': '<(apk_tests_path)', 'modules_java_gyp_path%': '<(modules_java_gyp_path)', @@ -40,8 +44,14 @@ 'include_opus%': 1, 'opus_dir%': '<(DEPTH)/third_party/opus', - # Enable to use the Mozilla internal settings. - 'build_with_mozilla%': 0, + # Include the iLBC audio codec? + 'conditions': [ + ['build_with_chromium==1 or build_with_mozilla==1', { + 'include_ilbc%': 0, + }, { + 'include_ilbc%': 1, + }], + ], }, 'build_with_chromium%': '<(build_with_chromium)', 'build_with_mozilla%': '<(build_with_mozilla)', @@ -50,6 +60,7 @@ 'modules_java_gyp_path%': '<(modules_java_gyp_path)', 'webrtc_vp8_dir%': '<(webrtc_vp8_dir)', 'webrtc_vp9_dir%': '<(webrtc_vp9_dir)', + 'include_ilbc%': '<(include_ilbc)', 'include_opus%': '<(include_opus)', 'rtc_relative_path%': 1, 'external_libraries%': '0', diff --git a/webrtc/build/webrtc.gni b/webrtc/build/webrtc.gni index c55f4230bd..ed8894f3c9 100644 --- a/webrtc/build/webrtc.gni +++ b/webrtc/build/webrtc.gni @@ -103,6 +103,14 @@ declare_args() { use_third_party_h264 = false # TODO(hbos): To be used in follow-up CL(s). } +# A second declare_args block, so that declarations within it can +# 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) +} + # Make it possible to provide custom locations for some libraries (move these # up into declare_args should we need to actually use them for the GN build). rtc_libvpx_dir = "//third_party/libvpx_new" diff --git a/webrtc/modules/audio_coding/BUILD.gn b/webrtc/modules/audio_coding/BUILD.gn index 000dd394df..38080af2f7 100644 --- a/webrtc/modules/audio_coding/BUILD.gn +++ b/webrtc/modules/audio_coding/BUILD.gn @@ -23,6 +23,9 @@ source_set("rent_a_codec") { ] defines = [] + if (rtc_include_ilbc) { + defines += [ "WEBRTC_CODEC_ILBC" ] + } if (rtc_include_opus) { defines += [ "WEBRTC_CODEC_OPUS" ] } @@ -35,10 +38,7 @@ source_set("rent_a_codec") { defines += [ "WEBRTC_CODEC_G722" ] } if (!build_with_mozilla && !build_with_chromium) { - defines += [ - "WEBRTC_CODEC_ILBC", - "WEBRTC_CODEC_RED", - ] + defines += [ "WEBRTC_CODEC_RED" ] } } @@ -103,6 +103,10 @@ source_set("audio_coding") { "../../system_wrappers", ] + if (rtc_include_ilbc) { + defines += [ "WEBRTC_CODEC_ILBC" ] + deps += [ ":ilbc" ] + } if (rtc_include_opus) { defines += [ "WEBRTC_CODEC_OPUS" ] deps += [ ":webrtc_opus" ] @@ -119,14 +123,8 @@ source_set("audio_coding") { deps += [ ":g722" ] } if (!build_with_mozilla && !build_with_chromium) { - defines += [ - "WEBRTC_CODEC_ILBC", - "WEBRTC_CODEC_RED", - ] - deps += [ - ":ilbc", - ":red", - ] + defines += [ "WEBRTC_CODEC_RED" ] + deps += [ ":red" ] } } @@ -850,6 +848,10 @@ source_set("neteq") { defines = [] + if (rtc_include_ilbc) { + defines += [ "WEBRTC_CODEC_ILBC" ] + deps += [ ":ilbc" ] + } if (rtc_include_opus) { defines += [ "WEBRTC_CODEC_OPUS" ] deps += [ ":webrtc_opus" ] @@ -865,8 +867,4 @@ source_set("neteq") { defines += [ "WEBRTC_CODEC_G722" ] deps += [ ":g722" ] } - if (!build_with_mozilla && !build_with_chromium) { - defines += [ "WEBRTC_CODEC_ILBC" ] - deps += [ ":ilbc" ] - } } diff --git a/webrtc/modules/audio_coding/audio_coding.gypi b/webrtc/modules/audio_coding/audio_coding.gypi index abdb1915c3..d64fbeee29 100644 --- a/webrtc/modules/audio_coding/audio_coding.gypi +++ b/webrtc/modules/audio_coding/audio_coding.gypi @@ -32,6 +32,10 @@ ], 'audio_coding_defines': [], 'conditions': [ + ['include_ilbc==1', { + 'audio_coding_dependencies': ['ilbc',], + 'audio_coding_defines': ['WEBRTC_CODEC_ILBC',], + }], ['include_opus==1', { 'audio_coding_dependencies': ['webrtc_opus',], 'audio_coding_defines': ['WEBRTC_CODEC_OPUS',], @@ -50,8 +54,8 @@ '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',], + 'audio_coding_dependencies': ['red',], + 'audio_coding_defines': ['WEBRTC_CODEC_RED',], }], ], }, diff --git a/webrtc/modules/audio_coding/neteq/neteq.gypi b/webrtc/modules/audio_coding/neteq/neteq.gypi index e424ab5bf9..50b8425c87 100644 --- a/webrtc/modules/audio_coding/neteq/neteq.gypi +++ b/webrtc/modules/audio_coding/neteq/neteq.gypi @@ -15,6 +15,10 @@ ], 'neteq_defines': [], 'conditions': [ + ['include_ilbc==1', { + 'codecs': ['ilbc',], + 'neteq_defines': ['WEBRTC_CODEC_ILBC',], + }], ['include_opus==1', { 'codecs': ['webrtc_opus',], 'neteq_defines': ['WEBRTC_CODEC_OPUS',], @@ -32,10 +36,6 @@ '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)',