build: cleanup api/ deps

using
  find api -name BUILD.gn | xargs tools_webrtc/gn_check_autofix.py -r
followed by
  tools_webrtc/gn_check_autofix.py -C out/Default
and cherry-picking changes.

Bug: webrtc:467294026
Change-Id: Icaf67aaf4aa2324fd8a0cc99a1bcb023f5063b52
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/462180
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Jeremy Leconte <jleconte@google.com>
Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com>
Cr-Commit-Position: refs/heads/main@{#47361}
diff --git a/api/adaptation/BUILD.gn b/api/adaptation/BUILD.gn
index 8e1579f..14538e8 100644
--- a/api/adaptation/BUILD.gn
+++ b/api/adaptation/BUILD.gn
@@ -16,9 +16,8 @@
   ]
   deps = [
     "..:ref_count",
-    "../../api:scoped_refptr",
+    "..:scoped_refptr",
     "../../rtc_base:checks",
-    "../../rtc_base:refcount",
     "../../rtc_base/system:rtc_export",
   ]
 }
diff --git a/api/audio/BUILD.gn b/api/audio/BUILD.gn
index 578930e..14b0961 100644
--- a/api/audio/BUILD.gn
+++ b/api/audio/BUILD.gn
@@ -51,7 +51,6 @@
     "..:rtp_packet_info",
     "../../rtc_base:checks",
     "../../rtc_base:logging",
-    "../../rtc_base:timeutils",
     "//third_party/abseil-cpp/absl/algorithm:container",
   ]
 }
@@ -67,9 +66,7 @@
 
   deps = [
     ":audio_frame_api",
-    "..:make_ref_counted",
     "..:ref_count",
-    "../../rtc_base:refcount",
   ]
 }
 
@@ -80,15 +77,12 @@
     "audio_processing.h",
   ]
   deps = [
-    ":aec3_config",
     ":audio_processing_statistics",
     ":echo_control",
     "..:ref_count",
     "..:scoped_refptr",
     "../../rtc_base:checks",
     "../../rtc_base:stringutils",
-    "../../rtc_base/system:arch",
-    "../../rtc_base/system:file_wrapper",
     "../../rtc_base/system:rtc_export",
     "../environment",
     "../task_queue",
@@ -112,7 +106,6 @@
     "..:make_ref_counted",
     "..:scoped_refptr",
     "../../modules/audio_processing",
-    "../../rtc_base:logging",
     "../../rtc_base/system:rtc_export",
     "../environment",
     "//third_party/abseil-cpp/absl/base:nullability",
@@ -165,7 +158,6 @@
   sources = [ "echo_control.h" ]
   deps = [
     ":neural_residual_echo_estimator_api",
-    "../../rtc_base:checks",
     "../environment",
     "//third_party/abseil-cpp/absl/base:nullability",
   ]
@@ -212,7 +204,7 @@
   deps = [
     ":audio_processing",
     "..:make_ref_counted",
-    "../../api:scoped_refptr",
+    "..:scoped_refptr",
     "../../modules/audio_processing:residual_echo_detector",
   ]
 }
diff --git a/api/audio_codecs/BUILD.gn b/api/audio_codecs/BUILD.gn
index 0d5b919..b5e5b10 100644
--- a/api/audio_codecs/BUILD.gn
+++ b/api/audio_codecs/BUILD.gn
@@ -32,16 +32,15 @@
     "..:bitrate_allocation",
     "..:make_ref_counted",
     "..:ref_count",
+    "..:rtp_parameters",
     "..:scoped_refptr",
-    "../../api:rtp_parameters",
-    "../../api/audio:audio_frame_api",
     "../../rtc_base:buffer",
     "../../rtc_base:checks",
     "../../rtc_base:event_tracer",
-    "../../rtc_base:refcount",
     "../../rtc_base:sanitizer",
     "../../rtc_base:stringutils",
     "../../rtc_base/system:rtc_export",
+    "../audio:audio_frame_api",
     "../environment",
     "../units:data_rate",
     "../units:time_delta",
