Reland of GN: Add BUILD.gn files for webrtc/{api,media,libjingle,p2p,pc}

Add BUILD.gn files for webrtc/{api,media,libjingle,p2p,pc} in
preparation for removing src/third_party/libjingle in Chromium.

BUG=webrtc:4256
NOTRY=True
TBR=perkj@webrtc.org

Review-Url: https://codereview.webrtc.org/1973313002
Cr-Commit-Position: refs/heads/master@{#12731}
diff --git a/webrtc/BUILD.gn b/webrtc/BUILD.gn
index e1aeb45..374e652 100644
--- a/webrtc/BUILD.gn
+++ b/webrtc/BUILD.gn
@@ -84,6 +84,10 @@
     all_dependent_configs = [ "dbus-glib" ]
   }
 
+  if (rtc_relative_path) {
+    defines += [ "EXPAT_RELATIVE_PATH" ]
+  }
+
   if (build_with_chromium) {
     defines += [ "LOGGING_INSIDE_WEBRTC" ]
   } else {
@@ -182,11 +186,13 @@
 
   deps = [
     ":webrtc_common",
+    "api",
     "audio",
     "base:rtc_base",
     "call",
     "common_audio",
     "common_video",
+    "media",
     "modules/audio_coding",
     "modules/audio_conference_mixer",
     "modules/audio_device",
@@ -198,6 +204,8 @@
     "modules/utility",
     "modules/video_coding",
     "modules/video_processing",
+    "p2p",
+    "pc",
     "system_wrappers",
     "tools",
     "video",
diff --git a/webrtc/api/BUILD.gn b/webrtc/api/BUILD.gn
index 6dc5217..f84010d 100644
--- a/webrtc/api/BUILD.gn
+++ b/webrtc/api/BUILD.gn
@@ -7,3 +7,130 @@
 # be found in the AUTHORS file in the root of the source tree.
 
 import("../build/webrtc.gni")
+
+group("api") {
+  deps = [
+    ":libjingle_peerconnection",
+  ]
+}
+
+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) {
+    cflags = [ "-Wno-sign-compare" ]
+    if (!is_clang) {
+      cflags += [ "-Wno-maybe-uninitialized" ]  # Only exists for GCC.
+    }
+  }
+}
+
+source_set("libjingle_peerconnection") {
+  cflags = []
+  sources = [
+    "audiotrack.cc",
+    "audiotrack.h",
+    "datachannel.cc",
+    "datachannel.h",
+    "datachannelinterface.h",
+    "dtlsidentitystore.cc",
+    "dtlsidentitystore.h",
+    "dtmfsender.cc",
+    "dtmfsender.h",
+    "dtmfsenderinterface.h",
+    "jsep.h",
+    "jsepicecandidate.cc",
+    "jsepicecandidate.h",
+    "jsepsessiondescription.cc",
+    "jsepsessiondescription.h",
+    "localaudiosource.cc",
+    "localaudiosource.h",
+    "mediaconstraintsinterface.cc",
+    "mediaconstraintsinterface.h",
+    "mediacontroller.cc",
+    "mediacontroller.h",
+    "mediastream.cc",
+    "mediastream.h",
+    "mediastreaminterface.h",
+    "mediastreamobserver.cc",
+    "mediastreamobserver.h",
+    "mediastreamprovider.h",
+    "mediastreamproxy.h",
+    "mediastreamtrack.h",
+    "mediastreamtrackproxy.h",
+    "notifier.h",
+    "peerconnection.cc",
+    "peerconnection.h",
+    "peerconnectionfactory.cc",
+    "peerconnectionfactory.h",
+    "peerconnectionfactoryproxy.h",
+    "peerconnectioninterface.h",
+    "peerconnectionproxy.h",
+    "proxy.h",
+    "remoteaudiosource.cc",
+    "remoteaudiosource.h",
+    "rtpparameters.h",
+    "rtpreceiver.cc",
+    "rtpreceiver.h",
+    "rtpreceiverinterface.h",
+    "rtpsender.cc",
+    "rtpsender.h",
+    "rtpsenderinterface.h",
+    "sctputils.cc",
+    "sctputils.h",
+    "statscollector.cc",
+    "statscollector.h",
+    "statstypes.cc",
+    "statstypes.h",
+    "streamcollection.h",
+    "videocapturertracksource.cc",
+    "videocapturertracksource.h",
+    "videosourceproxy.h",
+    "videotrack.cc",
+    "videotrack.h",
+    "videotracksource.cc",
+    "videotracksource.h",
+    "webrtcsdp.cc",
+    "webrtcsdp.h",
+    "webrtcsession.cc",
+    "webrtcsession.h",
+    "webrtcsessiondescriptionfactory.cc",
+    "webrtcsessiondescriptionfactory.h",
+  ]
+
+  configs += [
+    "..:common_config",
+    ":libjingle_peerconnection_warnings_config",
+  ]
+  public_configs = [ "..:common_inherited_config" ]
+
+  if (is_clang) {
+    # Suppress warnings from Chrome's Clang plugins.
+    # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
+    configs -= [ "//build/config/clang:extra_warnings" ]
+    configs -= [ "//build/config/clang:find_bad_constructs" ]
+  }
+
+  if (is_win) {
+    cflags += [ "/wd4389" ]  # signed/unsigned mismatch.
+  }
+
+  deps = [
+    "../media",
+    "../pc",
+  ]
+
+  if (rtc_use_quic) {
+    sources += [
+      "quicdatachannel.cc",
+      "quicdatachannel.h",
+      "quicdatatransport.cc",
+      "quicdatatransport.h",
+    ]
+    deps += [ "//third_party/libquic" ]
+    public_deps = [
+      "//third_party/libquic",
+    ]
+  }
+}
diff --git a/webrtc/build/webrtc.gni b/webrtc/build/webrtc.gni
index 8e1b952..72664c9 100644
--- a/webrtc/build/webrtc.gni
+++ b/webrtc/build/webrtc.gni
@@ -15,6 +15,9 @@
   # Disable this to avoid building the Opus audio codec.
   rtc_include_opus = true
 
