Remove //rtc_base:refcount from public deps

Bug: webrtc:8603
Change-Id: Ib27a107ae809df739492846175f0e9c4af40d21a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/257910
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Auto-Submit: Florent Castelli <orphis@webrtc.org>
Reviewed-by: Florent Castelli <orphis@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36447}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index 76b4e8e..0dd876f 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -93,6 +93,7 @@
     ":refcountedbase",
     ":rtp_headers",
     ":scoped_refptr",
+    "../rtc_base:refcount",
     "../rtc_base:rtc_base_approved",
     "../rtc_base/system:rtc_export",
     "units:timestamp",
@@ -191,6 +192,7 @@
     "../call:rtp_interfaces",
     "../rtc_base:logging",
     "../rtc_base:network_constants",
+    "../rtc_base:refcount",
     "adaptation:resource_adaptation_api",
     "audio:audio_mixer_api",
     "audio_codecs:audio_codecs_api",
@@ -616,6 +618,7 @@
     ":scoped_refptr",
     "../api:refcountedbase",
     "../rtc_base:checks",
+    "../rtc_base:refcount",
     "../rtc_base:rtc_base_approved",
     "../rtc_base/system:rtc_export",
   ]
@@ -960,6 +963,7 @@
       ":libjingle_peerconnection_api",
       ":rtp_parameters",
       "../rtc_base:checks",
+      "../rtc_base:refcount",
       "../rtc_base:rtc_base_approved",
       "crypto:frame_encryptor_interface",
     ]
@@ -977,6 +981,7 @@
       ":libjingle_peerconnection_api",
       ":rtp_parameters",
       "../rtc_base:checks",
+      "../rtc_base:refcount",
       "../rtc_base:rtc_base_approved",
       "crypto:frame_decryptor_interface",
     ]
diff --git a/api/audio/BUILD.gn b/api/audio/BUILD.gn
index b9bf848..b16f59c 100644
--- a/api/audio/BUILD.gn
+++ b/api/audio/BUILD.gn
@@ -37,6 +37,7 @@
 
   deps = [
     ":audio_frame_api",
+    "../../rtc_base:refcount",
     "../../rtc_base:rtc_base_approved",
   ]
 }
diff --git a/api/audio_codecs/BUILD.gn b/api/audio_codecs/BUILD.gn
index 4fd30ce..8d74576 100644
--- a/api/audio_codecs/BUILD.gn
+++ b/api/audio_codecs/BUILD.gn
@@ -34,6 +34,7 @@
     "..:scoped_refptr",
     "../../api:field_trials_view",
     "../../rtc_base:checks",
+    "../../rtc_base:refcount",
     "../../rtc_base:rtc_base_approved",
     "../../rtc_base:sanitizer",
     "../../rtc_base/system:rtc_export",
diff --git a/api/video/BUILD.gn b/api/video/BUILD.gn
index e38973f..11b847f 100644
--- a/api/video/BUILD.gn
+++ b/api/video/BUILD.gn
@@ -68,6 +68,7 @@
     "..:scoped_refptr",
     "..:video_track_source_constraints",
     "../../rtc_base:checks",
+    "../../rtc_base:refcount",
     "../../rtc_base:rtc_base_approved",
     "../../rtc_base/memory:aligned_malloc",
     "../../rtc_base/system:rtc_export",
@@ -94,6 +95,7 @@
     "..:scoped_refptr",
     "../../rtc_base",
     "../../rtc_base:checks",
+    "../../rtc_base:refcount",
     "../../rtc_base/memory:aligned_malloc",
     "//third_party/libyuv",
   ]
@@ -139,6 +141,7 @@
     "..:rtp_packet_info",
     "..:scoped_refptr",
     "../../rtc_base:checks",
+    "../../rtc_base:refcount",
     "../../rtc_base:rtc_base_approved",
     "../../rtc_base/system:rtc_export",
   ]
diff --git a/api/video_codecs/BUILD.gn b/api/video_codecs/BUILD.gn
index cce05a6..bff7a3f 100644
--- a/api/video_codecs/BUILD.gn
+++ b/api/video_codecs/BUILD.gn
@@ -47,6 +47,7 @@
     "../../modules/video_coding:codec_globals_headers",
     "../../rtc_base:checks",
     "../../rtc_base:macromagic",
