Chromium Code Reviews| Index: webrtc/pc/BUILD.gn | 
| diff --git a/webrtc/pc/BUILD.gn b/webrtc/pc/BUILD.gn | 
| index 10256ce2f407cc3b76e5ee3c28dfbde8188536be..5cbc5b9d0b1762a8d853b64afcb697bb44db5213 100644 | 
| --- a/webrtc/pc/BUILD.gn | 
| +++ b/webrtc/pc/BUILD.gn | 
| @@ -25,7 +25,7 @@ config("rtc_pc_config") { | 
| } | 
| } | 
| -rtc_static_library("rtc_pc") { | 
| +rtc_static_library("rtc_pc_base") { | 
| defines = [] | 
| sources = [ | 
| "audiomonitor.cc", | 
| @@ -59,8 +59,9 @@ rtc_static_library("rtc_pc") { | 
| "../api:libjingle_peerconnection_api", | 
| "../api:ortc_api", | 
| "../base:rtc_base", | 
| - "../common_video:common_video", | 
| - "../media", | 
| + "../base:rtc_task_queue", | 
| + "../media:rtc_data", | 
| + "../media:rtc_media_base_data", | 
| "../p2p:rtc_p2p", | 
| ] | 
| @@ -76,6 +77,18 @@ rtc_static_library("rtc_pc") { | 
| } | 
| } | 
| +# TODO(zhihuang): Remove this once the downstream dependencies start using the | 
| +# modular targets. | 
| +rtc_source_set("rtc_pc") { | 
| + public_deps = [ | 
| + ":rtc_pc_base", | 
| + ] | 
| + | 
| + deps = [ | 
| + "../media:rtc_audio_video", | 
| + ] | 
| +} | 
| + | 
| config("libjingle_peerconnection_warnings_config") { | 
| # GN orders flags on a target before flags from configs. The default config | 
| # adds these flags so to cancel them out they need to come from a config and | 
| @@ -85,7 +98,111 @@ config("libjingle_peerconnection_warnings_config") { | 
| } | 
| } | 
| -rtc_static_library("libjingle_peerconnection") { | 
| +# This target contains the null implementation of the audio module and it is | 
| +# used to build WebRTC without audio support. | 
| +rtc_static_library("pc_null_audio") { | 
| + sources = [ | 
| + "nullaudiofactory.cc", | 
| + ] | 
| + | 
| + if (!build_with_chromium && is_clang) { | 
| + # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). | 
| + suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] | 
| + } | 
| + | 
| + deps = [ | 
| + "../api:libjingle_peerconnection_api", | 
| + "../base:rtc_base", | 
| + "../base:rtc_base_approved", | 
| + ] | 
| +} | 
| + | 
| +# This target contains the real implementation of the audio module and it is | 
| +# used to build WebRTC with audio support. It should never be used with | 
| +# "pc_null_audio" at the same time and it should always be linked with the | 
| +# "pc_media". | 
| +rtc_static_library("pc_audio") { | 
| + sources = [ | 
| + "audiofactory.cc", | 
| + ] | 
| + | 
| + deps = [ | 
| + "../api:audio_mixer_api", | 
| + "../api:libjingle_peerconnection_api", | 
| + "../api/audio_codecs:audio_codecs_api", | 
| + "../api/audio_codecs:builtin_audio_decoder_factory", | 
| + "../api/audio_codecs:builtin_audio_encoder_factory", | 
| + "../base:rtc_base", | 
| + "../base:rtc_base_approved", | 
| + "../media:rtc_audio_video", | 
| + "../modules/audio_device:audio_device", | 
| + ] | 
| + | 
| + if (!build_with_chromium && is_clang) { | 
| + # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). | 
| + suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] | 
| + } | 
| +} | 
| + | 
| +# This target contains the null implementation of the audio/video related | 
| +# objects and it is used to build WebRTC without audio and video support. | 
| +rtc_source_set("pc_null_media") { | 
| + sources = [ | 
| + "nullmediafactory.cc", | 
| + ] | 
| + | 
| + if (!build_with_chromium && is_clang) { | 
| + # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). | 
| + suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] | 
| + } | 
| + | 
| + deps = [ | 
| + "../logging:rtc_event_log_api", | 
| + ] | 
| +} | 
| + | 
| +# This target contains the real implementation of the audio/video related | 
| +# objects and it is used to build WebRTC with audio and video support. | 
| +rtc_source_set("pc_media") { | 
| + deps = [ | 
| + "../call", | 
| + "../media:rtc_audio_video", | 
| + ] | 
| + | 
| + if (!build_with_chromium && is_clang) { | 
| + # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). | 
| + suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] | 
| + } | 
| +} | 
| + | 
| +# The modular build targets can be used to build WebRTC with different | 
| +# functionalities. The users can choose either the real implemenation | 
| +# or the null implementation of the audio/video modules based on their | 
| +# requirements. | 
| +# | 
| +# For example, to build WebRTC with datachannel support only, we would need the | 
| +# the peerconnection and the null implementation of the audio and video modules. | 
| +# | 
| +# rtc_source_set("webrtc_datachannel_only") { | 
| 
 
kjellander_webrtc
2017/06/02 06:46:18
I'd like to get rid of all webrtc_ prefixes if we
 
 | 