+  # Disable to use absolute header paths for some libraries.
+  rtc_relative_path = true
+
   # Used to specify an external Jsoncpp include path when not compiling the
   # library that comes with WebRTC (i.e. rtc_build_json == 0).
   rtc_jsoncpp_root = "//third_party/jsoncpp/source/include"
@@ -37,11 +40,13 @@
   rtc_build_expat = true
   rtc_build_json = true
   rtc_build_libjpeg = true
+  rtc_build_libsrtp = true
   rtc_build_libvpx = true
   rtc_build_libyuv = true
   rtc_build_openmax_dl = true
   rtc_build_opus = true
   rtc_build_ssl = true
+  rtc_build_usrsctp = true
 
   # Disable by default.
   rtc_have_dbus_glib = false
@@ -95,12 +100,19 @@
   # http://www.openh264.org, https://www.ffmpeg.org/
   rtc_use_h264 = proprietary_codecs && !is_android && !is_ios
 
+  # Determines whether QUIC code will be built.
+  rtc_use_quic = false
+
   # FFmpeg must be initialized for |H264DecoderImpl| to work. This can be done
   # by WebRTC during |H264DecoderImpl::InitDecode| or externally. FFmpeg must
   # only be initialized once. Projects that initialize FFmpeg externally, such
   # as Chromium, must turn this flag off so that WebRTC does not also
   # initialize.
   rtc_initialize_ffmpeg = !build_with_chromium
+
+  # Build sources requiring GTK. NOTICE: This is not present in Chrome OS
+  # build environments, even if available for Chromium builds.
+  rtc_use_gtk = !build_with_chromium
 }
 
 # A second declare_args block, so that declarations within it can