+    "../../rtc_base:refcount",
     "../../rtc_base:rtc_base_approved",
     "../../rtc_base/system:rtc_export",
     "../units:data_rate",
diff --git a/audio/BUILD.gn b/audio/BUILD.gn
index 0af7516..0a812b0 100644
--- a/audio/BUILD.gn
+++ b/audio/BUILD.gn
@@ -90,6 +90,7 @@
     "../rtc_base:logging",
     "../rtc_base:macromagic",
     "../rtc_base:rate_limiter",
+    "../rtc_base:refcount",
     "../rtc_base:rtc_base_approved",
     "../rtc_base:rtc_task_queue",
     "../rtc_base:safe_minmax",
@@ -182,6 +183,7 @@
       "../modules/utility",
       "../rtc_base:checks",
       "../rtc_base:macromagic",
+      "../rtc_base:refcount",
       "../rtc_base:rtc_base_approved",
       "../rtc_base:rtc_base_tests_utils",
       "../rtc_base:safe_compare",
diff --git a/call/BUILD.gn b/call/BUILD.gn
index e05766d..2849fba 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -71,6 +71,7 @@
     "../rtc_base",
     "../rtc_base:audio_format_to_string",
     "../rtc_base:checks",
+    "../rtc_base:refcount",
     "../rtc_base:rtc_base_approved",
     "../rtc_base/network:sent_packet",
   ]
diff --git a/call/adaptation/BUILD.gn b/call/adaptation/BUILD.gn
index 74d5b0b..f77094a 100644
--- a/call/adaptation/BUILD.gn
+++ b/call/adaptation/BUILD.gn
@@ -46,6 +46,7 @@
     "../../rtc_base:checks",
     "../../rtc_base:logging",
     "../../rtc_base:macromagic",
+    "../../rtc_base:refcount",
     "../../rtc_base:rtc_base_approved",
     "../../rtc_base:rtc_task_queue",
     "../../rtc_base/experiments:balanced_degradation_settings",
@@ -116,6 +117,7 @@
       "../../api/adaptation:resource_adaptation_api",
       "../../api/task_queue:task_queue",
       "../../api/video:video_stream_encoder",
+      "../../rtc_base:refcount",
       "../../rtc_base:rtc_base_approved",
       "../../rtc_base/task_utils:to_queued_task",
       "../../test:test_support",
diff --git a/common_video/BUILD.gn b/common_video/BUILD.gn
index 6b426bf..ca16a97 100644
--- a/common_video/BUILD.gn
+++ b/common_video/BUILD.gn
@@ -60,6 +60,7 @@
     "../rtc_base:checks",
     "../rtc_base:logging",
     "../rtc_base:macromagic",
+    "../rtc_base:refcount",
     "../rtc_base:rtc_task_queue",
     "../rtc_base:safe_minmax",
     "../rtc_base/synchronization:mutex",
diff --git a/examples/BUILD.gn b/examples/BUILD.gn
index fd0d33c..33aab62 100644
--- a/examples/BUILD.gn
+++ b/examples/BUILD.gn
@@ -687,6 +687,7 @@
       "../rtc_base:logging",
       "../rtc_base:macromagic",
       "../rtc_base:net_helpers",
+      "../rtc_base:refcount",
       "../rtc_base:threading",
       "../rtc_base/third_party/sigslot",
       "../system_wrappers:field_trial",
diff --git a/modules/async_audio_processing/BUILD.gn b/modules/async_audio_processing/BUILD.gn
index 9330b67..506849d 100644
--- a/modules/async_audio_processing/BUILD.gn
+++ b/modules/async_audio_processing/BUILD.gn
@@ -23,6 +23,7 @@
     "../../api/audio:audio_frame_processor",
     "../../api/task_queue:task_queue",
     "../../rtc_base:checks",
+    "../../rtc_base:refcount",
     "../../rtc_base:rtc_base_approved",
     "../../rtc_base:rtc_task_queue",
   ]
