Remove internal dependencies on pc:peerconnection target

This CL replaces those references with the smallest set of targets
that can satisfy the linker dependencies revealed by building the
"all" target.

Bug: webrtc:13634
Change-Id: Ia778630b18e1164138c41d245c3c8effed67f8e5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/257282
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36445}
diff --git a/BUILD.gn b/BUILD.gn
index 23e7ede..a291864 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -473,7 +473,6 @@
       "modules/video_capture:video_capture_internal_impl",
       "p2p:rtc_p2p",
       "pc:libjingle_peerconnection",
-      "pc:peerconnection",
       "pc:rtc_pc",
       "rtc_base",
       "sdk",
diff --git a/api/BUILD.gn b/api/BUILD.gn
index 9953ba7..76b4e8e 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -52,10 +52,12 @@
       "../media:rtc_media_base",
       "../modules/audio_device:audio_device_api",
       "../modules/audio_processing:api",
-      "../pc:peerconnection",
+      "../pc:peer_connection_factory",
+      "../pc:webrtc_sdp",
       "../rtc_base",
       "../rtc_base:rtc_base_approved",
       "../rtc_base:threading",
+      "../stats:rtc_stats",
       "audio:audio_mixer_api",
       "audio_codecs:audio_codecs_api",
       "task_queue:default_task_queue_factory",
diff --git a/examples/BUILD.gn b/examples/BUILD.gn
index 36db1d5..fd0d33c 100644
--- a/examples/BUILD.gn
+++ b/examples/BUILD.gn
@@ -739,7 +739,6 @@
       "../modules/audio_processing:api",
       "../modules/video_capture:video_capture_module",
       "../pc:libjingle_peerconnection",
-      "../pc:peerconnection",
       "../rtc_base",
       "../rtc_base:rtc_base_approved",
       "../rtc_base:rtc_json",
@@ -844,7 +843,6 @@
       "../modules/audio_processing:api",
       "../modules/video_capture:video_capture_module",
       "../pc:libjingle_peerconnection",
-      "../pc:peerconnection",
       "../pc:video_track_source",
       "../rtc_base",
       "../test:platform_video_capturer",
diff --git a/pc/BUILD.gn b/pc/BUILD.gn
index 8f9491e..4000642 100644
--- a/pc/BUILD.gn
+++ b/pc/BUILD.gn
@@ -980,7 +980,10 @@
   ]
 }
 rtc_source_set("rtc_stats_collector") {
-  visibility = [ ":*" ]
+  visibility = [
+    ":*",
+    "../api:*",
+  ]
   sources = [
     "rtc_stats_collector.cc",
     "rtc_stats_collector.h",
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index f5e35cf..00e48e6 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -1026,11 +1026,13 @@
         "../modules/audio_processing",
         "../modules/audio_processing:api",
         "../modules/video_coding:video_codec_interface",
-        "../pc:peerconnection",
+        "../pc:peer_connection_factory",
+        "../pc:webrtc_sdp",
         "../rtc_base",
         "../rtc_base:checks",
         "../rtc_base:logging",
         "../rtc_base:network_constants",
+        "../stats:rtc_stats",
         "../system_wrappers:field_trial",
         "../system_wrappers:metrics",
       ]
diff --git a/sdk/android/BUILD.gn b/sdk/android/BUILD.gn
index ef5666b..be44785 100644
--- a/sdk/android/BUILD.gn
+++ b/sdk/android/BUILD.gn
@@ -792,7 +792,6 @@
       "../../modules/audio_processing:api",
       "../../modules/utility",
       "../../pc:media_stream_observer",
-      "../../pc:peerconnection",
       "../../pc:webrtc_sdp",
       "../../rtc_base",
       "../../rtc_base:checks",
diff --git a/test/pc/e2e/BUILD.gn b/test/pc/e2e/BUILD.gn
index b011679..ed6b65d 100644
--- a/test/pc/e2e/BUILD.gn
+++ b/test/pc/e2e/BUILD.gn
@@ -298,7 +298,6 @@
         "../../../api:media_stream_interface",
         "../../../api:peer_connection_quality_test_fixture_api",
         "../../../api/video:video_frame",
-        "../../../pc:peerconnection",
         "../../../pc:session_description",
         "../../../pc:video_track_source",
       ]
@@ -398,7 +397,6 @@
         "../../../api/units:time_delta",
         "../../../api/units:timestamp",
         "../../../pc:pc_test_utils",
-        "../../../pc:peerconnection",
         "../../../pc:sdp_utils",
         "../../../rtc_base",
         "../../../rtc_base:gunit_helpers",
@@ -828,7 +826,6 @@
       "../../../api:rtp_parameters",
       "../../../media:rtc_media_base",
       "../../../p2p:rtc_p2p",
-      "../../../pc:peerconnection",
       "../../../pc:sdp_utils",
       "../../../pc:session_description",
       "../../../pc:simulcast_description",