diff --git a/api/audio_codecs/L16/BUILD.gn b/api/audio_codecs/L16/BUILD.gn
index 8ce7122..8355249 100644
--- a/api/audio_codecs/L16/BUILD.gn
+++ b/api/audio_codecs/L16/BUILD.gn
@@ -21,7 +21,7 @@
   ]
   deps = [
     "..:audio_codecs_api",
-    "../../../api:field_trials_view",
+    "../..:field_trials_view",
     "../../../modules/audio_coding:pcm16b",
     "../../../rtc_base:checks",
     "../../../rtc_base:safe_conversions",
@@ -41,7 +41,7 @@
   ]
   deps = [
     "..:audio_codecs_api",
-    "../../../api:field_trials_view",
+    "../..:field_trials_view",
     "../../../modules/audio_coding:pcm16b",
     "../../../rtc_base:safe_conversions",
     "../../../rtc_base/system:rtc_export",
diff --git a/api/audio_codecs/g711/BUILD.gn b/api/audio_codecs/g711/BUILD.gn
index 6c00e04..cfe3511 100644
--- a/api/audio_codecs/g711/BUILD.gn
+++ b/api/audio_codecs/g711/BUILD.gn
@@ -21,7 +21,6 @@
   ]
   deps = [
     "..:audio_codecs_api",
-    "../../../api:field_trials_view",
     "../../../modules/audio_coding:g711",
     "../../../rtc_base:checks",
     "../../../rtc_base:safe_conversions",
@@ -41,7 +40,6 @@
   ]
   deps = [
     "..:audio_codecs_api",
-    "../../../api:field_trials_view",
     "../../../modules/audio_coding:g711",
     "../../../rtc_base:checks",
     "../../../rtc_base:safe_conversions",
diff --git a/api/audio_codecs/g722/BUILD.gn b/api/audio_codecs/g722/BUILD.gn
index a3ee0d4..9c3c438 100644
--- a/api/audio_codecs/g722/BUILD.gn
+++ b/api/audio_codecs/g722/BUILD.gn
@@ -28,7 +28,7 @@
   deps = [
     ":audio_encoder_g722_config",
     "..:audio_codecs_api",
-    "../../../api:field_trials_view",
+    "../..:field_trials_view",
     "../../../modules/audio_coding:g722",
     "../../../rtc_base:checks",
     "../../../rtc_base:safe_conversions",
@@ -48,7 +48,7 @@
   ]
   deps = [
     "..:audio_codecs_api",
-    "../../../api:field_trials_view",
+    "../..:field_trials_view",
     "../../../modules/audio_coding:g722",
     "../../../rtc_base:checks",
     "../../../rtc_base:safe_conversions",
diff --git a/api/audio_codecs/opus/BUILD.gn b/api/audio_codecs/opus/BUILD.gn
index 31b3383..12cca83 100644
--- a/api/audio_codecs/opus/BUILD.gn
+++ b/api/audio_codecs/opus/BUILD.gn
@@ -88,11 +88,11 @@
     "audio_encoder_multi_channel_opus.h",
   ]
   deps = [
+    ":audio_encoder_opus_config",
     "..:audio_codecs_api",
-    "../../../api:field_trials_view",
+    "../..:field_trials_view",
     "../../../modules/audio_coding:webrtc_multiopus",
     "../../../rtc_base/system:rtc_export",
-    "../opus:audio_encoder_opus_config",
   ]
 }
 
@@ -106,7 +106,7 @@
   deps = [
     ":audio_decoder_opus_config",
     "..:audio_codecs_api",
-    "../../../api:field_trials_view",
+    "../..:field_trials_view",
     "../../../modules/audio_coding:webrtc_multiopus",
     "../../../rtc_base/system:rtc_export",
     "//third_party/abseil-cpp/absl/memory",
@@ -121,7 +121,6 @@
   deps = [
     ":audio_decoder_opus",
     "..:audio_codecs_api",
-    "../..:field_trials",
     "../../../test:create_test_field_trials",
     "../../../test:test_support",
     "../../environment",
diff --git a/api/crypto/BUILD.gn b/api/crypto/BUILD.gn
index e89016a..3467792 100644
--- a/api/crypto/BUILD.gn
+++ b/api/crypto/BUILD.gn
@@ -37,7 +37,6 @@
   deps = [
     "..:ref_count",
     "..:rtp_parameters",
-    "../../rtc_base:refcount",
   ]
 }
 
@@ -47,7 +46,6 @@
   deps = [
     "..:ref_count",
     "..:rtp_parameters",
-    "../../rtc_base:refcount",
   ]
 }
 