diff --git a/modules/audio_coding/BUILD.gn b/modules/audio_coding/BUILD.gn
index 6ca86fb..2a7231c 100644
--- a/modules/audio_coding/BUILD.gn
+++ b/modules/audio_coding/BUILD.gn
@@ -1540,6 +1540,7 @@
       defines = audio_codec_defines
       deps = [
         "../../rtc_base:checks",
+        "../../rtc_base:refcount",
         "../../test:fileutils",
       ]
       absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
@@ -2087,6 +2088,7 @@
         "../../rtc_base:checks",
         "../../rtc_base:ignore_wundef",
         "../../rtc_base:macromagic",
+        "../../rtc_base:refcount",
         "../../rtc_base:rtc_base_approved",
         "../../rtc_base:rtc_base_tests_utils",
         "../../rtc_base:sanitizer",
diff --git a/modules/audio_device/BUILD.gn b/modules/audio_device/BUILD.gn
index 06112c5..ba21bda 100644
--- a/modules/audio_device/BUILD.gn
+++ b/modules/audio_device/BUILD.gn
@@ -51,6 +51,7 @@
     "../../api:scoped_refptr",
     "../../api/task_queue",
     "../../rtc_base:checks",
+    "../../rtc_base:refcount",
     "../../rtc_base:rtc_base_approved",
     "../../rtc_base:stringutils",
   ]
@@ -153,6 +154,7 @@
       "../../rtc_base:checks",
       "../../rtc_base:logging",
       "../../rtc_base:macromagic",
+      "../../rtc_base:refcount",
       "../../rtc_base:rtc_base_approved",
     ]
     absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
@@ -179,6 +181,7 @@
     "../../rtc_base:checks",
     "../../rtc_base:logging",
     "../../rtc_base:macromagic",
+    "../../rtc_base:refcount",
     "../../rtc_base:rtc_base_approved",
     "../../rtc_base:rtc_task_queue",
     "../../rtc_base/synchronization:mutex",
diff --git a/modules/audio_mixer/BUILD.gn b/modules/audio_mixer/BUILD.gn
index a98cc77..93da77f 100644
--- a/modules/audio_mixer/BUILD.gn
+++ b/modules/audio_mixer/BUILD.gn
@@ -48,6 +48,7 @@
     "../../rtc_base:checks",
     "../../rtc_base:logging",
     "../../rtc_base:macromagic",
+    "../../rtc_base:refcount",
     "../../rtc_base:rtc_base_approved",
     "../../rtc_base:safe_conversions",
     "../../rtc_base/synchronization:mutex",
diff --git a/modules/audio_processing/BUILD.gn b/modules/audio_processing/BUILD.gn
index 93b7392..4d9070a 100644
--- a/modules/audio_processing/BUILD.gn
+++ b/modules/audio_processing/BUILD.gn
@@ -34,6 +34,7 @@
     "../../api/audio:audio_frame_api",
     "../../api/audio:echo_control",
     "../../rtc_base:macromagic",
+    "../../rtc_base:refcount",
     "../../rtc_base:rtc_base_approved",
     "../../rtc_base/system:arch",
     "../../rtc_base/system:file_wrapper",
@@ -380,6 +381,7 @@
         "../../rtc_base:ignore_wundef",
         "../../rtc_base:macromagic",
         "../../rtc_base:protobuf_utils",
+        "../../rtc_base:refcount",
         "../../rtc_base:rtc_base_approved",
         "../../rtc_base:rtc_base_tests_utils",
         "../../rtc_base:safe_minmax",
@@ -624,6 +626,7 @@
     "../../api/audio:audio_frame_api",
     "../../common_audio",
     "../../rtc_base:checks",
+    "../../rtc_base:refcount",
     "../../rtc_base:rtc_base_approved",
     "../../rtc_base/system:arch",
     "../../system_wrappers",
diff --git a/modules/desktop_capture/BUILD.gn b/modules/desktop_capture/BUILD.gn
index bb3604e..91e0c20 100644
--- a/modules/desktop_capture/BUILD.gn
+++ b/modules/desktop_capture/BUILD.gn
@@ -39,6 +39,7 @@
   deps = [
     "../../api:scoped_refptr",
     "../../rtc_base:checks",
+    "../../rtc_base:refcount",
     "../../rtc_base/system:rtc_export",
     "//third_party/libyuv",
   ]
