# Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All contributing project authors may # be found in the AUTHORS file in the root of the source tree. import("../webrtc.gni") if (is_android) { import("//build/config/android/config.gni") import("//build/config/android/rules.gni") } group("pc") { deps = [ ":rtc_pc", ] } config("rtc_pc_config") { defines = [] if (rtc_enable_sctp) { defines += [ "HAVE_SCTP" ] } } rtc_static_library("rtc_pc_base") { visibility = [ "*" ] defines = [] sources = [ "channel.cc", "channel.h", "channelmanager.cc", "channelmanager.h", "dtlssrtptransport.cc", "dtlssrtptransport.h", "externalhmac.cc", "externalhmac.h", "jseptransport.cc", "jseptransport.h", "jseptransportcontroller.cc", "jseptransportcontroller.h", "mediasession.cc", "mediasession.h", "rtcpmuxfilter.cc", "rtcpmuxfilter.h", "rtpmediautils.cc", "rtpmediautils.h", "rtptransport.cc", "rtptransport.h", "rtptransportinternal.h", "rtptransportinternaladapter.h", "sessiondescription.cc", "sessiondescription.h", "srtpfilter.cc", "srtpfilter.h", "srtpsession.cc", "srtpsession.h", "srtptransport.cc", "srtptransport.h", "transportstats.cc", "transportstats.h", ] deps = [ "..:webrtc_common", "../api:array_view", "../api:call_api", "../api:libjingle_peerconnection_api", "../api:optional", "../api:ortc_api", "../api/video:video_frame", "../call:rtp_interfaces", "../call:rtp_receiver", "../common_video:common_video", "../media:rtc_data", "../media:rtc_h264_profile_id", "../media:rtc_media_base", "../modules/rtp_rtcp:rtp_rtcp_format", "../p2p:rtc_p2p", "../rtc_base:checks", "../rtc_base:rtc_base", "../rtc_base:rtc_task_queue", "../rtc_base:stringutils", ] if (rtc_build_libsrtp) { deps += [ "//third_party/libsrtp" ] } public_configs = [ ":rtc_pc_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" ] } } rtc_source_set("rtc_pc") { visibility = [ "*" ] allow_poison = [ "audio_codecs", # TODO(bugs.webrtc.org/8396): Remove. "software_video_codecs", # TODO(bugs.webrtc.org/7925): Remove. ] deps = [ ":rtc_pc_base", "../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 # cannot be on the target directly. if (!is_win && !is_clang) { cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC. } } rtc_static_library("peerconnection") { visibility = [ "*" ] cflags = [] sources = [ "audiotrack.cc", "audiotrack.h", "datachannel.cc", "datachannel.h", "dtmfsender.cc", "dtmfsender.h", "iceserverparsing.cc", "iceserverparsing.h", "jsepicecandidate.cc", "jsepsessiondescription.cc", "localaudiosource.cc", "localaudiosource.h", "mediastream.cc", "mediastream.h", "mediastreamobserver.cc", "mediastreamobserver.h", "mediastreamtrack.h", "peerconnection.cc", "peerconnection.h", "peerconnectionfactory.cc", "peerconnectionfactory.h", "peerconnectioninternal.h", "remoteaudiosource.cc", "remoteaudiosource.h", "rtcstatscollector.cc", "rtcstatscollector.h", "rtcstatstraversal.cc", "rtcstatstraversal.h", "rtpreceiver.cc", "rtpreceiver.h", "rtpsender.cc", "rtpsender.h", "rtptransceiver.cc", "rtptransceiver.h", "sctputils.cc", "sctputils.h", "sdputils.cc", "sdputils.h", "statscollector.cc", "statscollector.h", "streamcollection.h", "trackmediainfomap.cc", "trackmediainfomap.h", "videocapturertracksource.cc", "videocapturertracksource.h", "videotrack.cc", "videotrack.h", "videotracksource.cc", "videotracksource.h", "webrtcsdp.cc", "webrtcsdp.h", "webrtcsessiondescriptionfactory.cc", "webrtcsessiondescriptionfactory.h", ] configs += [ ":libjingle_peerconnection_warnings_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" ] } deps = [ ":rtc_pc_base", "..:webrtc_common", "../api:call_api", "../api:fec_controller_api", "../api:libjingle_peerconnection_api", "../api:optional", "../api:rtc_stats_api", "../api/video:video_frame", "../api/video_codecs:video_codecs_api", "../call:call_interfaces", "../common_video:common_video", "../logging:ice_log", "../logging:rtc_event_log_api", "../logging:rtc_event_log_impl_output", "../media:rtc_data", "../media:rtc_media_base", "../modules/congestion_controller/bbr", "../p2p:rtc_p2p", "../rtc_base:checks", "../rtc_base:rtc_base", "../rtc_base:rtc_base_approved", "../rtc_base:stringutils", "../rtc_base/experiments:congestion_controller_experiment", "../stats", "../system_wrappers", "../system_wrappers:field_trial_api", ] } # This target implements CreatePeerConnectionFactory methods that will create a # PeerConnection will full functionality (audio, video and data). Applications # that wish to reduce their binary size by ommitting functionality they don't # need should use CreateModularCreatePeerConnectionFactory instead, using the # "peerconnection" build target and other targets specific to their # requrements. See comment in peerconnectionfactoryinterface.h. rtc_static_library("create_pc_factory") { sources = [ "createpeerconnectionfactory.cc", ] deps = [ "../api:callfactory_api", "../api:libjingle_peerconnection_api", "../api/audio:audio_mixer_api", "../api/audio_codecs:audio_codecs_api", "../api/video_codecs:video_codecs_api", "../call", "../call:call_interfaces", "../logging:rtc_event_log_api", "../logging:rtc_event_log_impl_base", "../media:rtc_audio_video", "../media:rtc_media_base", "../modules/audio_device:audio_device", "../modules/audio_processing:audio_processing", "../rtc_base:rtc_base", "../rtc_base:rtc_base_approved", ] configs += [ ":libjingle_peerconnection_warnings_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" ] } } rtc_source_set("libjingle_peerconnection") { visibility = [ "*" ] allow_poison = [ "audio_codecs", # TODO(bugs.webrtc.org/8396): Remove. "software_video_codecs", # TODO(bugs.webrtc.org/7925): Remove. ] deps = [ ":create_pc_factory", ":peerconnection", "../api:libjingle_peerconnection_api", ] } if (rtc_include_tests) { config("rtc_pc_unittests_config") { # GN orders flags on a target before flags from configs. The default config # adds -Wall, and this flag have to be after -Wall -- so they need to # come from a config and can't be on the target directly. if (!is_win && !is_clang) { cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC. } } rtc_test("rtc_pc_unittests") { testonly = true sources = [ "channel_unittest.cc", "channelmanager_unittest.cc", "dtlssrtptransport_unittest.cc", "jseptransport_unittest.cc", "jseptransportcontroller_unittest.cc", "mediasession_unittest.cc", "rtcpmuxfilter_unittest.cc", "rtptransport_unittest.cc", "rtptransporttestutil.h", "srtpfilter_unittest.cc", "srtpsession_unittest.cc", "srtptestutil.h", "srtptransport_unittest.cc", ] include_dirs = [ "//third_party/libsrtp/srtp" ] configs += [ ":rtc_pc_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" ] } if (is_win) { libs = [ "strmiids.lib" ] } deps = [ ":libjingle_peerconnection", ":pc_test_utils", ":rtc_pc", ":rtc_pc_base", "../api:array_view", "../api:fakemetricsobserver", "../api:libjingle_peerconnection_api", "../call:rtp_interfaces", "../logging:rtc_event_log_api", "../media:rtc_media_base", "../media:rtc_media_tests_utils", "../modules/rtp_rtcp:rtp_rtcp_format", "../p2p:p2p_test_utils", "../p2p:rtc_p2p", "../rtc_base:checks", "../rtc_base:rtc_base", "../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_tests_main", "../rtc_base:rtc_base_tests_utils", "../system_wrappers:metrics_default", "../system_wrappers:runtime_enabled_features_default", "../test:test_support", ] if (rtc_build_libsrtp) { deps += [ "//third_party/libsrtp" ] } if (is_android) { deps += [ "//testing/android/native_test:native_test_support" ] } } rtc_source_set("pc_test_utils") { testonly = true sources = [ "test/fakeaudiocapturemodule.cc", "test/fakeaudiocapturemodule.h", "test/fakedatachannelprovider.h", "test/fakepeerconnectionbase.h", "test/fakepeerconnectionforstats.h", "test/fakeperiodicvideocapturer.h", "test/fakeperiodicvideosource.h", "test/fakeperiodicvideotracksource.h", "test/fakertccertificategenerator.h", "test/fakesctptransport.h", "test/fakevideotrackrenderer.h", "test/fakevideotracksource.h", "test/mock_datachannel.h", "test/mock_peerconnection.h", "test/mock_rtpreceiverinternal.h", "test/mock_rtpsenderinternal.h", "test/mockpeerconnectionobservers.h", "test/peerconnectiontestwrapper.cc", "test/peerconnectiontestwrapper.h", "test/rtcstatsobtainer.h", "test/testsdpstrings.h", ] deps = [ ":libjingle_peerconnection", ":peerconnection", ":rtc_pc_base", "..:webrtc_common", "../api:libjingle_peerconnection_api", "../api:libjingle_peerconnection_test_api", "../api:rtc_stats_api", "../api/video:video_frame", "../api/video_codecs:builtin_video_decoder_factory", "../api/video_codecs:builtin_video_encoder_factory", "../call:call_interfaces", "../logging:rtc_event_log_api", "../media:rtc_data", "../media:rtc_media", "../media:rtc_media_base", "../media:rtc_media_tests_utils", "../modules/audio_device:audio_device", "../modules/audio_processing:audio_processing", "../p2p:p2p_test_utils", "../rtc_base:checks", "../rtc_base:rtc_base", "../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_tests_utils", "../rtc_base:rtc_task_queue", "../test:test_support", ] 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" ] } } config("peerconnection_unittests_config") { # The warnings below are enabled by default. Since GN orders compiler flags # for a target before flags from configs, the only way to disable such # warnings is by having them in a separate config, loaded from the target. # TODO(kjellander): Make the code compile without disabling these flags. # See https://bugs.webrtc.org/3307. if (is_clang && is_win) { cflags = [ # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6267 # for -Wno-sign-compare "-Wno-sign-compare", ] } if (!is_win) { cflags = [ "-Wno-sign-compare" ] } } rtc_test("peerconnection_unittests") { testonly = true sources = [ "datachannel_unittest.cc", "dtmfsender_unittest.cc", "iceserverparsing_unittest.cc", "jsepsessiondescription_unittest.cc", "localaudiosource_unittest.cc", "mediaconstraintsinterface_unittest.cc", "mediastream_unittest.cc", "peerconnection_bundle_unittest.cc", "peerconnection_crypto_unittest.cc", "peerconnection_datachannel_unittest.cc", "peerconnection_ice_unittest.cc", "peerconnection_integrationtest.cc", "peerconnection_jsep_unittest.cc", "peerconnection_media_unittest.cc", "peerconnection_rtp_unittest.cc", "peerconnection_signaling_unittest.cc", "peerconnectionendtoend_unittest.cc", "peerconnectionfactory_unittest.cc", "peerconnectioninterface_unittest.cc", "peerconnectionwrapper.cc", "peerconnectionwrapper.h", "proxy_unittest.cc", "rtcstats_integrationtest.cc", "rtcstatscollector_unittest.cc", "rtcstatstraversal_unittest.cc", "rtpmediautils_unittest.cc", "rtpsenderreceiver_unittest.cc", "sctputils_unittest.cc", "statscollector_unittest.cc", "test/fakeaudiocapturemodule_unittest.cc", "test/testsdpstrings.h", "trackmediainfomap_unittest.cc", "videocapturertracksource_unittest.cc", "videotrack_unittest.cc", "webrtcsdp_unittest.cc", ] if (rtc_enable_sctp) { defines = [ "HAVE_SCTP" ] } 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 = [ ":peerconnection", ":rtc_pc_base", "../api:libjingle_peerconnection_api", "../api:mock_rtp", "../api/units:time_delta", "../rtc_base:checks", "../rtc_base:stringutils", "../test:fileutils", ] if (is_android) { deps += [ ":android_black_magic" ] } deps += [ ":libjingle_peerconnection", ":pc_test_utils", "..:webrtc_common", "../api:callfactory_api", "../api:fakemetricsobserver", "../api:libjingle_peerconnection_test_api", "../api:optional", "../api:rtc_stats_api", "../api/audio_codecs:audio_codecs_api", "../api/audio_codecs:builtin_audio_decoder_factory", "../api/audio_codecs:builtin_audio_encoder_factory", "../api/audio_codecs/L16:audio_decoder_L16", "../api/audio_codecs/L16:audio_encoder_L16", "../api/video_codecs:builtin_video_decoder_factory", "../api/video_codecs:builtin_video_encoder_factory", "../api/video_codecs:video_codecs_api", "../call:call_interfaces", "../logging:rtc_event_log_api", "../logging:rtc_event_log_impl_base", "../logging:rtc_event_log_impl_output", "../media:rtc_audio_video", "../media:rtc_data", # TODO(phoglund): AFAIK only used for one sctp constant. "../media:rtc_media_base", "../media:rtc_media_tests_utils", "../modules/audio_processing:audio_processing", "../modules/utility:utility", "../p2p:p2p_test_utils", "../p2p:rtc_p2p", "../pc:rtc_pc", "../rtc_base:rtc_base", "../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_tests_main", "../rtc_base:rtc_base_tests_utils", "../rtc_base:rtc_task_queue", "../system_wrappers:metrics_default", "../system_wrappers:runtime_enabled_features_default", "../test:audio_codec_mocks", "../test:test_support", ] if (is_android) { deps += [ "//testing/android/native_test:native_test_support", # We need to depend on this one directly, or classloads will fail for # the voice engine BuildInfo, for instance. "../sdk/android:libjingle_peerconnection_java", ] shard_timeout = 900 } } if (is_android) { rtc_source_set("android_black_magic") { # The android code uses hacky includes to chromium-base and the ssl code; # having this in a separate target enables us to keep the peerconnection # unit tests clean. check_includes = false testonly = true sources = [ "test/androidtestinitializer.cc", "test/androidtestinitializer.h", ] deps = [ "../sdk/android:libjingle_peerconnection_jni", "//testing/android/native_test:native_test_support", ] } } }