diff --git a/api/environment/BUILD.gn b/api/environment/BUILD.gn
index 7a2f7ca..b28c754 100644
--- a/api/environment/BUILD.gn
+++ b/api/environment/BUILD.gn
@@ -35,7 +35,7 @@
     "deprecated_global_field_trials.h",
   ]
   deps = [
-    "../:field_trials_registry",
+    "..:field_trials_registry",
     "../../rtc_base:checks",
     "../../rtc_base:logging",
     "//third_party/abseil-cpp/absl/strings:string_view",
diff --git a/api/task_queue/BUILD.gn b/api/task_queue/BUILD.gn
index ebc6ec0..c40c481 100644
--- a/api/task_queue/BUILD.gn
+++ b/api/task_queue/BUILD.gn
@@ -18,7 +18,6 @@
 
   deps = [
     "..:location",
-    "../../rtc_base:checks",
     "../../rtc_base:macromagic",
     "../../rtc_base/system:rtc_export",
     "../units:time_delta",
@@ -110,9 +109,9 @@
   ]
   deps = [
     ":task_queue",
-    "../../api:refcountedbase",
-    "../../api:scoped_refptr",
-    "../../api:sequence_checker",
+    "..:refcountedbase",
+    "..:scoped_refptr",
+    "..:sequence_checker",
     "../../rtc_base:checks",
     "../../rtc_base/system:no_unique_address",
     "../../rtc_base/system:rtc_export",
@@ -140,7 +139,6 @@
       ":task_queue",
       "..:scoped_refptr",
       "../../rtc_base:checks",
-      "../../rtc_base:logging",
       "../../rtc_base:rtc_event",
       "../../rtc_base:task_queue_for_test",
       "../../test:test_support",
diff --git a/api/task_queue/test/BUILD.gn b/api/task_queue/test/BUILD.gn
index f1438c7..b98a314 100644
--- a/api/task_queue/test/BUILD.gn
+++ b/api/task_queue/test/BUILD.gn
@@ -12,10 +12,10 @@
   testonly = true
   sources = [ "mock_task_queue_base.h" ]
   deps = [
+    "..:task_queue",
     "../..:location",
-    "../../../api/task_queue",
-    "../../../api/units:time_delta",
     "../../../test:test_support",
+    "../../units:time_delta",
     "//third_party/abseil-cpp/absl/functional:any_invocable",
   ]
 }
diff --git a/api/test/metrics/BUILD.gn b/api/test/metrics/BUILD.gn
index 7834e21..2bbcc58 100644
--- a/api/test/metrics/BUILD.gn
+++ b/api/test/metrics/BUILD.gn
@@ -190,7 +190,6 @@
     ":metric",
     ":metrics_exporter",
     ":metrics_logger",
-    "../../../rtc_base:checks",
     "../../../system_wrappers",
   ]
 }
diff --git a/api/test/network_emulation/BUILD.gn b/api/test/network_emulation/BUILD.gn
index 7e9e0ff..d7cd5d7 100644
--- a/api/test/network_emulation/BUILD.gn
+++ b/api/test/network_emulation/BUILD.gn
@@ -93,7 +93,6 @@
     "../..:simulated_network_api",
     "../../../rtc_base:checks",
     "../../../rtc_base:logging",
-    "../../../rtc_base:macromagic",
     "../../../rtc_base:random",
     "../../transport:ecn_marking",
     "../../units:data_rate",