@@ -482,6 +483,7 @@
     "../../rtc_base:checks",
     "../../rtc_base:logging",
     "../../rtc_base:macromagic",
+    "../../rtc_base:refcount",
     "../../rtc_base/synchronization:mutex",
     "../../rtc_base/system:arch",
     "../../rtc_base/system:no_unique_address",
diff --git a/modules/video_capture/BUILD.gn b/modules/video_capture/BUILD.gn
index 7cedf90..e8b0d9b 100644
--- a/modules/video_capture/BUILD.gn
+++ b/modules/video_capture/BUILD.gn
@@ -34,6 +34,7 @@
     "../../media:rtc_media_base",
     "../../rtc_base:logging",
     "../../rtc_base:macromagic",
+    "../../rtc_base:refcount",
     "../../rtc_base:rtc_base_approved",
     "../../rtc_base:stringutils",
     "../../rtc_base/synchronization:mutex",
@@ -52,6 +53,7 @@
       "../../rtc_base:checks",
       "../../rtc_base:logging",
       "../../rtc_base:macromagic",
+      "../../rtc_base:refcount",
       "../../rtc_base:rtc_base_approved",
       "../../rtc_base/synchronization:mutex",
       "../../system_wrappers",
diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn
index 8872d78..93ce778 100644
--- a/modules/video_coding/BUILD.gn
+++ b/modules/video_coding/BUILD.gn
@@ -521,6 +521,7 @@
     "../../rtc_base:bitstream_reader",
     "../../rtc_base:checks",
     "../../rtc_base:logging",
+    "../../rtc_base:refcount",
     "../../rtc_base:rtc_base_approved",
     "../../rtc_base:rtc_numerics",
     "../../rtc_base:rtc_task_queue",
@@ -1083,6 +1084,7 @@
       "../../media:rtc_media_base",
       "../../media:rtc_simulcast_encoder_adapter",
       "../../rtc_base",
+      "../../rtc_base:refcount",
       "../../test:explicit_key_value_config",
       "../../test:field_trial",
       "../../test:fileutils",
@@ -1238,6 +1240,7 @@
       "../../media:rtc_media_base",
       "../../rtc_base",
       "../../rtc_base:checks",
+      "../../rtc_base:refcount",
       "../../rtc_base:rtc_base_approved",
       "../../rtc_base:rtc_base_tests_utils",
       "../../rtc_base:rtc_numerics",
diff --git a/net/dcsctp/socket/BUILD.gn b/net/dcsctp/socket/BUILD.gn
index b573080..114f050 100644
--- a/net/dcsctp/socket/BUILD.gn
+++ b/net/dcsctp/socket/BUILD.gn
@@ -140,6 +140,7 @@
     "../../../api/task_queue:task_queue",
     "../../../rtc_base:checks",
     "../../../rtc_base:logging",
+    "../../../rtc_base:refcount",
     "../../../rtc_base:rtc_base_approved",
     "../common:internal_types",
     "../packet:bounded_io",
diff --git a/p2p/BUILD.gn b/p2p/BUILD.gn
index c5b1ccf..9114ddc 100644
--- a/p2p/BUILD.gn
+++ b/p2p/BUILD.gn
@@ -109,6 +109,7 @@
     "../rtc_base:macromagic",
     "../rtc_base:net_helpers",
     "../rtc_base:network_constants",
+    "../rtc_base:refcount",
     "../rtc_base:rtc_numerics",
     "../rtc_base:socket",
     "../rtc_base:socket_address",
@@ -256,6 +257,7 @@
       "../rtc_base:macromagic",
       "../rtc_base:net_helpers",
       "../rtc_base:network_constants",
+      "../rtc_base:refcount",
       "../rtc_base:rtc_base_approved",
       "../rtc_base:rtc_base_tests_utils",
       "../rtc_base:socket",