diff --git a/webrtc/libjingle/xmllite/BUILD.gn b/webrtc/libjingle/xmllite/BUILD.gn
new file mode 100644
index 0000000..8495580
--- /dev/null
+++ b/webrtc/libjingle/xmllite/BUILD.gn
@@ -0,0 +1,54 @@
+# 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("../../build/webrtc.gni")
+
+group("xmllite") {
+  deps = [
+    ":rtc_xmllite",
+  ]
+}
+
+source_set("rtc_xmllite") {
+  sources = [
+    "qname.cc",
+    "qname.h",
+    "xmlbuilder.cc",
+    "xmlbuilder.h",
+    "xmlconstants.cc",
+    "xmlconstants.h",
+    "xmlelement.cc",
+    "xmlelement.h",
+    "xmlnsstack.cc",
+    "xmlnsstack.h",
+    "xmlparser.cc",
+    "xmlparser.h",
+    "xmlprinter.cc",
+    "xmlprinter.h",
+  ]
+
+  deps = [
+    "../../base:rtc_base",
+  ]
+
+  if (rtc_build_expat) {
+    deps += [ "//third_party/expat" ]
+    public_deps = [
+      "//third_party/expat",
+    ]
+  }
+
+  configs += [ "../..:common_config" ]
+  public_configs = [ "../..:common_inherited_config" ]
+
+  if (is_clang) {
+    # Suppress warnings from Chrome's Clang plugins.
+    # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
+    configs -= [ "//build/config/clang:find_bad_constructs" ]
+  }
+}
diff --git a/webrtc/libjingle/xmpp/BUILD.gn b/webrtc/libjingle/xmpp/BUILD.gn
new file mode 100644
index 0000000..a3dfc51
--- /dev/null
+++ b/webrtc/libjingle/xmpp/BUILD.gn
@@ -0,0 +1,154 @@
+# 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("../../build/webrtc.gni")
+
+group("xmpp") {
+  deps = [
+    ":rtc_xmpp",
+  ]
+}
+
+config("xmpp_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_android) {
+    cflags = [ "-Wno-error" ]
+  }
+}
+
+config("xmpp_inherited_config") {
+  defines = [
+    "FEATURE_ENABLE_SSL",
+    "FEATURE_ENABLE_VOICEMAIL",
+  ]
+}
+
+source_set("rtc_xmpp") {
+  cflags = []
+  sources = [
+    "asyncsocket.h",
+    "chatroommodule.h",
+    "chatroommoduleimpl.cc",
+    "constants.cc",
+    "constants.h",
+    "discoitemsquerytask.cc",
+    "discoitemsquerytask.h",
+    "hangoutpubsubclient.cc",
+    "hangoutpubsubclient.h",
+    "iqtask.cc",
+    "iqtask.h",
+    "jid.cc",
+    "jid.h",
+    "module.h",
+    "moduleimpl.cc",
+    "moduleimpl.h",
+    "mucroomconfigtask.cc",
+    "mucroomconfigtask.h",
+    "mucroomdiscoverytask.cc",
+    "mucroomdiscoverytask.h",
+    "mucroomlookuptask.cc",
+    "mucroomlookuptask.h",
+    "mucroomuniquehangoutidtask.cc",
+    "mucroomuniquehangoutidtask.h",
+    "pingtask.cc",
+    "pingtask.h",
+    "plainsaslhandler.h",
+    "presenceouttask.cc",
+    "presenceouttask.h",
+    "presencereceivetask.cc",
+    "presencereceivetask.h",
+    "presencestatus.cc",
+    "presencestatus.h",
+    "prexmppauth.h",
+    "pubsub_task.cc",
+    "pubsub_task.h",
+    "pubsubclient.cc",
+    "pubsubclient.h",
+    "pubsubstateclient.cc",
+    "pubsubstateclient.h",
+    "pubsubtasks.cc",
+    "pubsubtasks.h",
+    "receivetask.cc",
+    "receivetask.h",
+    "rostermodule.h",
+    "rostermoduleimpl.cc",
+    "rostermoduleimpl.h",
+    "saslcookiemechanism.h",
+    "saslhandler.h",
+    "saslmechanism.cc",
+    "saslmechanism.h",
+    "saslplainmechanism.h",
+    "xmppauth.cc",
+    "xmppauth.h",
+    "xmppclient.cc",
+    "xmppclient.h",
+    "xmppclientsettings.h",
+    "xmppengine.h",
+    "xmppengineimpl.cc",
+    "xmppengineimpl.h",
+    "xmppengineimpl_iq.cc",
+    "xmpplogintask.cc",
+    "xmpplogintask.h",
+    "xmpppump.cc",
+    "xmpppump.h",
+    "xmppsocket.cc",
+    "xmppsocket.h",
+    "xmppstanzaparser.cc",
+    "xmppstanzaparser.h",
+    "xmpptask.cc",
+    "xmpptask.h",
+    "xmppthread.cc",
+    "xmppthread.h",
+  ]
+
+  defines = [ "FEATURE_ENABLE_SSL" ]
+
+  deps = [
+    "../../base:rtc_base",
+    "../xmllite",
+  ]
+
+  if (rtc_build_expat) {
+    deps += [ "//third_party/expat" ]
+    public_deps = [
+      "//third_party/expat",
+    ]
+  }
+
+  configs += [
+    "../..:common_config",
+    ":xmpp_warnings_config",
+  ]
+
+  public_configs = [
+    "../..:common_inherited_config",
+    ":xmpp_inherited_config",
+  ]
+
+  if (!build_with_chromium) {
+    defines += [
+      "FEATURE_ENABLE_VOICEMAIL",
+      "FEATURE_ENABLE_PSTN",
+    ]
+  }
+
+  if (is_posix && is_debug) {
+    # The Chromium build/common.gypi defines this for all posix
+    # _except_ for ios & mac.  We want it there as well, e.g.
+    # because ASSERT and friends trigger off of it.
+    defines += [ "_DEBUG" ]
+  }
+
+  if (is_clang) {
+    # Suppress warnings from Chrome's Clang plugins.
+    # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
+    configs -= [ "//build/config/clang:find_bad_constructs" ]
+  }
+}
diff --git a/webrtc/media/BUILD.gn b/webrtc/media/BUILD.gn
new file mode 100644
index 0000000..c245d6e
--- /dev/null
+++ b/webrtc/media/BUILD.gn
@@ -0,0 +1,206 @@
+# 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("//build/config/linux/pkg_config.gni")
+import("../build/webrtc.gni")
+
+group("media") {
+  deps = [
+    ":rtc_media",
+  ]
+}
+
+config("rtc_media_defines_config") {
+  defines = [
+    "HAVE_WEBRTC_VIDEO",
+    "HAVE_WEBRTC_VOICE",
+  ]
+}
+
+config("rtc_media_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) {
+    cflags = [ "-Wno-deprecated-declarations" ]
+    cflags_cc = [ "-Wno-overloaded-virtual" ]
+  }
+}
+
+if (is_linux && rtc_use_gtk) {
+  pkg_config("gtk-lib") {
+    packages = [
+      "gobject-2.0",
+      "gthread-2.0",
+      "gtk+-2.0",
+    ]
+  }
+}
+
+source_set("rtc_media") {
+  defines = []
+  libs = []
+  deps = []
+  sources = [
+    "base/audiosource.h",
+    "base/codec.cc",
+    "base/codec.h",
+    "base/cpuid.cc",
+    "base/cpuid.h",
+    "base/cryptoparams.h",
+    "base/device.h",
+    "base/fakescreencapturerfactory.h",
+    "base/hybriddataengine.h",
+    "base/mediachannel.h",
+    "base/mediacommon.h",
+    "base/mediaconstants.cc",
+    "base/mediaconstants.h",
+    "base/mediaengine.cc",
+    "base/mediaengine.h",
+    "base/rtpdataengine.cc",
+    "base/rtpdataengine.h",
+    "base/rtpdump.cc",
+    "base/rtpdump.h",
+    "base/rtputils.cc",
+    "base/rtputils.h",
+    "base/screencastid.h",
+    "base/streamparams.cc",
+    "base/streamparams.h",
+    "base/turnutils.cc",
+    "base/turnutils.h",
+    "base/videoadapter.cc",
+    "base/videoadapter.h",
+    "base/videobroadcaster.cc",
+    "base/videobroadcaster.h",
+    "base/videocapturer.cc",
+    "base/videocapturer.h",
+    "base/videocapturerfactory.h",
+    "base/videocommon.cc",
+    "base/videocommon.h",
+    "base/videoframe.cc",
+    "base/videoframe.h",
+    "base/videoframefactory.cc",
+    "base/videoframefactory.h",
+    "base/videorenderer.h",
+    "base/videosourcebase.cc",
+    "base/videosourcebase.h",
+    "base/yuvframegenerator.cc",
+    "base/yuvframegenerator.h",
+    "devices/videorendererfactory.h",
+    "engine/nullwebrtcvideoengine.h",
+    "engine/simulcast.cc",
+    "engine/simulcast.h",
+    "engine/webrtccommon.h",
+    "engine/webrtcmediaengine.cc",
+    "engine/webrtcmediaengine.h",
+    "engine/webrtcvideocapturer.cc",
+    "engine/webrtcvideocapturer.h",
+    "engine/webrtcvideocapturerfactory.cc",
+    "engine/webrtcvideocapturerfactory.h",
+    "engine/webrtcvideodecoderfactory.h",
+    "engine/webrtcvideoencoderfactory.h",
+    "engine/webrtcvideoengine2.cc",
+    "engine/webrtcvideoengine2.h",
+    "engine/webrtcvideoframe.cc",
+    "engine/webrtcvideoframe.h",
+    "engine/webrtcvideoframefactory.cc",
+    "engine/webrtcvideoframefactory.h",
+    "engine/webrtcvoe.h",
+    "engine/webrtcvoiceengine.cc",
+    "engine/webrtcvoiceengine.h",
+    "sctp/sctpdataengine.cc",
+    "sctp/sctpdataengine.h",
+  ]
+
+  configs += [
+    "..:common_config",
+    ":rtc_media_warnings_config",
+  ]
+
+  public_configs = [ "..:common_inherited_config" ]
+
+  if (is_clang) {
+    # Suppress warnings from Chrome's Clang plugins.
+    # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
+    configs -= [ "//build/config/clang:extra_warnings" ]
+    configs -= [ "//build/config/clang:find_bad_constructs" ]
+  }
+
+  if (is_win) {
+    cflags = [
+      "/wd4245",  # conversion from "int" to "size_t", signed/unsigned mismatch.
+      "/wd4267",  # conversion from "size_t" to "int", possible loss of data.
+      "/wd4389",  # signed/unsigned mismatch.
+    ]
+  }
+
+  if (rtc_build_libyuv) {
+    deps += [ "$rtc_libyuv_dir" ]
+    public_deps = [
+      "$rtc_libyuv_dir",
+    ]
+  } else {
+    # Need to add a directory normally exported by libyuv.
+    include_dirs += [ "$rtc_libyuv_dir/include" ]
+  }
+
+  if (rtc_build_usrsctp) {
+    include_dirs = [
+      # TODO(jiayl): move this into the public_configs of
+      # //third_party/usrsctp/BUILD.gn.
+      "//third_party/usrsctp/usrsctplib",
+    ]
+    deps += [ "//third_party/usrsctp" ]
+  }
+
+  if (build_with_chromium) {
+    deps += [ "../modules/video_capture:video_capture" ]
+  } else {
+    configs += [ ":rtc_media_defines_config" ]
+    public_configs += [ ":rtc_media_defines_config" ]
+    deps += [ "../modules/video_capture:video_capture_internal_impl" ]
+  }
+  if (is_linux && rtc_use_gtk) {
+    sources += [
+      "devices/gtkvideorenderer.cc",
+      "devices/gtkvideorenderer.h",
+    ]
+    public_configs += [ ":gtk-lib" ]
+  }
+  if (is_win) {
+    sources += [
+      "devices/gdivideorenderer.cc",
+      "devices/gdivideorenderer.h",
+    ]
+    libs += [
+      "d3d9.lib",
+      "gdi32.lib",
+      "strmiids.lib",
+    ]
+  }
+  if (is_mac && current_cpu == "x86") {
+    sources += [
+      "devices/carbonvideorenderer.cc",
+      "devices/carbonvideorenderer.h",
+    ]
+    libs += [ "Carbon.framework" ]
+  }
+  if (is_ios || (is_mac && current_cpu != "x86")) {
+    defines += [ "CARBON_DEPRECATED=YES" ]
+  }
+
+  deps += [
+    "..:webrtc_common",
+    "../base:rtc_base_approved",
+    "../libjingle/xmllite",
+    "../libjingle/xmpp",
+    "../p2p",
+    "../system_wrappers",
+    "../voice_engine",
+  ]
+}
diff --git a/webrtc/p2p/BUILD.gn b/webrtc/p2p/BUILD.gn
new file mode 100644
index 0000000..538781b
--- /dev/null
+++ b/webrtc/p2p/BUILD.gn
@@ -0,0 +1,138 @@
+# 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("../build/webrtc.gni")
+
+group("p2p") {
+  deps = [
+    ":rtc_p2p",
+  ]
+}
+
+config("rtc_p2p_inherited_config") {
+  defines = [ "FEATURE_ENABLE_VOICEMAIL" ]
+}
+
+source_set("rtc_p2p") {
+  sources = [
+    "base/asyncstuntcpsocket.cc",
+    "base/asyncstuntcpsocket.h",
+    "base/basicpacketsocketfactory.cc",
+    "base/basicpacketsocketfactory.h",
+    "base/candidate.h",
+    "base/common.h",
+    "base/dtlstransportchannel.cc",
+    "base/dtlstransportchannel.h",
+    "base/p2pconstants.cc",
+    "base/p2pconstants.h",
+    "base/p2ptransport.cc",
+    "base/p2ptransport.h",
+    "base/p2ptransportchannel.cc",
+    "base/p2ptransportchannel.h",
+    "base/packetsocketfactory.h",
+    "base/port.cc",
+    "base/port.h",
+    "base/portallocator.cc",
+    "base/portallocator.h",
+    "base/portinterface.h",
+    "base/pseudotcp.cc",
+    "base/pseudotcp.h",
+    "base/relayport.cc",
+    "base/relayport.h",
+    "base/relayserver.cc",
+    "base/relayserver.h",
+    "base/sessiondescription.cc",
+    "base/sessiondescription.h",
+    "base/sessionid.h",
+    "base/stun.cc",
+    "base/stun.h",
+    "base/stunport.cc",
+    "base/stunport.h",
+    "base/stunrequest.cc",
+    "base/stunrequest.h",
+    "base/stunserver.cc",
+    "base/stunserver.h",
+    "base/tcpport.cc",
+    "base/tcpport.h",
+    "base/transport.cc",
+    "base/transport.h",
+    "base/transportchannel.cc",
+    "base/transportchannel.h",
+    "base/transportchannelimpl.h",
+    "base/transportcontroller.cc",
+    "base/transportcontroller.h",
+    "base/transportdescription.cc",
+    "base/transportdescription.h",
+    "base/transportdescriptionfactory.cc",
+    "base/transportdescriptionfactory.h",
+    "base/transportinfo.h",
+    "base/turnport.cc",
+    "base/turnport.h",
+    "base/turnserver.cc",
+    "base/turnserver.h",
+    "base/udpport.h",
+    "client/basicportallocator.cc",
+    "client/basicportallocator.h",
+    "client/httpportallocator.cc",
+    "client/httpportallocator.h",
+    "client/socketmonitor.cc",
+    "client/socketmonitor.h",
+  ]
+
+  defines = [ "FEATURE_ENABLE_SSL" ]
+
+  deps = [
+    "../base:rtc_base",
+    "../libjingle/xmllite",
+  ]
+
+  if (rtc_build_expat) {
+    deps += [ "//third_party/expat" ]
+    public_deps = [
+      "//third_party/expat",
+    ]
+  }
+
+  configs += [ "..:common_config" ]
+  public_configs = [
+    "..:common_inherited_config",
+    ":rtc_p2p_inherited_config",
+  ]
+
+  if (!build_with_chromium) {
+    defines += [
+      "FEATURE_ENABLE_VOICEMAIL",
+      "FEATURE_ENABLE_PSTN",
+    ]
+  }
+
+  if (rtc_use_quic) {
+    deps = [
+      "//third_party/libquic",
+    ]
+    sources += [
+      "quic/quicconnectionhelper.cc",
+      "quic/quicconnectionhelper.h",
+      "quic/quicsession.cc",
+      "quic/quicsession.h",
+      "quic/quictransport.cc",
+      "quic/quictransport.h",
+      "quic/quictransportchannel.cc",
+      "quic/quictransportchannel.h",
+      "quic/reliablequicstream.cc",
+      "quic/reliablequicstream.h",
+    ]
+    public_deps += [ "//third_party/libquic" ]
+  }
+
+  if (is_clang) {
+    # Suppress warnings from Chrome's Clang plugins.
+    # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
+    configs -= [ "//build/config/clang:find_bad_constructs" ]
+  }
+}
diff --git a/webrtc/pc/BUILD.gn b/webrtc/pc/BUILD.gn
new file mode 100644
index 0000000..50bb26a
--- /dev/null
+++ b/webrtc/pc/BUILD.gn
@@ -0,0 +1,70 @@
+# 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("../build/webrtc.gni")
+
+group("pc") {
+  deps = [
+    ":rtc_pc",
+  ]
+}
+
+config("rtc_pc_config") {
+  defines = [
+    "SRTP_RELATIVE_PATH",
+    "HAVE_SCTP",
+    "HAVE_SRTP",
+  ]
+}
+
+source_set("rtc_pc") {
+  defines = []
+  sources = [
+    "audiomonitor.cc",
+    "audiomonitor.h",
+    "bundlefilter.cc",
+    "bundlefilter.h",
+    "channel.cc",
+    "channel.h",
+    "channelmanager.cc",
+    "channelmanager.h",
+    "currentspeakermonitor.cc",
+    "currentspeakermonitor.h",
+    "mediamonitor.cc",
+    "mediamonitor.h",
+    "mediasession.cc",
+    "mediasession.h",
+    "mediasink.h",
+    "rtcpmuxfilter.cc",
+    "rtcpmuxfilter.h",
+    "srtpfilter.cc",
+    "srtpfilter.h",
+    "voicechannel.h",
+  ]
+
+  deps = [
+    "../base:rtc_base",
+    "../media",
+  ]
+
+  if (rtc_build_libsrtp) {
+    deps += [ "//third_party/libsrtp" ]
+  }
+
+  configs += [ "..:common_config" ]
+  public_configs = [
+    "..:common_inherited_config",
+    ":rtc_pc_config",
+  ]
+
+  if (is_clang) {
+    # Suppress warnings from Chrome's Clang plugins.
+    # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
+    configs -= [ "//build/config/clang:find_bad_constructs" ]
+  }
+}