diff --git a/api/transport/BUILD.gn b/api/transport/BUILD.gn
index 26737a2..a9c55b0 100644
--- a/api/transport/BUILD.gn
+++ b/api/transport/BUILD.gn
@@ -49,10 +49,9 @@
 
   deps = [
     ":ecn_marking",
-    "../../api:field_trials_view",
+    "..:field_trials_view",
     "../../rtc_base/system:rtc_export",
     "../environment",
-    "../rtc_event_log",
     "../units:data_rate",
     "../units:data_size",
     "../units:time_delta",
@@ -82,23 +81,20 @@
     ":network_control",
     "..:field_trials_view",
     "..:network_state_predictor_api",
-    "../../api/units:time_delta",
     "../../modules/congestion_controller/goog_cc",
     "../../modules/congestion_controller/goog_cc_scream_network_controller",
     "../../modules/congestion_controller/scream:scream_network_controller",
     "../../rtc_base:logging",
     "../../rtc_base/experiments:field_trial_parser",
     "../../rtc_base/system:rtc_export",
+    "../units:time_delta",
   ]
 }
 
 rtc_source_set("sctp_transport_factory_interface") {
   visibility = [ "*" ]
   sources = [ "sctp_transport_factory_interface.h" ]
-  deps = [
-    "..:field_trials_view",
-    "../../api/environment",
-  ]
+  deps = [ "../environment" ]
 }
 
 rtc_library("stun_types") {
@@ -131,9 +127,9 @@
     visibility = [ "*" ]
     deps = [
       ":network_control",
+      "..:network_emulation_manager_api",
       "..:simulated_network_api",
-      "../../api:network_emulation_manager_api",
-      "../../api/rtc_event_log",
+      "../rtc_event_log",
       "../units:data_rate",
       "../units:data_size",
       "../units:time_delta",
@@ -148,10 +144,8 @@
     ]
     visibility = [ "*" ]
     deps = [
-      ":network_control",
       ":test_feedback_generator_interface",
-      "../../api:network_emulation_manager_api",
-      "../../api/rtc_event_log",
+      "..:network_emulation_manager_api",
       "../../test/network:feedback_generator",
     ]
   }
diff --git a/api/transport/rtp/BUILD.gn b/api/transport/rtp/BUILD.gn
index dc627f8..3781fac 100644
--- a/api/transport/rtp/BUILD.gn
+++ b/api/transport/rtp/BUILD.gn
@@ -12,10 +12,9 @@
   visibility = [ "*" ]
   sources = [ "rtp_source.h" ]
   deps = [
-    "../../../api:rtp_headers",
-    "../../../api/units:time_delta",
-    "../../../api/units:timestamp",
-    "../../../rtc_base:checks",
+    "../..:rtp_headers",
+    "../../units:time_delta",
+    "../../units:timestamp",
     "//third_party/abseil-cpp/absl/strings:str_format",
   ]
 }
diff --git a/api/units/BUILD.gn b/api/units/BUILD.gn
index 0c54b3e..6818844 100644
--- a/api/units/BUILD.gn
+++ b/api/units/BUILD.gn
@@ -34,7 +34,6 @@
   ]
 
   deps = [
-    "../../rtc_base:checks",
     "../../rtc_base:stringutils",
     "../../rtc_base/system:rtc_export",
     "../../rtc_base/units:unit_base",
@@ -49,7 +48,6 @@
   ]
 
   deps = [
-    "../../rtc_base:checks",
     "../../rtc_base:stringutils",
     "../../rtc_base/system:rtc_export",
     "../../rtc_base/units:unit_base",
diff --git a/api/video/BUILD.gn b/api/video/BUILD.gn
index 0566d8b..55f8b45 100644
--- a/api/video/BUILD.gn
+++ b/api/video/BUILD.gn
@@ -32,7 +32,6 @@
     "../../rtc_base:safe_conversions",
     "../../rtc_base:stringutils",
     "../../rtc_base/system:rtc_export",
-    "../units:data_rate",
     "../units:time_delta",
   ]
 }
@@ -66,7 +65,6 @@
     "..:scoped_refptr",
     "..:video_track_source_constraints",
     "../../rtc_base:checks",
-    "../../rtc_base:refcount",
     "../../rtc_base:safe_conversions",
     "../../rtc_base:timeutils",
     "../../rtc_base/memory:aligned_malloc",
@@ -99,7 +97,6 @@
     "..:make_ref_counted",
     "..:scoped_refptr",
     "../../rtc_base:checks",