diff --git a/pc/BUILD.gn b/pc/BUILD.gn
index b79cd3c..c70a896 100644
--- a/pc/BUILD.gn
+++ b/pc/BUILD.gn
@@ -48,6 +48,7 @@
   deps = [
     "../api:scoped_refptr",
     "../api/task_queue",
+    "../rtc_base:refcount",
     "../rtc_base:rtc_base_approved",
     "../rtc_base:threading",
     "../rtc_base/system:rtc_export",
@@ -308,6 +309,7 @@
     "../rtc_base:checks",
     "../rtc_base:logging",
     "../rtc_base:macromagic",
+    "../rtc_base:refcount",
     "../rtc_base:rtc_base_approved",
     "../rtc_base:threading",
     "../rtc_base/third_party/sigslot",
@@ -1596,6 +1598,7 @@
     "../rtc_base:checks",
     "../rtc_base:logging",
     "../rtc_base:macromagic",
+    "../rtc_base:refcount",
     "../rtc_base:threading",
     "../rtc_base:weak_ptr",
     "../rtc_base/third_party/sigslot",
@@ -1646,6 +1649,7 @@
     "../media:rtc_media_base",
     "../rtc_base:checks",
     "../rtc_base:logging",
+    "../rtc_base:refcount",
     "../rtc_base:rtc_base",
     "../rtc_base:rtc_base_approved",
     "../rtc_base:threading",
@@ -1723,6 +1727,7 @@
     "../rtc_base:checks",
     "../rtc_base:logging",
     "../rtc_base:macromagic",
+    "../rtc_base:refcount",
     "../rtc_base:rtc_base_approved",
     "../rtc_base:threading",
     "../rtc_base/system:no_unique_address",
@@ -1868,6 +1873,7 @@
     "../rtc_base:checks",
     "../rtc_base:logging",
     "../rtc_base:macromagic",
+    "../rtc_base:refcount",
     "../rtc_base:rtc_base",
     "../rtc_base:threading",
     "../rtc_base/synchronization:mutex",
@@ -1917,6 +1923,7 @@
     "../rtc_base:checks",
     "../rtc_base:logging",
     "../rtc_base:macromagic",
+    "../rtc_base:refcount",
     "../rtc_base:rtc_base",
     "../rtc_base:threading",
     "../rtc_base/task_utils:pending_task_safety_flag",
@@ -2078,6 +2085,7 @@
       "../rtc_base:gunit_helpers",
       "../rtc_base:logging",
       "../rtc_base:macromagic",
+      "../rtc_base:refcount",
       "../rtc_base:rtc_base_approved",
       "../rtc_base:rtc_base_tests_utils",
       "../rtc_base:socket_address",
@@ -2137,6 +2145,7 @@
       "../rtc_base",
       "../rtc_base:checks",
       "../rtc_base:gunit_helpers",
+      "../rtc_base:refcount",
       "../rtc_base:rtc_base_tests_utils",
       "../rtc_base:socket_address",
       "../rtc_base:socket_factory",
@@ -2168,6 +2177,7 @@
       "../rtc_base:checks",
       "../rtc_base:gunit_helpers",
       "../rtc_base:logging",
+      "../rtc_base:refcount",
       "../rtc_base:rtc_base_approved",
       "../test:test_support",
     ]
@@ -2323,6 +2333,7 @@
       "../rtc_base:logging",
       "../rtc_base:macromagic",
       "../rtc_base:network_constants",
+      "../rtc_base:refcount",
       "../rtc_base:rtc_base_tests_utils",
       "../rtc_base:rtc_json",
       "../rtc_base:socket_address",
@@ -2497,6 +2508,7 @@
       "../rtc_base:ip_address",
       "../rtc_base:logging",
       "../rtc_base:macromagic",
+      "../rtc_base:refcount",
       "../rtc_base:rtc_base_tests_utils",
       "../rtc_base:rtc_json",
       "../rtc_base:socket_address",
@@ -2597,6 +2609,7 @@
       "../rtc_base:gunit_helpers",
       "../rtc_base:logging",
       "../rtc_base:macromagic",
+      "../rtc_base:refcount",
       "../rtc_base:rtc_base_approved",
       "../rtc_base:rtc_task_queue",
       "../rtc_base:task_queue_for_test",
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index 0a336ae..c667400 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -84,6 +84,7 @@
     ":checks",
     ":logging",
     ":macromagic",
+    ":refcount",
     ":rtc_task_queue",
     ":safe_compare",
     ":type_traits",
