diff --git a/webrtc/build/common.gypi b/webrtc/build/common.gypi index 2c24963f4f..14f7e9a4a3 100644 --- a/webrtc/build/common.gypi +++ b/webrtc/build/common.gypi @@ -16,13 +16,23 @@ 'variables': { # This will already be set to zero by supplement.gypi 'build_with_chromium%': 1, + + # Enable to use the Mozilla internal settings. + 'build_with_mozilla%': 0, }, 'build_with_chromium%': '<(build_with_chromium)', - - # Enable to use the Mozilla internal settings. - 'build_with_mozilla%': 0, + 'build_with_mozilla%': '<(build_with_mozilla%)', + 'include_opus%': 1, 'conditions': [ + + # Include the iLBC audio codec? + ['build_with_chromium==1 or build_with_mozilla==1', { + 'include_ilbc%': 0, + }, { + 'include_ilbc%': 1, + }], + ['build_with_chromium==1', { 'webrtc_root%': '<(DEPTH)/third_party/webrtc', 'apk_tests_path%': '<(DEPTH)/third_party/webrtc/build/apk_tests_noop.gyp', @@ -41,17 +51,9 @@ 'modules_java_gyp_path%': '<(modules_java_gyp_path)', 'webrtc_vp8_dir%': '<(webrtc_root)/modules/video_coding/codecs/vp8', 'webrtc_vp9_dir%': '<(webrtc_root)/modules/video_coding/codecs/vp9', - 'include_opus%': 1, + 'include_ilbc%': '<(include_ilbc)', + 'include_opus%': '<(include_opus)', 'opus_dir%': '<(DEPTH)/third_party/opus', - - # 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)', diff --git a/webrtc/modules/audio_coding/BUILD.gn b/webrtc/modules/audio_coding/BUILD.gn index 38080af2f7..23b5fa46da 100644 --- a/webrtc/modules/audio_coding/BUILD.gn +++ b/webrtc/modules/audio_coding/BUILD.gn @@ -9,6 +9,36 @@ import("//build/config/arm.gni") import("../../build/webrtc.gni") +audio_codec_deps = [ + ":cng", + ":g711", + ":pcm16b", +] +audio_codec_defines = [] +if (rtc_include_ilbc) { + audio_codec_defines += [ "WEBRTC_CODEC_ILBC" ] + audio_codec_deps += [ ":ilbc" ] +} +if (rtc_include_opus) { + audio_codec_defines += [ "WEBRTC_CODEC_OPUS" ] + audio_codec_deps += [ ":webrtc_opus" ] +} +if (!build_with_mozilla) { + if (current_cpu == "arm") { + audio_codec_defines += [ "WEBRTC_CODEC_ISACFX" ] + audio_codec_deps += [ ":isac_fix" ] + } else { + audio_codec_defines += [ "WEBRTC_CODEC_ISAC" ] + audio_codec_deps += [ ":isac" ] + } + audio_codec_defines += [ "WEBRTC_CODEC_G722" ] + audio_codec_deps += [ ":g722" ] +} +if (!build_with_mozilla && !build_with_chromium) { + audio_codec_defines += [ "WEBRTC_CODEC_RED" ] + audio_codec_deps += [ ":red" ] +} + source_set("rent_a_codec") { sources = [ "acm2/acm_codec_database.cc", @@ -18,28 +48,8 @@ source_set("rent_a_codec") { ] configs += [ "../..:common_config" ] public_configs = [ "../..:common_inherited_config" ] - deps = [ - "../..:webrtc_common", - ] - - defines = [] - if (rtc_include_ilbc) { - defines += [ "WEBRTC_CODEC_ILBC" ] - } - if (rtc_include_opus) { - defines += [ "WEBRTC_CODEC_OPUS" ] - } - if (!build_with_mozilla) { - if (current_cpu == "arm") { - defines += [ "WEBRTC_CODEC_ISACFX" ] - } else { - defines += [ "WEBRTC_CODEC_ISAC" ] - } - defines += [ "WEBRTC_CODEC_G722" ] - } - if (!build_with_mozilla && !build_with_chromium) { - defines += [ "WEBRTC_CODEC_RED" ] - } + deps = [ "../..:webrtc_common" ] + audio_codec_deps + defines = audio_codec_defines } config("audio_coding_config") { @@ -91,41 +101,15 @@ source_set("audio_coding") { configs -= [ "//build/config/clang:find_bad_constructs" ] } - deps = [ - ":cng", - ":g711", - ":neteq", - ":pcm16b", - ":rent_a_codec", - "../..:rtc_event_log", - "../..:webrtc_common", - "../../common_audio", - "../../system_wrappers", - ] - - if (rtc_include_ilbc) { - defines += [ "WEBRTC_CODEC_ILBC" ] - deps += [ ":ilbc" ] - } - if (rtc_include_opus) { - 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_RED" ] - deps += [ ":red" ] - } + deps = audio_codec_deps + [ + ":neteq", + ":rent_a_codec", + "../..:rtc_event_log", + "../..:webrtc_common", + "../../common_audio", + "../../system_wrappers", + ] + defines = audio_codec_defines } source_set("audio_decoder_interface") { diff --git a/webrtc/modules/audio_coding/audio_coding.gypi b/webrtc/modules/audio_coding/audio_coding.gypi index d64fbeee29..e460853ac1 100644 --- a/webrtc/modules/audio_coding/audio_coding.gypi +++ b/webrtc/modules/audio_coding/audio_coding.gypi @@ -22,52 +22,61 @@ 'neteq/neteq.gypi', ], 'variables': { + 'variables': { + 'audio_codec_dependencies': [ + 'cng', + 'g711', + 'pcm16b', + ], + 'audio_codec_defines': [], + 'conditions': [ + ['include_ilbc==1', { + 'audio_codec_dependencies': ['ilbc',], + 'audio_codec_defines': ['WEBRTC_CODEC_ILBC',], + }], + ['include_opus==1', { + 'audio_codec_dependencies': ['webrtc_opus',], + 'audio_codec_defines': ['WEBRTC_CODEC_OPUS',], + }], + ['build_with_mozilla==0', { + 'conditions': [ + ['target_arch=="arm"', { + 'audio_codec_dependencies': ['isac_fix',], + 'audio_codec_defines': ['WEBRTC_CODEC_ISACFX',], + }, { + 'audio_codec_dependencies': ['isac',], + 'audio_codec_defines': ['WEBRTC_CODEC_ISAC',], + }], + ], + 'audio_codec_dependencies': ['g722',], + 'audio_codec_defines': ['WEBRTC_CODEC_G722',], + }], + ['build_with_mozilla==0 and build_with_chromium==0', { + 'audio_codec_dependencies': ['red',], + 'audio_codec_defines': ['WEBRTC_CODEC_RED',], + }], + ], + }, + 'audio_codec_dependencies': '<(audio_codec_dependencies)', + 'audio_codec_defines': '<(audio_codec_defines)', 'audio_coding_dependencies': [ - 'cng', - 'g711', - 'pcm16b', + '<@(audio_codec_dependencies)', '<(webrtc_root)/common.gyp:webrtc_common', '<(webrtc_root)/common_audio/common_audio.gyp:common_audio', '<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers', ], - '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',], - }], - ['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': ['red',], - 'audio_coding_defines': ['WEBRTC_CODEC_RED',], - }], - ], + 'audio_coding_defines': '<(audio_codec_defines)', }, 'targets': [ { 'target_name': 'rent_a_codec', 'type': 'static_library', 'defines': [ - '<@(audio_coding_defines)', + '<@(audio_codec_defines)', ], 'dependencies': [ '<(webrtc_root)/common.gyp:webrtc_common', + '<@(audio_codec_dependencies)', ], 'include_dirs': [ '<(webrtc_root)',