-    "../../rtc_base:refcount",
     "../../rtc_base:safe_conversions",
     "../../rtc_base/memory:aligned_malloc",
     "../../rtc_base/system:rtc_export",
@@ -115,7 +112,6 @@
     ":encoded_image",
     ":video_frame",
     ":video_rtp_headers",
-    "..:make_ref_counted",
     "..:scoped_refptr",
     "../units:timestamp",
   ]
@@ -156,17 +152,14 @@
   ]
   deps = [
     ":video_codec_constants",
-    ":video_frame",
     ":video_frame_type",
     ":video_rtp_headers",
     "..:make_ref_counted",
     "..:ref_count",
-    "..:refcountedbase",
     "..:rtp_packet_info",
     "..:scoped_refptr",
     "../../rtc_base:buffer",
     "../../rtc_base:checks",
-    "../../rtc_base:refcount",
     "../../rtc_base/system:rtc_export",
     "../units:timestamp",
     "corruption_detection:filter_settings",
@@ -225,14 +218,12 @@
   deps = [
     ":encoded_frame",
     ":rtp_video_frame_assembler",
-    ":video_frame",
     ":video_frame_type",
     "../../modules/rtp_rtcp",
     "../../modules/rtp_rtcp:rtp_packetizer_av1_test_helper",
     "../../modules/rtp_rtcp:rtp_rtcp_format",
     "../../modules/rtp_rtcp:rtp_video_header",
     "../../modules/video_coding:codec_globals_headers",
-    "../../rtc_base:checks",
     "../../test:test_support",
     "../transport/rtp:dependency_descriptor",
   ]
@@ -246,13 +237,10 @@
     deps = [
       ":encoded_frame",
       ":rtp_video_frame_assembler",
-      ":video_frame",
       ":video_frame_type",
       "../../modules/rtp_rtcp",
       "../../modules/rtp_rtcp:rtp_rtcp_format",
       "../../modules/rtp_rtcp:rtp_video_header",
-      "../../modules/video_coding:codec_globals_headers",
-      "../../rtc_base:checks",
       "../../test:test_support",
     ]
   }
@@ -372,12 +360,9 @@
   ]
 
   deps = [
-    ":video_bitrate_allocation",
     ":video_bitrate_allocator",
     ":video_bitrate_allocator_factory",
     ":video_frame",
-    "../../api:scoped_refptr",
-    "../../media:rtc_media_base",
     "../../modules/video_coding:video_coding_utility",
     "../../modules/video_coding/svc:svc_rate_allocator",
     "../environment",
@@ -393,9 +378,8 @@
     "frame_buffer.h",
   ]
   deps = [
-    "../../api:field_trials_view",
-    "../../api/units:timestamp",
-    "../../api/video:encoded_frame",
+    ":encoded_frame",
+    "..:field_trials_view",
     "../../modules/video_coding:video_coding_utility",
     "../../rtc_base:logging",
     "../../rtc_base:rtc_numerics",
@@ -411,7 +395,6 @@
   deps = [
     ":frame_buffer",
     "..:field_trials",
-    "../../api/video:encoded_frame",
     "../../test:create_test_field_trials",
     "../../test:fake_encoded_frame",
     "../../test:test_support",
@@ -424,9 +407,7 @@
 
   deps = [
     ":video_frame_metadata",
-    "../../api/video:video_frame",
     "../../modules/video_coding:codec_globals_headers",
     "../../test:test_support",
-    "../../video",
   ]
 }
diff --git a/api/video/corruption_detection/BUILD.gn b/api/video/corruption_detection/BUILD.gn
index 8ad2d89..2db2ecf 100644
--- a/api/video/corruption_detection/BUILD.gn
+++ b/api/video/corruption_detection/BUILD.gn
@@ -32,10 +32,7 @@
     "frame_instrumentation_data.h",
   ]
 