@@ -177,7 +178,6 @@
   public_deps += [  # no-presubmit-check TODO(webrtc:8603)
     ":platform_thread",
     ":platform_thread_types",
-    ":refcount",
     ":rtc_event",
     ":safe_conversions",
     ":stringutils",
@@ -813,6 +813,7 @@
     ":network_constants",
     ":null_socket_server",
     ":platform_thread_types",
+    ":refcount",
     ":rtc_base_approved",
     ":rtc_event",
     ":rtc_task_queue",
@@ -939,6 +940,7 @@
     ":macromagic",
     ":network_constants",
     ":null_socket_server",
+    ":refcount",
     ":rtc_task_queue",
     ":socket",
     ":socket_address",
@@ -1414,6 +1416,7 @@
         ":macromagic",
         ":null_socket_server",
         ":rate_limiter",
+        ":refcount",
         ":rtc_base",
         ":rtc_base_approved",
         ":rtc_base_tests_utils",
@@ -1552,6 +1555,7 @@
         ":macromagic",
         ":net_helpers",
         ":null_socket_server",
+        ":refcount",
         ":rtc_base_tests_utils",
         ":socket",
         ":socket_address",
diff --git a/rtc_tools/BUILD.gn b/rtc_tools/BUILD.gn
index d7c1afc..24db970 100644
--- a/rtc_tools/BUILD.gn
+++ b/rtc_tools/BUILD.gn
@@ -63,6 +63,7 @@
     "../api/video:video_rtp_headers",
     "../rtc_base:checks",
     "../rtc_base:logging",
+    "../rtc_base:refcount",
     "../rtc_base:rtc_base_approved",
   ]
   absl_deps = [
@@ -113,6 +114,7 @@
     "../common_video",
     "../rtc_base:checks",
     "../rtc_base:logging",
+    "../rtc_base:refcount",
     "../rtc_base:rtc_base_approved",
     "../test:perf_test",
     "//third_party/libyuv",
@@ -381,6 +383,7 @@
         "../rtc_base:ignore_wundef",
         "../rtc_base:logging",
         "../rtc_base:macromagic",
+        "../rtc_base:refcount",
 
         # TODO(kwiberg): Remove this dependency.
         "../api/audio_codecs:audio_codecs_api",
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index 00e48e6..bcc8dd7 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -234,6 +234,7 @@
           "../modules/audio_device:audio_device_generic",
           "../rtc_base:checks",
           "../rtc_base:logging",
+          "../rtc_base:refcount",
           "../rtc_base:rtc_base_approved",
           "../system_wrappers",
         ]
@@ -279,6 +280,7 @@
           "../rtc_base:checks",
           "../rtc_base:logging",
           "../rtc_base:macromagic",
+          "../rtc_base:refcount",
           "../rtc_base:threading",
           "../system_wrappers:field_trial",
           "../system_wrappers:metrics",
@@ -868,6 +870,7 @@
         "../api/video_codecs:video_codecs_api",
         "../modules/video_coding:video_codec_interface",
         "../rtc_base",
+        "../rtc_base:refcount",
       ]
     }
 
@@ -1104,6 +1107,7 @@
             "../rtc_base",
             "../rtc_base:gunit_helpers",
             "../rtc_base:macromagic",
+            "../rtc_base:refcount",
             "../rtc_base/system:unused",
             "../system_wrappers",
             "//third_party/libyuv",
@@ -1576,6 +1580,7 @@
         "../common_video",
         "../rtc_base",
         "../rtc_base:logging",