| +# deps = [ | 
| +# ":pc_null_audio", | 
| +# ":pc_null_media", | 
| +# ":peerconnection", | 
| +# ] | 
| +# } | 
| +# | 
| +# To build WebRTC with all the audio, video and datachannel support, we would | 
| +# need the peerconnection and the real implementation of the audio and video | 
| +# modules. | 
| +# | 
| +# rtc_source_set("webrtc_full") { | 
| +# deps = [ | 
| +# ":pc_audio", | 
| +# ":pc_media", | 
| +# ":peerconnection", | 
| +# ] | 
| +# } | 
| +rtc_static_library("peerconnection") { | 
| cflags = [] | 
| sources = [ | 
| "audiotrack.cc", | 
| @@ -146,19 +263,17 @@ rtc_static_library("libjingle_peerconnection") { | 
| } | 
| deps = [ | 
| - ":rtc_pc", | 
| + ":rtc_pc_base", | 
| "..:webrtc_common", | 
| "../api:call_api", | 
| "../api:rtc_stats_api", | 
| - "../api/audio_codecs:builtin_audio_decoder_factory", | 
| - "../api/audio_codecs:builtin_audio_encoder_factory", | 
| "../api/video_codecs:video_codecs_api", | 
| "../base:rtc_base", | 
| "../base:rtc_base_approved", | 
| - "../call", | 
| + "../call:call_interfaces", | 
| "../logging:rtc_event_log_api", | 
| - "../media", | 
| - "../modules/audio_device:audio_device", | 
| + "../media:rtc_data", | 
| + "../media:rtc_media_base_data", | 
| "../p2p:rtc_p2p", | 
| "../stats", | 
| "../system_wrappers:system_wrappers", | 
| @@ -167,6 +282,17 @@ rtc_static_library("libjingle_peerconnection") { | 
| public_deps = [ | 
| "../api:libjingle_peerconnection_api", | 
| ] | 
| +} | 
| + | 
| +# TODO(zhihuang): Remove this once the downstream dependencies start using the | 
| +# modular targets. | 
| +rtc_source_set("libjingle_peerconnection") { | 
| + public_deps = [ | 
| + ":pc_audio", | 
| + ":pc_media", | 
| + ":peerconnection", | 
| + "../api:libjingle_peerconnection_api", | 
| + ] | 
| if (rtc_use_quic) { | 
| sources += [ | 
| @@ -244,6 +370,13 @@ if (rtc_include_tests) { | 
| } | 
| rtc_source_set("pc_test_utils") { | 
| + # Cannot have GN check enabled because this target would also be used in the | 
| + # "peerconnection_datachannelonly_unittests" and we don't want to depend on | 
| + # the target "media:rtc_media_tests_utils" indrectly since it contains all | 
| + # the audio and video related classes. | 
| + # TODO(zhihuang): Enable the check once the "media:rtc_media_tests_utils" is | 
| + # broken down to modular sub-targets. | 
| + check_includes = false | 
| testonly = true | 
| sources = [ | 
| "test/fakeaudiocapturemodule.cc", | 
| @@ -264,15 +397,13 @@ if (rtc_include_tests) { | 
| ] | 
| deps = [ | 
| - ":libjingle_peerconnection", | 
| + ":peerconnection", | 
| "..:webrtc_common", | 
| "../api:libjingle_peerconnection_test_api", | 
| "../api:rtc_stats_api", | 
| "../base:rtc_base", | 
| "../base:rtc_base_approved", | 
| "../base:rtc_base_tests_utils", | 
| - "../media:rtc_media", | 
| - "../media:rtc_media_tests_utils", | 
| "../modules/audio_device:audio_device", | 
| "../p2p:p2p_test_utils", | 
| "../test:test_support", | 
| @@ -398,4 +529,65 @@ if (rtc_include_tests) { | 
| shard_timeout = 900 | 
| } | 
| } | 
| + | 
| + rtc_test("peerconnection_datachannelonly_unittests") { | 
| + check_includes = false # TODO(zhihuang): Remove (bugs.webrtc.org/6828) | 
| + testonly = true | 
| + sources = [ | 
| + "peerconnection_datachannelonly_unittest.cc", | 
| + ] | 
| + | 
| + configs += [ ":peerconnection_unittests_config" ] | 
| + | 
| + if (!build_with_chromium && is_clang) { | 
| + # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). | 
| + suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] | 
| + } | 
| + | 
| + # TODO(jschuh): Bug 1348: fix this warning. | 
| + configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] | 
| + | 
| + if (is_win) { | 
| + cflags = [ | 
| + "/wd4245", # conversion from int to size_t, signed/unsigned mismatch. | 
| + "/wd4389", # signed/unsigned mismatch. | 
| + ] | 
| + } | 
| + | 
| + deps = [] | 
| + if (is_android) { | 
| + sources += [ | 
| + "test/androidtestinitializer.cc", | 
| + "test/androidtestinitializer.h", | 
| + ] | 
| + deps += [ | 
| + "//testing/android/native_test:native_test_support", | 
| + "//webrtc/sdk/android:base_jni", | 
| + "//webrtc/sdk/android:libjingle_peerconnection_java", | 
| + "//webrtc/sdk/android:null_audio_jni", | 
| + "//webrtc/sdk/android:null_video_jni", | 
| + ] | 
| + } | 
| + | 
| + deps += [ | 
| + ":pc_null_audio", | 
| + ":pc_null_media", | 
| + ":pc_test_utils", | 
| + ":peerconnection", | 
| + "..:webrtc_common", | 
| + "../api:fakemetricsobserver", | 
| + "../base:rtc_base_approved", | 
| + "../base:rtc_base_tests_main", | 
| + "../base:rtc_base_tests_utils", | 
| + "../modules/utility", | 
| + "../pc:rtc_pc_base", | 
| + "../system_wrappers:metrics_default", | 
| + "//testing/gmock", | 
| + ] | 
| + | 
| + if (is_android) { | 
| + deps += [ "//testing/android/native_test:native_test_support" ] | 
| + shard_timeout = 900 | 
| + } | 
| + } | 
| } |