-  deps = [
-    "../../:array_view",
-    "../../../rtc_base:checks",
-  ]
+  deps = []
 }
 
 rtc_library("frame_instrumentation_data_reader") {
@@ -47,8 +44,6 @@
 
   deps = [
     ":frame_instrumentation_data",
-    "../../:array_view",
-    "../../../rtc_base:checks",
     "../../../rtc_base:logging",
     "../../transport/rtp:corruption_detection_message",
   ]
@@ -62,10 +57,8 @@
   ]
   deps = [
     ":frame_instrumentation_data",
-    "../:video_frame",
-    "../:video_rtp_headers",
-    "../../:array_view",
-    "../../:scoped_refptr",
+    "..:video_frame",
+    "..:video_rtp_headers",
     "../../../rtc_base:checks",
     "../../../rtc_base:logging",
     "../../../video/corruption_detection:corruption_classifier",
@@ -80,12 +73,11 @@
     "frame_instrumentation_generator_factory.h",
   ]
   deps = [
-    ":frame_instrumentation_generator_header",
-    "../:video_frame",
+    ":frame_instrumentation_generator_header",  # keep
+    "..:video_frame",
     "../../../video/corruption_detection:frame_instrumentation_generator_impl",
     "../../environment",
     "../../video_codecs:scalability_mode",
-    "../../video_codecs:video_codecs_api",
   ]
 }
 
@@ -94,9 +86,8 @@
   sources = [ "frame_instrumentation_generator.h" ]
   deps = [
     ":frame_instrumentation_data",
-    "../:encoded_image",
-    "../:video_frame",
-    "../../video_codecs:video_codecs_api",
+    "..:encoded_image",
+    "..:video_frame",
   ]
 }
 
@@ -111,10 +102,8 @@
   deps = [
     ":frame_instrumentation_data",
     ":frame_instrumentation_generator_factory",
-    ":frame_instrumentation_generator_header",
-    "../:encoded_image",
-    "../:video_frame",
-    "../../video_codecs:video_codecs_api",
+    "..:encoded_image",
+    "..:video_frame",
   ]
 }
 
@@ -125,7 +114,6 @@
     deps = [
       ":corruption_detection_settings_generator",
       ":filter_settings",
-      "../../:field_trials",
       "../../../test:test_support",
     ]
   }
@@ -158,9 +146,9 @@
     deps = [
       ":frame_instrumentation_data",
       ":frame_instrumentation_evaluation",
-      "../:video_frame",
-      "../:video_rtp_headers",
-      "../../:scoped_refptr",
+      "..:video_frame",
+      "..:video_rtp_headers",
+      "../..:scoped_refptr",
       "../../../test:test_support",
     ]
   }
diff --git a/api/video/test/BUILD.gn b/api/video/test/BUILD.gn
index 184c651..59c9dc6 100644
--- a/api/video/test/BUILD.gn
+++ b/api/video/test/BUILD.gn
@@ -53,9 +53,5 @@
   visibility = [ "*" ]
   sources = [ "video_frame_matchers.h" ]
 
-  deps = [
-    "..:video_frame",
-    "../..:rtp_packet_info",
-    "../../../test:test_support",
-  ]
+  deps = [ "../../../test:test_support" ]
 }
diff --git a/api/video_codecs/BUILD.gn b/api/video_codecs/BUILD.gn
index 1ec3dff..0afffa1 100644
--- a/api/video_codecs/BUILD.gn
+++ b/api/video_codecs/BUILD.gn
@@ -80,13 +80,11 @@
   deps = [
     ":scalability_mode",
     "..:fec_controller_api",
-    "..:scoped_refptr",
-    "../../api:rtp_parameters",
+    "..:rtp_parameters",
     "../../media:media_constants",
     "../../modules/video_coding:codec_globals_headers",
     "../../rtc_base:checks",
     "../../rtc_base:logging",
-    "../../rtc_base:refcount",
     "../../rtc_base:stringutils",
     "../../rtc_base/system:rtc_export",
     "../environment",
@@ -100,7 +98,6 @@
     "../video:video_codec_constants",
     "../video:video_frame",
     "../video:video_frame_type",
-    "../video:video_rtp_headers",
     "//third_party/abseil-cpp/absl/algorithm:container",
     "//third_party/abseil-cpp/absl/container:inlined_vector",
     "//third_party/abseil-cpp/absl/strings",
@@ -113,8 +110,8 @@
   sources = [ "encoder_speed_controller.cc" ]
   deps = [
     ":video_codecs_api",
-    "../../api/units:time_delta",
     "../../modules/video_coding:encoder_speed_controller_impl",
+    "../units:time_delta",
   ]
 }
 