+        "../rtc_base:refcount",
         "../rtc_base:threading",
       ]
       if (is_ios) {
diff --git a/sdk/android/BUILD.gn b/sdk/android/BUILD.gn
index be44785..f316496 100644
--- a/sdk/android/BUILD.gn
+++ b/sdk/android/BUILD.gn
@@ -588,6 +588,7 @@
       "../../rtc_base:ip_address",
       "../../rtc_base:logging",
       "../../rtc_base:macromagic",
+      "../../rtc_base:refcount",
       "../../rtc_base:rtc_base_approved",
       "../../rtc_base:threading",
       "../../rtc_base/task_utils:pending_task_safety_flag",
@@ -692,6 +693,7 @@
       "../../rtc_base",
       "../../rtc_base:checks",
       "../../rtc_base:logging",
+      "../../rtc_base:refcount",
       "../../rtc_base:rtc_task_queue",
       "../../rtc_base:threading",
       "../../rtc_base/synchronization:mutex",
@@ -796,6 +798,7 @@
       "../../rtc_base",
       "../../rtc_base:checks",
       "../../rtc_base:logging",
+      "../../rtc_base:refcount",
       "../../rtc_base:rtc_base_approved",
       "../../rtc_base:rtc_task_queue",
       "../../rtc_base:threading",
@@ -983,6 +986,7 @@
       "../../modules/audio_device",
       "../../rtc_base:checks",
       "../../rtc_base:logging",
+      "../../rtc_base:refcount",
       "../../rtc_base:rtc_base_approved",
       "../../system_wrappers",
       "../../system_wrappers:metrics",
@@ -1075,6 +1079,7 @@
       ":native_api_jni",
       ":video_jni",
       ":videoframe_jni",
+      "../../rtc_base:refcount",
       "../../rtc_base:threading",
       "//api:libjingle_peerconnection_api",
       "//api:media_stream_interface",
@@ -1128,6 +1133,7 @@
       "../../common_video",
       "../../rtc_base",
       "../../rtc_base:checks",
+      "../../rtc_base:refcount",
       "../../rtc_base:rtc_base_approved",
     ]
   }
@@ -1169,6 +1175,7 @@
       "../../modules/audio_device:audio_device_buffer",
       "../../rtc_base:checks",
       "../../rtc_base:logging",
+      "../../rtc_base:refcount",
       "../../rtc_base:rtc_base_approved",
       "../../system_wrappers:metrics",
     ]
diff --git a/test/fuzzers/BUILD.gn b/test/fuzzers/BUILD.gn
index e342d1c..65db7ae 100644
--- a/test/fuzzers/BUILD.gn
+++ b/test/fuzzers/BUILD.gn
@@ -415,6 +415,7 @@
   deps = [
     "../../api/audio:echo_detector_creator",
     "../../rtc_base:checks",
+    "../../rtc_base:refcount",
     "../../rtc_base:rtc_base_approved",
   ]
 }
diff --git a/test/scenario/BUILD.gn b/test/scenario/BUILD.gn
index 561cd7b..1e66e3d 100644
--- a/test/scenario/BUILD.gn
+++ b/test/scenario/BUILD.gn
@@ -125,6 +125,7 @@
       "../../modules/video_coding:webrtc_vp9",
       "../../rtc_base",
       "../../rtc_base:checks",
+      "../../rtc_base:refcount",
       "../../rtc_base:rtc_base_approved",
       "../../rtc_base:rtc_base_tests_utils",
       "../../rtc_base:rtc_numerics",
diff --git a/video/BUILD.gn b/video/BUILD.gn
index fbde8a7..5e7d8b0 100644
--- a/video/BUILD.gn
+++ b/video/BUILD.gn
@@ -469,6 +469,7 @@
     "../rtc_base:criticalsection",
     "../rtc_base:logging",
     "../rtc_base:macromagic",
+    "../rtc_base:refcount",
     "../rtc_base:rtc_base_approved",
     "../rtc_base:rtc_event",
     "../rtc_base:rtc_numerics",
@@ -894,6 +895,7 @@
       "../rtc_base:logging",
       "../rtc_base:macromagic",
       "../rtc_base:rate_limiter",
+      "../rtc_base:refcount",
       "../rtc_base:rtc_base_approved",
       "../rtc_base:rtc_base_tests_utils",
       "../rtc_base:rtc_numerics",
diff --git a/video/adaptation/BUILD.gn b/video/adaptation/BUILD.gn
index 2844c5e..7bc48b4 100644
--- a/video/adaptation/BUILD.gn
+++ b/video/adaptation/BUILD.gn
@@ -50,6 +50,7 @@
     "../../rtc_base:checks",
     "../../rtc_base:logging",
     "../../rtc_base:macromagic",
+    "../../rtc_base:refcount",
     "../../rtc_base:rtc_base_approved",
     "../../rtc_base:rtc_event",
     "../../rtc_base:rtc_numerics",