@@ -137,7 +134,6 @@
 
   deps = [
     ":video_codecs_api",
-    "../../api:scoped_refptr",
     "../../media:rtc_internal_video_codecs",
     "../../rtc_base/system:rtc_export",
   ]
@@ -225,7 +221,6 @@
     ":video_codecs_api",
     "../../modules/video_coding/codecs/av1:av1_svc_config",
     "../../modules/video_coding/codecs/av1:libaom_av1_encoder",
-    "../../modules/video_coding/svc:scalability_mode_util",
     "../environment",
     "//third_party/abseil-cpp/absl/container:inlined_vector",
   ]
@@ -297,17 +292,14 @@
   sources = [ "video_encoder_interface.h" ]
 
   deps = [
-    ":video_encoding_general",
+    ":video_codecs_api",
     "..:scoped_refptr",
-    "../../api/units:data_rate",
-    "../../api/units:data_size",
-    "../../api/units:time_delta",
-    "../../api/units:timestamp",
-    "../../api/video:encoded_image",
-    "../../api/video:resolution",
-    "../../api/video:video_frame",
-    "../../api/video_codecs:video_codecs_api",
-    "../../rtc_base:rtc_numerics",
+    "../units:data_rate",
+    "../units:data_size",
+    "../units:time_delta",
+    "../units:timestamp",
+    "../video:resolution",
+    "../video:video_frame",
     "//third_party/abseil-cpp/absl/functional:any_invocable",
   ]
 }
@@ -318,9 +310,9 @@
   deps = [
     ":video_encoder_interface",
     ":video_encoding_general",
-    "../../api/units:time_delta",
-    "../../api/video:resolution",
     "../../rtc_base:rtc_numerics",
+    "../units:time_delta",
+    "../video:resolution",
     "../video:video_frame",
   ]
 }
@@ -332,17 +324,15 @@
   ]
 
   deps = [
+    ":scalability_mode",
+    ":scalability_mode_helper",
     ":video_encoder_factory_interface",
     ":video_encoder_interface",
     "..:scoped_refptr",
-    "../../api/units:data_rate",
-    "../../api/video_codecs:scalability_mode",
-    "../../api/video_codecs:scalability_mode_helper",
     "../../common_video/generic_frame_descriptor",
     "../../modules/video_coding/svc:scalability_structures",
     "../../modules/video_coding/svc:scalable_video_controller",
     "../../rtc_base:checks",
-    "../../rtc_base:logging",
     "../../rtc_base:rtc_numerics",
     "../transport/rtp:dependency_descriptor",
     "../units:data_size",
@@ -361,15 +351,14 @@
   sources = [ "simple_encoder_wrapper_unittests.cc" ]
 
   deps = [
+    ":libaom_av1_encoder_factory",
     ":simple_encoder_wrapper",
     ":video_encoder_factory_interface",
-    ":video_encoder_interface",
     ":video_encoding_general",
-    "../../api/video:video_frame",
-    "../../api/video_codecs:libaom_av1_encoder_factory",
     "../../test:fileutils",
     "../../test:test_support",
     "../../test:video_test_support",
+    "../video:video_frame",
   ]
 }
 
@@ -383,9 +372,9 @@
     ":video_encoder_factory_interface",
     ":video_encoder_interface",
     ":video_encoding_general",
-    "../../api/video:video_frame",
     "../../modules/video_coding/codecs/av1:libaom_av1_encoder_v2",
     "../../rtc_base:rtc_numerics",
+    "../video:video_frame",
     "//third_party/libaom",
   ]
 }
@@ -397,25 +386,24 @@
 
   deps = [
     ":libaom_av1_encoder_factory",
+    ":video_codecs_api",
     ":video_encoder_factory_interface",
     ":video_encoder_interface",
     ":video_encoding_general",
     "..:scoped_refptr",
-    "../../api/video:video_frame",
-    "../../api/video_codecs:video_codecs_api",
     "../../common_video",
     "../../modules/video_coding/codecs/av1:dav1d_decoder",
     "../../rtc_base:checks",
     "../../rtc_base:logging",
     "../../test:fileutils",
     "../../test:test_support",
-    "../../test:video_frame_writer",
     "../../test:video_test_support",
     "../units:data_rate",
     "../units:data_size",
     "../units:time_delta",
     "../units:timestamp",
     "../video:encoded_image",
+    "../video:video_frame",
   ]
 }
 
@@ -429,7 +417,7 @@
 
   deps = [
     ":video_codecs_api",
-    "../:fec_controller_api",
+    "..:fec_controller_api",
     "../../modules/video_coding:video_coding_utility",
     "../../modules/video_coding:webrtc_vp8_temporal_layers",
     "../../rtc_base:checks",
@@ -450,11 +438,8 @@
   deps = [
     ":video_codecs_api",
     "..:fec_controller_api",
+    "..:field_trials_view",
     "..:scoped_refptr",
-    "../../api:field_trials_view",
-    "../../api/environment",
-    "../../api/video:video_frame",
-    "../../media:video_common",
     "../../modules/video_coding:video_codec_interface",
     "../../modules/video_coding:video_coding_utility",
     "../../rtc_base:checks",
@@ -463,11 +448,10 @@
     "../../rtc_base/experiments:field_trial_parser",
     "../../rtc_base/system:rtc_export",
     "../../system_wrappers:metrics",
+    "../environment",
     "../video:encoded_image",
-    "../video:video_bitrate_allocation",
     "../video:video_frame",
     "../video:video_frame_type",
-    "../video:video_rtp_headers",
     "//third_party/abseil-cpp/absl/strings",
   ]
 }
diff --git a/api/video_codecs/test/BUILD.gn b/api/video_codecs/test/BUILD.gn
index f1861c7..9c1e795 100644
--- a/api/video_codecs/test/BUILD.gn
+++ b/api/video_codecs/test/BUILD.gn
@@ -34,13 +34,12 @@
       "../..:field_trials",
       "../..:mock_video_encoder",
       "../..:rtp_parameters",
-      "../../../api:scoped_refptr",
+      "../..:scoped_refptr",
       "../../../media:media_constants",
       "../../../modules/video_coding:video_codec_interface",
       "../../../modules/video_coding:video_coding_utility",
       "../../../modules/video_coding:webrtc_vp8",
       "../../../rtc_base:checks",
-      "../../../rtc_base:rtc_base_tests_utils",
       "../../../test:create_test_environment",
       "../../../test:create_test_field_trials",
       "../../../test:fake_video_codecs",
@@ -50,7 +49,6 @@
       "../../environment:environment_factory",
       "../../video:encoded_image",
       "../../video:resolution",
-      "../../video:video_bitrate_allocation",
       "../../video:video_bitrate_allocator",
       "../../video:video_frame",
       "../../video:video_frame_type",
@@ -72,7 +70,7 @@
       "..:video_encoder_factory_template_libvpx_vp8_adapter",
       "..:video_encoder_factory_template_libvpx_vp9_adapter",
       "..:video_encoder_factory_template_open_h264_adapter",
-      "../../:mock_video_encoder",
+      "../..:mock_video_encoder",
       "../../../test:test_support",
       "../../environment",
       "../../environment:environment_factory",
@@ -91,7 +89,7 @@
       "..:video_decoder_factory_template_libvpx_vp8_adapter",
       "..:video_decoder_factory_template_libvpx_vp9_adapter",
       "..:video_decoder_factory_template_open_h264_adapter",
-      "../../:mock_video_decoder",
+      "../..:mock_video_decoder",
       "../../../test:test_support",
       "../../environment",
       "../../environment:environment_factory",
diff --git a/api/voip/BUILD.gn b/api/voip/BUILD.gn
index 0d3e7b7..3e50189 100644
--- a/api/voip/BUILD.gn
+++ b/api/voip/BUILD.gn
@@ -65,7 +65,6 @@
     sources = [ "test/voip_engine_factory_unittest.cc" ]
     deps = [
       ":voip_engine_factory",
-      "..:field_trials",
       "..:make_ref_counted",
       "../../modules/audio_device:mock_audio_device",
       "../../modules/audio_processing:mocks",