[iwyu][1\n] Applying to api/[a-s]*

First batch of applying iwyu to the repo.
Done with:
> ./tools_webrtc/iwyu/apply-iwyu api
> git add api/[a-s]*
> python3 gn_autodeps.py ~/local/webrtc/src out/Default

Last step is a custom script I wrote to automatically apply new required
dependencies for target in gn, which saved tons of time manually going
over the files and fixing.
If this is something that interest others, I can submit it as well.

Bug: webrtc:42226242
Change-Id: Id109e77f50835827495bc4512880c4ec9ae175f6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/343680
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Dor Hen <dorhen@meta.com>
Cr-Commit-Position: refs/heads/main@{#42512}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index c68e319..e537068 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -34,7 +34,11 @@
   ]
   deps = [
     ":libjingle_peerconnection_api",
+    ":scoped_refptr",
     "../call",
+    "../call:call_interfaces",
+    "../call:call_interfaces",
+    "../media:media_engine",
     "../media:rtc_audio_video",
     "../pc:media_factory",
     "../rtc_base/system:rtc_export",
@@ -56,13 +60,19 @@
   deps = [
     ":enable_media",
     ":libjingle_peerconnection_api",
+    ":scoped_refptr",
     "../rtc_base/system:rtc_export",
     "audio:audio_processing",
+    "audio_codecs:audio_codecs_api",
+    "audio_codecs:audio_codecs_api",
     "audio_codecs:builtin_audio_decoder_factory",
     "audio_codecs:builtin_audio_encoder_factory",
     "task_queue:default_task_queue_factory",
+    "task_queue:task_queue",
     "video_codecs:builtin_video_decoder_factory",
     "video_codecs:builtin_video_encoder_factory",
+    "video_codecs:video_codecs_api",
+    "video_codecs:video_codecs_api",
   ]
 }
 
@@ -82,6 +92,7 @@
       "../api/rtc_event_log:rtc_event_log_factory",
       "../pc:peer_connection_factory",
       "../pc:webrtc_sdp",
+      "../rtc_base:socket_server",
       "../rtc_base:threading",
       "../rtc_base/system:rtc_export",
       "../stats:rtc_stats",
@@ -113,6 +124,8 @@
   ]
   deps = [
     ":array_view",
+    "../rtc_base:checks",
+    "../rtc_base/system:rtc_export",
     "units:timestamp",
     "video:video_rtp_headers",
     "//third_party/abseil-cpp/absl/types:optional",
@@ -230,6 +243,7 @@
     ":scoped_refptr",
     "../rtc_base:ssl",
     "../rtc_base/system:rtc_export",
+    "//third_party/abseil-cpp/absl/base:core_headers",
     "//third_party/abseil-cpp/absl/types:optional",
   ]
 }
@@ -338,14 +352,19 @@
     "../pc:media_factory",
     "../rtc_base:copy_on_write_buffer",
     "../rtc_base:logging",
+    "../rtc_base:macromagic",
     "../rtc_base:network",
     "../rtc_base:network_constants",
     "../rtc_base:rtc_certificate_generator",
+    "../rtc_base:socket_factory",
     "../rtc_base:ssl",
     "../rtc_base:ssl_adapter",
     "../rtc_base:stringutils",
     "adaptation:resource_adaptation_api",
+    "audio:audio_device",
+    "audio:audio_frame_processor",
     "audio:audio_mixer_api",
+    "audio:audio_processing",
     "audio_codecs:audio_codecs_api",
     "crypto:frame_decryptor_interface",
     "crypto:frame_encryptor_interface",
@@ -361,6 +380,7 @@
     "transport:sctp_transport_factory_interface",
     "transport/rtp:rtp_source",
     "units:data_rate",
+    "units:time_delta",
     "units:timestamp",
     "video:encoded_image",
     "video:video_bitrate_allocator_factory",
@@ -937,12 +957,14 @@
     ":make_ref_counted",
     ":packet_socket_factory",
     ":scoped_refptr",
+    ":sequence_checker",
     "../p2p:connection",
     "../p2p:ice_transport_internal",
     "../p2p:p2p_constants",
     "../p2p:p2p_transport_channel",
     "../p2p:port_allocator",
     "../p2p:rtc_p2p",
+    "../rtc_base:macromagic",
     "../rtc_base:threading",
     "../rtc_base/system:rtc_export",
     "rtc_event_log:rtc_event_log",
@@ -971,6 +993,7 @@
     "../rtc_base:checks",
     "../rtc_base:macromagic",
     "../rtc_base/synchronization:sequence_checker_internal",
+    "task_queue:task_queue",
   ]
 }
 
@@ -1454,6 +1477,8 @@
       ":peer_connection_quality_test_fixture_api",
       ":rtc_error",
       ":rtc_event_log_output_file",
+      ":rtp_headers",
+      ":rtp_headers",
       ":rtp_packet_info",
       ":rtp_parameters",
       ":scoped_refptr",
@@ -1463,11 +1488,14 @@
       "../rtc_base:buffer",
       "../rtc_base:checks",
       "../rtc_base:gunit_helpers",
+      "../rtc_base:macromagic",
       "../rtc_base:platform_thread",
       "../rtc_base:rtc_event",
+      "../rtc_base:socket_address",
       "../rtc_base:ssl",
       "../rtc_base:task_queue_for_test",
       "../rtc_base/containers:flat_set",
+      "../rtc_base/synchronization:sequence_checker_internal",
       "../rtc_base/task_utils:repeating_task",
       "../system_wrappers:field_trial",
       "../test:field_trial",
@@ -1485,6 +1513,9 @@
       "video:frame_buffer_unittest",
       "video:rtp_video_frame_assembler_unittests",
       "video:video_frame_metadata_unittest",
+      "//testing/gtest",
+      "//third_party/abseil-cpp/absl/functional:any_invocable",
+      "//third_party/abseil-cpp/absl/strings",
       "//third_party/abseil-cpp/absl/strings:string_view",
       "//third_party/abseil-cpp/absl/types:optional",
     ]
@@ -1587,6 +1618,8 @@
     ":scoped_refptr",
     "../audio:audio",
     "../modules/rtp_rtcp",
+    "../rtc_base:checks",
+    "../rtc_base/system:rtc_export",
     "video:encoded_frame",
     "video:video_frame_metadata",
   ]
diff --git a/api/DEPS b/api/DEPS
index eecde25..4f62ec6 100644
--- a/api/DEPS
+++ b/api/DEPS
@@ -116,6 +116,7 @@
     "+rtc_base/rtc_certificate.h",
     "+rtc_base/rtc_certificate_generator.h",
     "+rtc_base/socket_address.h",
+    "+rtc_base/socket_factory.h",
     "+rtc_base/ssl_certificate.h",
     "+rtc_base/ssl_stream_adapter.h",
     "+rtc_base/thread.h",
@@ -140,6 +141,7 @@
   ],
 
   "legacy_stats_types\.h": [
+    "+rtc_base/thread_annotations.h",
     "+rtc_base/thread_checker.h",
   ],
 
diff --git a/api/array_view.h b/api/array_view.h
index 7e01959..4abd2bf 100644
--- a/api/array_view.h
+++ b/api/array_view.h
@@ -13,6 +13,7 @@
 
 #include <algorithm>
 #include <array>
+#include <cstddef>
 #include <iterator>
 #include <type_traits>
 
diff --git a/api/array_view_unittest.cc b/api/array_view_unittest.cc
index 97267df..194d8aa 100644
--- a/api/array_view_unittest.cc
+++ b/api/array_view_unittest.cc
@@ -10,16 +10,18 @@
 
 #include "api/array_view.h"
 
-#include <algorithm>
+#include <stdint.h>
+
 #include <array>
+#include <cstddef>
 #include <string>
 #include <utility>
 #include <vector>
 
 #include "rtc_base/buffer.h"
 #include "rtc_base/checks.h"
-#include "rtc_base/gunit.h"
 #include "test/gmock.h"
+#include "test/gtest.h"
 
 namespace rtc {
 
diff --git a/api/audio/BUILD.gn b/api/audio/BUILD.gn
index 10c96d0..1f9e43d 100644
--- a/api/audio/BUILD.gn
+++ b/api/audio/BUILD.gn
@@ -41,6 +41,7 @@
     "../../rtc_base:logging",
     "../../rtc_base:macromagic",
     "../../rtc_base:timeutils",
+    "//third_party/abseil-cpp/absl/types:optional",
   ]
 }
 
@@ -124,6 +125,7 @@
     ":echo_control",
     "../../modules/audio_processing/aec3",
     "../../rtc_base/system:rtc_export",
+    "//third_party/abseil-cpp/absl/types:optional",
   ]
 }
 
diff --git a/api/audio/audio_frame.cc b/api/audio/audio_frame.cc
index bee4be6..a2aa774 100644
--- a/api/audio/audio_frame.cc
+++ b/api/audio/audio_frame.cc
@@ -12,6 +12,13 @@
 
 #include <string.h>
 
+#include <cstdint>
+
+#include "absl/types/optional.h"
+#include "api/array_view.h"
+#include "api/audio/audio_view.h"
+#include "api/audio/channel_layout.h"
+#include "api/rtp_packet_infos.h"
 #include "rtc_base/checks.h"
 #include "rtc_base/time_utils.h"
 
diff --git a/api/audio/audio_frame.h b/api/audio/audio_frame.h
index 40475c7..5683e8b 100644
--- a/api/audio/audio_frame.h
+++ b/api/audio/audio_frame.h
@@ -16,6 +16,7 @@
 
 #include <array>
 
+#include "absl/types/optional.h"
 #include "api/array_view.h"
 #include "api/audio/audio_view.h"
 #include "api/audio/channel_layout.h"
diff --git a/api/audio/echo_canceller3_factory.cc b/api/audio/echo_canceller3_factory.cc
index 284b117..8422a3e 100644
--- a/api/audio/echo_canceller3_factory.cc
+++ b/api/audio/echo_canceller3_factory.cc
@@ -11,6 +11,9 @@
 
 #include <memory>
 
+#include "absl/types/optional.h"
+#include "api/audio/echo_canceller3_config.h"
+#include "api/audio/echo_control.h"
 #include "modules/audio_processing/aec3/echo_canceller3.h"
 
 namespace webrtc {
diff --git a/api/audio_codecs/BUILD.gn b/api/audio_codecs/BUILD.gn
index f550f6f..1a90815 100644
--- a/api/audio_codecs/BUILD.gn
+++ b/api/audio_codecs/BUILD.gn
@@ -46,6 +46,7 @@
     "../units:data_rate",
     "../units:time_delta",
     "//third_party/abseil-cpp/absl/base:core_headers",
+    "//third_party/abseil-cpp/absl/base:nullability",
     "//third_party/abseil-cpp/absl/strings",
     "//third_party/abseil-cpp/absl/strings:string_view",
     "//third_party/abseil-cpp/absl/types:optional",
@@ -103,13 +104,18 @@
   ]
   defines = []
   if (rtc_include_ilbc) {
-    deps += [ "ilbc:audio_encoder_ilbc" ]
+    deps += [
+      "..:field_trials_view",
+      "ilbc:audio_encoder_ilbc",
+      "//third_party/abseil-cpp/absl/types:optional",
+    ]
     defines += [ "WEBRTC_USE_BUILTIN_ILBC=1" ]
   } else {
     defines += [ "WEBRTC_USE_BUILTIN_ILBC=0" ]
   }
   if (rtc_include_opus) {
     deps += [
+      "..:field_trials_view",
       "opus:audio_encoder_multiopus",
       "opus:audio_encoder_opus",
     ]
diff --git a/api/audio_codecs/L16/BUILD.gn b/api/audio_codecs/L16/BUILD.gn
index 9d67f8d..f2cefbd 100644
--- a/api/audio_codecs/L16/BUILD.gn
+++ b/api/audio_codecs/L16/BUILD.gn
@@ -23,6 +23,7 @@
     "..:audio_codecs_api",
     "../../../api:field_trials_view",
     "../../../modules/audio_coding:pcm16b",
+    "../../../rtc_base:checks",
     "../../../rtc_base:safe_conversions",
     "../../../rtc_base:safe_minmax",
     "../../../rtc_base:stringutils",
diff --git a/api/audio_codecs/L16/audio_decoder_L16.cc b/api/audio_codecs/L16/audio_decoder_L16.cc
index a03abe2..b392523 100644
--- a/api/audio_codecs/L16/audio_decoder_L16.cc
+++ b/api/audio_codecs/L16/audio_decoder_L16.cc
@@ -11,8 +11,14 @@
 #include "api/audio_codecs/L16/audio_decoder_L16.h"
 
 #include <memory>
+#include <vector>
 
 #include "absl/strings/match.h"
+#include "absl/types/optional.h"
+#include "api/audio_codecs/audio_codec_pair_id.h"
+#include "api/audio_codecs/audio_decoder.h"
+#include "api/audio_codecs/audio_format.h"
+#include "api/field_trials_view.h"
 #include "modules/audio_coding/codecs/pcm16b/audio_decoder_pcm16b.h"
 #include "modules/audio_coding/codecs/pcm16b/pcm16b_common.h"
 #include "rtc_base/numerics/safe_conversions.h"
diff --git a/api/audio_codecs/L16/audio_encoder_L16.cc b/api/audio_codecs/L16/audio_encoder_L16.cc
index 20259b9..6435cd0 100644
--- a/api/audio_codecs/L16/audio_encoder_L16.cc
+++ b/api/audio_codecs/L16/audio_encoder_L16.cc
@@ -10,11 +10,22 @@
 
 #include "api/audio_codecs/L16/audio_encoder_L16.h"
 
+#include <stddef.h>
+
+#include <map>
 #include <memory>
+#include <utility>
+#include <vector>
 
 #include "absl/strings/match.h"
+#include "absl/types/optional.h"
+#include "api/audio_codecs/audio_codec_pair_id.h"
+#include "api/audio_codecs/audio_encoder.h"
+#include "api/audio_codecs/audio_format.h"
+#include "api/field_trials_view.h"
 #include "modules/audio_coding/codecs/pcm16b/audio_encoder_pcm16b.h"
 #include "modules/audio_coding/codecs/pcm16b/pcm16b_common.h"
+#include "rtc_base/checks.h"
 #include "rtc_base/numerics/safe_conversions.h"
 #include "rtc_base/numerics/safe_minmax.h"
 #include "rtc_base/string_to_number.h"
diff --git a/api/audio_codecs/audio_decoder_factory_template.h b/api/audio_codecs/audio_decoder_factory_template.h
index 7ea0c91..0c02656 100644
--- a/api/audio_codecs/audio_decoder_factory_template.h
+++ b/api/audio_codecs/audio_decoder_factory_template.h
@@ -12,9 +12,14 @@
 #define API_AUDIO_CODECS_AUDIO_DECODER_FACTORY_TEMPLATE_H_
 
 #include <memory>
+#include <type_traits>
 #include <vector>
 
+#include "absl/types/optional.h"
+#include "api/audio_codecs/audio_codec_pair_id.h"
+#include "api/audio_codecs/audio_decoder.h"
 #include "api/audio_codecs/audio_decoder_factory.h"
+#include "api/audio_codecs/audio_format.h"
 #include "api/field_trials_view.h"
 #include "api/make_ref_counted.h"
 #include "api/scoped_refptr.h"
diff --git a/api/audio_codecs/audio_encoder.h b/api/audio_codecs/audio_encoder.h
index 7b5ee7a..552319b 100644
--- a/api/audio_codecs/audio_encoder.h
+++ b/api/audio_codecs/audio_encoder.h
@@ -11,6 +11,9 @@
 #ifndef API_AUDIO_CODECS_AUDIO_ENCODER_H_
 #define API_AUDIO_CODECS_AUDIO_ENCODER_H_
 
+#include <stddef.h>
+#include <stdint.h>
+
 #include <memory>
 #include <string>
 #include <utility>
diff --git a/api/audio_codecs/audio_encoder_factory_template.h b/api/audio_codecs/audio_encoder_factory_template.h
index 0942276..d384376 100644
--- a/api/audio_codecs/audio_encoder_factory_template.h
+++ b/api/audio_codecs/audio_encoder_factory_template.h
@@ -12,9 +12,15 @@
 #define API_AUDIO_CODECS_AUDIO_ENCODER_FACTORY_TEMPLATE_H_
 
 #include <memory>
+#include <type_traits>
 #include <vector>
 
+#include "absl/base/nullability.h"
+#include "absl/types/optional.h"
+#include "api/audio_codecs/audio_codec_pair_id.h"
+#include "api/audio_codecs/audio_encoder.h"
 #include "api/audio_codecs/audio_encoder_factory.h"
+#include "api/audio_codecs/audio_format.h"
 #include "api/environment/environment.h"
 #include "api/field_trials_view.h"
 #include "api/make_ref_counted.h"
diff --git a/api/audio_codecs/g711/BUILD.gn b/api/audio_codecs/g711/BUILD.gn
index 6e3c232..df377e2 100644
--- a/api/audio_codecs/g711/BUILD.gn
+++ b/api/audio_codecs/g711/BUILD.gn
@@ -23,6 +23,7 @@
     "..:audio_codecs_api",
     "../../../api:field_trials_view",
     "../../../modules/audio_coding:g711",
+    "../../../rtc_base:checks",
     "../../../rtc_base:safe_conversions",
     "../../../rtc_base:safe_minmax",
     "../../../rtc_base:stringutils",
@@ -43,6 +44,7 @@
     "..:audio_codecs_api",
     "../../../api:field_trials_view",
     "../../../modules/audio_coding:g711",
+    "../../../rtc_base:checks",
     "../../../rtc_base:safe_conversions",
     "../../../rtc_base/system:rtc_export",
     "//third_party/abseil-cpp/absl/strings",
diff --git a/api/audio_codecs/g711/audio_decoder_g711.cc b/api/audio_codecs/g711/audio_decoder_g711.cc
index 838f7e9..28963c5 100644
--- a/api/audio_codecs/g711/audio_decoder_g711.cc
+++ b/api/audio_codecs/g711/audio_decoder_g711.cc
@@ -10,11 +10,18 @@
 
 #include "api/audio_codecs/g711/audio_decoder_g711.h"
 
+#include <initializer_list>
 #include <memory>
 #include <vector>
 
 #include "absl/strings/match.h"
+#include "absl/types/optional.h"
+#include "api/audio_codecs/audio_codec_pair_id.h"
+#include "api/audio_codecs/audio_decoder.h"
+#include "api/audio_codecs/audio_format.h"
+#include "api/field_trials_view.h"
 #include "modules/audio_coding/codecs/g711/audio_decoder_pcm.h"
+#include "rtc_base/checks.h"
 #include "rtc_base/numerics/safe_conversions.h"
 
 namespace webrtc {
diff --git a/api/audio_codecs/g711/audio_encoder_g711.cc b/api/audio_codecs/g711/audio_encoder_g711.cc
index 1dca3b8..e32aa28 100644
--- a/api/audio_codecs/g711/audio_encoder_g711.cc
+++ b/api/audio_codecs/g711/audio_encoder_g711.cc
@@ -10,11 +10,22 @@
 
 #include "api/audio_codecs/g711/audio_encoder_g711.h"
 
+#include <stddef.h>
+
+#include <initializer_list>
+#include <map>
 #include <memory>
+#include <utility>
 #include <vector>
 
 #include "absl/strings/match.h"
+#include "absl/types/optional.h"
+#include "api/audio_codecs/audio_codec_pair_id.h"
+#include "api/audio_codecs/audio_encoder.h"
+#include "api/audio_codecs/audio_format.h"
+#include "api/field_trials_view.h"
 #include "modules/audio_coding/codecs/g711/audio_encoder_pcm.h"
+#include "rtc_base/checks.h"
 #include "rtc_base/numerics/safe_conversions.h"
 #include "rtc_base/numerics/safe_minmax.h"
 #include "rtc_base/string_to_number.h"
diff --git a/api/audio_codecs/g722/BUILD.gn b/api/audio_codecs/g722/BUILD.gn
index a3a06b5..58b6e24 100644
--- a/api/audio_codecs/g722/BUILD.gn
+++ b/api/audio_codecs/g722/BUILD.gn
@@ -30,6 +30,7 @@
     "..:audio_codecs_api",
     "../../../api:field_trials_view",
     "../../../modules/audio_coding:g722",
+    "../../../rtc_base:checks",
     "../../../rtc_base:safe_conversions",
     "../../../rtc_base:safe_minmax",
     "../../../rtc_base:stringutils",
@@ -50,6 +51,7 @@
     "..:audio_codecs_api",
     "../../../api:field_trials_view",
     "../../../modules/audio_coding:g722",
+    "../../../rtc_base:checks",
     "../../../rtc_base:safe_conversions",
     "../../../rtc_base/system:rtc_export",
     "//third_party/abseil-cpp/absl/strings",
diff --git a/api/audio_codecs/g722/audio_decoder_g722.cc b/api/audio_codecs/g722/audio_decoder_g722.cc
index ed71634..b5e5f42 100644
--- a/api/audio_codecs/g722/audio_decoder_g722.cc
+++ b/api/audio_codecs/g722/audio_decoder_g722.cc
@@ -14,7 +14,13 @@
 #include <vector>
 
 #include "absl/strings/match.h"
+#include "absl/types/optional.h"
+#include "api/audio_codecs/audio_codec_pair_id.h"
+#include "api/audio_codecs/audio_decoder.h"
+#include "api/audio_codecs/audio_format.h"
+#include "api/field_trials_view.h"
 #include "modules/audio_coding/codecs/g722/audio_decoder_g722.h"
+#include "rtc_base/checks.h"
 #include "rtc_base/numerics/safe_conversions.h"
 
 namespace webrtc {
diff --git a/api/audio_codecs/g722/audio_encoder_g722.cc b/api/audio_codecs/g722/audio_encoder_g722.cc
index 56a6c4d..d7a1c89 100644
--- a/api/audio_codecs/g722/audio_encoder_g722.cc
+++ b/api/audio_codecs/g722/audio_encoder_g722.cc
@@ -10,11 +10,22 @@
 
 #include "api/audio_codecs/g722/audio_encoder_g722.h"
 
+#include <stddef.h>
+
+#include <map>
 #include <memory>
+#include <utility>
 #include <vector>
 
 #include "absl/strings/match.h"
+#include "absl/types/optional.h"
+#include "api/audio_codecs/audio_codec_pair_id.h"
+#include "api/audio_codecs/audio_encoder.h"
+#include "api/audio_codecs/audio_format.h"
+#include "api/audio_codecs/g722/audio_encoder_g722_config.h"
+#include "api/field_trials_view.h"
 #include "modules/audio_coding/codecs/g722/audio_encoder_g722.h"
+#include "rtc_base/checks.h"
 #include "rtc_base/numerics/safe_conversions.h"
 #include "rtc_base/numerics/safe_minmax.h"
 #include "rtc_base/string_to_number.h"
diff --git a/api/audio_codecs/ilbc/BUILD.gn b/api/audio_codecs/ilbc/BUILD.gn
index f2cb397..a71867a 100644
--- a/api/audio_codecs/ilbc/BUILD.gn
+++ b/api/audio_codecs/ilbc/BUILD.gn
@@ -29,6 +29,7 @@
     "..:audio_codecs_api",
     "../../../api:field_trials_view",
     "../../../modules/audio_coding:ilbc",
+    "../../../rtc_base:checks",
     "../../../rtc_base:safe_conversions",
     "../../../rtc_base:safe_minmax",
     "../../../rtc_base:stringutils",
diff --git a/api/audio_codecs/ilbc/audio_decoder_ilbc.cc b/api/audio_codecs/ilbc/audio_decoder_ilbc.cc
index c583169..6b3c0cb 100644
--- a/api/audio_codecs/ilbc/audio_decoder_ilbc.cc
+++ b/api/audio_codecs/ilbc/audio_decoder_ilbc.cc
@@ -14,6 +14,11 @@
 #include <vector>
 
 #include "absl/strings/match.h"
+#include "absl/types/optional.h"
+#include "api/audio_codecs/audio_codec_pair_id.h"
+#include "api/audio_codecs/audio_decoder.h"
+#include "api/audio_codecs/audio_format.h"
+#include "api/field_trials_view.h"
 #include "modules/audio_coding/codecs/ilbc/audio_decoder_ilbc.h"
 
 namespace webrtc {
diff --git a/api/audio_codecs/ilbc/audio_encoder_ilbc.cc b/api/audio_codecs/ilbc/audio_encoder_ilbc.cc
index b497948..7345591 100644
--- a/api/audio_codecs/ilbc/audio_encoder_ilbc.cc
+++ b/api/audio_codecs/ilbc/audio_encoder_ilbc.cc
@@ -10,12 +10,21 @@
 
 #include "api/audio_codecs/ilbc/audio_encoder_ilbc.h"
 
+#include <map>
 #include <memory>
+#include <string>
+#include <utility>
 #include <vector>
 
 #include "absl/strings/match.h"
+#include "absl/types/optional.h"
+#include "api/audio_codecs/audio_codec_pair_id.h"
+#include "api/audio_codecs/audio_encoder.h"
+#include "api/audio_codecs/audio_format.h"
+#include "api/audio_codecs/ilbc/audio_encoder_ilbc_config.h"
+#include "api/field_trials_view.h"
 #include "modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.h"
-#include "rtc_base/numerics/safe_conversions.h"
+#include "rtc_base/checks.h"
 #include "rtc_base/numerics/safe_minmax.h"
 #include "rtc_base/string_to_number.h"
 
diff --git a/api/audio_codecs/opus/BUILD.gn b/api/audio_codecs/opus/BUILD.gn
index cde56e1..b495661 100644
--- a/api/audio_codecs/opus/BUILD.gn
+++ b/api/audio_codecs/opus/BUILD.gn
@@ -48,6 +48,7 @@
     "..:audio_codecs_api",
     "../../../api:field_trials_view",
     "../../../modules/audio_coding:webrtc_opus",
+    "../../../rtc_base:checks",
     "../../../rtc_base/system:rtc_export",
     "//third_party/abseil-cpp/absl/types:optional",
   ]
@@ -64,6 +65,7 @@
     "..:audio_codecs_api",
     "../../../api:field_trials_view",
     "../../../modules/audio_coding:webrtc_opus",
+    "../../../rtc_base:checks",
     "../../../rtc_base/system:rtc_export",
     "//third_party/abseil-cpp/absl/strings",
     "//third_party/abseil-cpp/absl/types:optional",
diff --git a/api/audio_codecs/opus/audio_decoder_multi_channel_opus.cc b/api/audio_codecs/opus/audio_decoder_multi_channel_opus.cc
index 0fb4e05..497e212 100644
--- a/api/audio_codecs/opus/audio_decoder_multi_channel_opus.cc
+++ b/api/audio_codecs/opus/audio_decoder_multi_channel_opus.cc
@@ -14,8 +14,12 @@
 #include <utility>
 #include <vector>
 
-#include "absl/memory/memory.h"
-#include "absl/strings/match.h"
+#include "absl/types/optional.h"
+#include "api/audio_codecs/audio_codec_pair_id.h"
+#include "api/audio_codecs/audio_decoder.h"
+#include "api/audio_codecs/audio_format.h"
+#include "api/audio_codecs/opus/audio_decoder_multi_channel_opus_config.h"
+#include "api/field_trials_view.h"
 #include "modules/audio_coding/codecs/opus/audio_decoder_multi_channel_opus_impl.h"
 
 namespace webrtc {
diff --git a/api/audio_codecs/opus/audio_decoder_opus.cc b/api/audio_codecs/opus/audio_decoder_opus.cc
index efc9a73..3c8635d 100644
--- a/api/audio_codecs/opus/audio_decoder_opus.cc
+++ b/api/audio_codecs/opus/audio_decoder_opus.cc
@@ -10,12 +10,20 @@
 
 #include "api/audio_codecs/opus/audio_decoder_opus.h"
 
+#include <map>
 #include <memory>
+#include <string>
 #include <utility>
 #include <vector>
 
 #include "absl/strings/match.h"
+#include "absl/types/optional.h"
+#include "api/audio_codecs/audio_codec_pair_id.h"
+#include "api/audio_codecs/audio_decoder.h"
+#include "api/audio_codecs/audio_format.h"
+#include "api/field_trials_view.h"
 #include "modules/audio_coding/codecs/opus/audio_decoder_opus.h"
+#include "rtc_base/checks.h"
 
 namespace webrtc {
 
diff --git a/api/audio_codecs/opus/audio_encoder_multi_channel_opus_config.h b/api/audio_codecs/opus/audio_encoder_multi_channel_opus_config.h
index 9b51246..ff513ab 100644
--- a/api/audio_codecs/opus/audio_encoder_multi_channel_opus_config.h
+++ b/api/audio_codecs/opus/audio_encoder_multi_channel_opus_config.h
@@ -12,11 +12,8 @@
 #define API_AUDIO_CODECS_OPUS_AUDIO_ENCODER_MULTI_CHANNEL_OPUS_CONFIG_H_
 
 #include <stddef.h>
-
 #include <vector>
 
-#include "absl/types/optional.h"
-#include "api/audio_codecs/opus/audio_encoder_opus_config.h"
 #include "rtc_base/system/rtc_export.h"
 
 namespace webrtc {
diff --git a/api/audio_codecs/opus/audio_encoder_opus.cc b/api/audio_codecs/opus/audio_encoder_opus.cc
index 5b6322d..4073d08 100644
--- a/api/audio_codecs/opus/audio_encoder_opus.cc
+++ b/api/audio_codecs/opus/audio_encoder_opus.cc
@@ -10,7 +10,17 @@
 
 #include "api/audio_codecs/opus/audio_encoder_opus.h"
 
+#include <memory>
+#include <vector>
+
+#include "absl/types/optional.h"
+#include "api/audio_codecs/audio_codec_pair_id.h"
+#include "api/audio_codecs/audio_encoder.h"
+#include "api/audio_codecs/audio_format.h"
+#include "api/audio_codecs/opus/audio_encoder_opus_config.h"
+#include "api/field_trials_view.h"
 #include "modules/audio_coding/codecs/opus/audio_encoder_opus.h"
+#include "rtc_base/checks.h"
 
 namespace webrtc {
 
diff --git a/api/audio_codecs/test/BUILD.gn b/api/audio_codecs/test/BUILD.gn
index e2de6ea..702772c 100644
--- a/api/audio_codecs/test/BUILD.gn
+++ b/api/audio_codecs/test/BUILD.gn
@@ -21,6 +21,8 @@
     ]
     deps = [
       "..:audio_codecs_api",
+      "../..:make_ref_counted",
+      "../..:scoped_refptr",
       "../../../test:audio_codec_mocks",
       "../../../test:scoped_key_value_config",
       "../../../test:test_support",
@@ -36,6 +38,7 @@
       "../ilbc:audio_encoder_ilbc",
       "../opus:audio_decoder_opus",
       "../opus:audio_encoder_opus",
+      "//third_party/abseil-cpp/absl/types:optional",
     ]
   }
 }
diff --git a/api/audio_codecs/test/audio_decoder_factory_template_unittest.cc b/api/audio_codecs/test/audio_decoder_factory_template_unittest.cc
index 0b18cf9..dd112c9 100644
--- a/api/audio_codecs/test/audio_decoder_factory_template_unittest.cc
+++ b/api/audio_codecs/test/audio_decoder_factory_template_unittest.cc
@@ -11,12 +11,21 @@
 #include "api/audio_codecs/audio_decoder_factory_template.h"
 
 #include <memory>
+#include <utility>
+#include <vector>
 
+#include "absl/types/optional.h"
 #include "api/audio_codecs/L16/audio_decoder_L16.h"
+#include "api/audio_codecs/audio_codec_pair_id.h"
+#include "api/audio_codecs/audio_decoder.h"
+#include "api/audio_codecs/audio_decoder_factory.h"
+#include "api/audio_codecs/audio_format.h"
 #include "api/audio_codecs/g711/audio_decoder_g711.h"
 #include "api/audio_codecs/g722/audio_decoder_g722.h"
 #include "api/audio_codecs/ilbc/audio_decoder_ilbc.h"
 #include "api/audio_codecs/opus/audio_decoder_opus.h"
+#include "api/make_ref_counted.h"
+#include "api/scoped_refptr.h"
 #include "test/gmock.h"
 #include "test/gtest.h"
 #include "test/mock_audio_decoder.h"
diff --git a/api/audio_codecs/test/audio_encoder_factory_template_unittest.cc b/api/audio_codecs/test/audio_encoder_factory_template_unittest.cc
index e5f865a..666b9a7 100644
--- a/api/audio_codecs/test/audio_encoder_factory_template_unittest.cc
+++ b/api/audio_codecs/test/audio_encoder_factory_template_unittest.cc
@@ -11,14 +11,23 @@
 #include "api/audio_codecs/audio_encoder_factory_template.h"
 
 #include <memory>
+#include <utility>
+#include <vector>
 
+#include "absl/types/optional.h"
 #include "api/audio_codecs/L16/audio_encoder_L16.h"
+#include "api/audio_codecs/audio_codec_pair_id.h"
+#include "api/audio_codecs/audio_encoder.h"
+#include "api/audio_codecs/audio_encoder_factory.h"
+#include "api/audio_codecs/audio_format.h"
 #include "api/audio_codecs/g711/audio_encoder_g711.h"
 #include "api/audio_codecs/g722/audio_encoder_g722.h"
 #include "api/audio_codecs/ilbc/audio_encoder_ilbc.h"
 #include "api/audio_codecs/opus/audio_encoder_opus.h"
 #include "api/environment/environment.h"
 #include "api/environment/environment_factory.h"
+#include "api/make_ref_counted.h"
+#include "api/scoped_refptr.h"
 #include "test/gmock.h"
 #include "test/gtest.h"
 #include "test/mock_audio_encoder.h"
diff --git a/api/audio_options.h b/api/audio_options.h
index 3ab3b3c..2162471 100644
--- a/api/audio_options.h
+++ b/api/audio_options.h
@@ -11,8 +11,6 @@
 #ifndef API_AUDIO_OPTIONS_H_
 #define API_AUDIO_OPTIONS_H_
 
-#include <stdint.h>
-
 #include <string>
 
 #include "absl/types/optional.h"
diff --git a/api/call/transport.cc b/api/call/transport.cc
index bcadc76..0a9dd5b 100644
--- a/api/call/transport.cc
+++ b/api/call/transport.cc
@@ -10,8 +10,6 @@
 
 #include "api/call/transport.h"
 
-#include <cstdint>
-
 namespace webrtc {
 
 PacketOptions::PacketOptions() = default;
diff --git a/api/call/transport.h b/api/call/transport.h
index c27377f..7240a8b 100644
--- a/api/call/transport.h
+++ b/api/call/transport.h
@@ -11,7 +11,6 @@
 #ifndef API_CALL_TRANSPORT_H_
 #define API_CALL_TRANSPORT_H_
 
-#include <stddef.h>
 #include <stdint.h>
 
 #include "api/array_view.h"
diff --git a/api/candidate.cc b/api/candidate.cc
index 4e462dd..7711329 100644
--- a/api/candidate.cc
+++ b/api/candidate.cc
@@ -10,12 +10,19 @@
 
 #include "api/candidate.h"
 
-#include "absl/base/attributes.h"
+#include <algorithm>  // IWYU pragma: keep
+#include <cstdint>
+#include <string>
+
+#include "absl/strings/string_view.h"
 #include "p2p/base/p2p_constants.h"
+#include "rtc_base/checks.h"
 #include "rtc_base/crc32.h"
 #include "rtc_base/crypto_random.h"
 #include "rtc_base/ip_address.h"
-#include "rtc_base/logging.h"
+#include "rtc_base/network_constants.h"
+#include "rtc_base/socket_address.h"
+#include "rtc_base/string_encode.h"
 #include "rtc_base/strings/string_builder.h"
 
 using webrtc::IceCandidateType;
diff --git a/api/candidate.h b/api/candidate.h
index 5f6f7cd..180b1c9 100644
--- a/api/candidate.h
+++ b/api/candidate.h
@@ -11,13 +11,11 @@
 #ifndef API_CANDIDATE_H_
 #define API_CANDIDATE_H_
 
-#include <limits.h>
+#include <stddef.h>
 #include <stdint.h>
 
-#include <algorithm>
 #include <string>
 
-#include "absl/base/attributes.h"
 #include "absl/strings/string_view.h"
 #include "rtc_base/checks.h"
 #include "rtc_base/network_constants.h"
diff --git a/api/candidate_unittest.cc b/api/candidate_unittest.cc
index 4743610..3091629 100644
--- a/api/candidate_unittest.cc
+++ b/api/candidate_unittest.cc
@@ -13,7 +13,8 @@
 #include <string>
 
 #include "p2p/base/p2p_constants.h"
-#include "rtc_base/gunit.h"
+#include "rtc_base/socket_address.h"
+#include "test/gtest.h"
 
 using webrtc::IceCandidateType;
 
diff --git a/api/create_peerconnection_factory.h b/api/create_peerconnection_factory.h
index 18febb6..6c37124 100644
--- a/api/create_peerconnection_factory.h
+++ b/api/create_peerconnection_factory.h
@@ -10,6 +10,7 @@
 
 #ifndef API_CREATE_PEERCONNECTION_FACTORY_H_
 #define API_CREATE_PEERCONNECTION_FACTORY_H_
+// IWYU pragma: no_include "rtc_base/thread.h"
 
 #include <memory>
 
@@ -29,11 +30,9 @@
 // TODO(bugs.webrtc.org/9987): Move rtc::Thread to api/ or expose a better
 // type. At the moment, rtc::Thread is not part of api/ so it cannot be
 // included in order to avoid to leak internal types.
-class Thread;
+class Thread;  // IWYU pragma: keep
 }  // namespace rtc
-
 namespace webrtc {
-
 class AudioFrameProcessor;
 
 // Create a new instance of PeerConnectionFactoryInterface with optional video
diff --git a/api/crypto/BUILD.gn b/api/crypto/BUILD.gn
index 5064aff..d1f9b13 100644
--- a/api/crypto/BUILD.gn
+++ b/api/crypto/BUILD.gn
@@ -23,6 +23,7 @@
     "crypto_options.h",
   ]
   deps = [
+    "../../rtc_base:checks",
     "../../rtc_base:ssl_adapter",
     "../../rtc_base/system:rtc_export",
   ]
diff --git a/api/crypto/crypto_options.cc b/api/crypto/crypto_options.cc
index 22c5dd4..37df0d5 100644
--- a/api/crypto/crypto_options.cc
+++ b/api/crypto/crypto_options.cc
@@ -10,6 +10,9 @@
 
 #include "api/crypto/crypto_options.h"
 
+#include <vector>
+
+#include "rtc_base/checks.h"
 #include "rtc_base/ssl_stream_adapter.h"
 
 namespace webrtc {
diff --git a/api/dtls_transport_interface.cc b/api/dtls_transport_interface.cc
index faebc09..8133525 100644
--- a/api/dtls_transport_interface.cc
+++ b/api/dtls_transport_interface.cc
@@ -10,6 +10,12 @@
 
 #include "api/dtls_transport_interface.h"
 
+#include <memory>
+#include <utility>
+
+#include "absl/types/optional.h"
+#include "rtc_base/ssl_certificate.h"
+
 namespace webrtc {
 
 DtlsTransportInformation::DtlsTransportInformation()
diff --git a/api/dtls_transport_interface.h b/api/dtls_transport_interface.h
index fe64fb1..66ae4d4 100644
--- a/api/dtls_transport_interface.h
+++ b/api/dtls_transport_interface.h
@@ -12,8 +12,8 @@
 #define API_DTLS_TRANSPORT_INTERFACE_H_
 
 #include <memory>
-#include <utility>
 
+#include "absl/base/attributes.h"
 #include "absl/types/optional.h"
 #include "api/ice_transport_interface.h"
 #include "api/ref_count.h"
diff --git a/api/enable_media.cc b/api/enable_media.cc
index 91938cc..e9c115b 100644
--- a/api/enable_media.cc
+++ b/api/enable_media.cc
@@ -15,8 +15,11 @@
 
 #include "api/environment/environment.h"
 #include "api/peer_connection_interface.h"
+#include "api/scoped_refptr.h"
+#include "call/call.h"
+#include "call/call_config.h"
 #include "call/create_call.h"
-#include "media/engine/webrtc_media_engine.h"
+#include "media/base/media_engine.h"
 #include "media/engine/webrtc_video_engine.h"
 #include "media/engine/webrtc_voice_engine.h"
 #include "pc/media_factory.h"
diff --git a/api/enable_media_with_defaults.cc b/api/enable_media_with_defaults.cc
index ace2247..7dccfa2 100644
--- a/api/enable_media_with_defaults.cc
+++ b/api/enable_media_with_defaults.cc
@@ -10,10 +10,14 @@
 
 #include "api/enable_media_with_defaults.h"
 
+#include <memory>
+
 #include "api/audio/audio_processing.h"
 #include "api/audio_codecs/builtin_audio_decoder_factory.h"
 #include "api/audio_codecs/builtin_audio_encoder_factory.h"
 #include "api/enable_media.h"
+#include "api/peer_connection_interface.h"
+#include "api/scoped_refptr.h"
 #include "api/task_queue/default_task_queue_factory.h"
 #include "api/video_codecs/builtin_video_decoder_factory.h"
 #include "api/video_codecs/builtin_video_encoder_factory.h"
diff --git a/api/environment/BUILD.gn b/api/environment/BUILD.gn
index 70ffdec..10d008f 100644
--- a/api/environment/BUILD.gn
+++ b/api/environment/BUILD.gn
@@ -28,6 +28,7 @@
   ]
   deps = [
     ":environment",
+    "..:field_trials_view",
     "..:make_ref_counted",
     "..:refcountedbase",
     "..:scoped_refptr",
@@ -36,6 +37,7 @@
     "../../system_wrappers",
     "../rtc_event_log",
     "../task_queue:default_task_queue_factory",
+    "../task_queue:task_queue",
     "../transport:field_trial_based_config",
     "//third_party/abseil-cpp/absl/base:nullability",
   ]
@@ -55,6 +57,7 @@
       "../task_queue",
       "../units:timestamp",
       "//third_party/abseil-cpp/absl/functional:any_invocable",
+      "//third_party/abseil-cpp/absl/strings:string_view",
       "//third_party/abseil-cpp/absl/types:optional",
     ]
   }
diff --git a/api/environment/environment_factory.cc b/api/environment/environment_factory.cc
index c0b681a..293ef6c 100644
--- a/api/environment/environment_factory.cc
+++ b/api/environment/environment_factory.cc
@@ -12,11 +12,16 @@
 
 #include <memory>
 #include <utility>
-#include <vector>
 
+#include "absl/base/nullability.h"
+#include "api/environment/environment.h"
+#include "api/field_trials_view.h"
 #include "api/make_ref_counted.h"
+#include "api/ref_counted_base.h"
 #include "api/rtc_event_log/rtc_event_log.h"
+#include "api/scoped_refptr.h"
 #include "api/task_queue/default_task_queue_factory.h"
+#include "api/task_queue/task_queue_factory.h"
 #include "api/transport/field_trial_based_config.h"
 #include "rtc_base/checks.h"
 #include "system_wrappers/include/clock.h"
diff --git a/api/environment/environment_factory.h b/api/environment/environment_factory.h
index a0fc3ef..0d37ea9 100644
--- a/api/environment/environment_factory.h
+++ b/api/environment/environment_factory.h
@@ -24,11 +24,12 @@
 
 // These classes are forward declared to reduce amount of headers exposed
 // through api header.
+// IWYU pragma: begin_keep
 class Clock;
 class TaskQueueFactory;
 class FieldTrialsView;
 class RtcEventLog;
-
+// IWYU pragma: end_keep
 // Constructs `Environment`.
 // Individual utilities are provided using one of the `Set` functions.
 // `Set` functions do nothing when nullptr value is passed.
diff --git a/api/environment/environment_unittest.cc b/api/environment/environment_unittest.cc
index 07bd879..17bc668 100644
--- a/api/environment/environment_unittest.cc
+++ b/api/environment/environment_unittest.cc
@@ -16,10 +16,13 @@
 #include <vector>
 
 #include "absl/functional/any_invocable.h"
+#include "absl/strings/string_view.h"
 #include "absl/types/optional.h"
 #include "api/environment/environment_factory.h"
 #include "api/field_trials_view.h"
+#include "api/rtc_event_log/rtc_event.h"
 #include "api/rtc_event_log/rtc_event_log.h"
+#include "api/task_queue/task_queue_base.h"
 #include "api/task_queue/task_queue_factory.h"
 #include "api/units/timestamp.h"
 #include "system_wrappers/include/clock.h"
diff --git a/api/field_trials.cc b/api/field_trials.cc
index 4bd1127..2643e12 100644
--- a/api/field_trials.cc
+++ b/api/field_trials.cc
@@ -11,8 +11,13 @@
 #include "api/field_trials.h"
 
 #include <atomic>
+#include <memory>
+#include <string>
+#include <utility>
 
+#include "absl/strings/string_view.h"
 #include "rtc_base/checks.h"
+#include "rtc_base/containers/flat_map.h"
 #include "system_wrappers/include/field_trial.h"
 
 namespace {
diff --git a/api/field_trials_registry.cc b/api/field_trials_registry.cc
index 61d3151..11259cc 100644
--- a/api/field_trials_registry.cc
+++ b/api/field_trials_registry.cc
@@ -11,12 +11,13 @@
 
 #include <string>
 
-#include "absl/algorithm/container.h"
 #include "absl/strings/string_view.h"
+// IWYU pragma: begin_keep
+#include "absl/algorithm/container.h"
 #include "experiments/registered_field_trials.h"
 #include "rtc_base/checks.h"
-#include "rtc_base/containers/flat_set.h"
 #include "rtc_base/logging.h"
+// IWYU pragma: end_keep
 
 namespace webrtc {
 
diff --git a/api/field_trials_unittest.cc b/api/field_trials_unittest.cc
index 804b52a..8144f11 100644
--- a/api/field_trials_unittest.cc
+++ b/api/field_trials_unittest.cc
@@ -11,9 +11,7 @@
 #include "api/field_trials.h"
 
 #include <memory>
-#include <utility>
 
-#include "absl/strings/string_view.h"
 #include "api/transport/field_trial_based_config.h"
 #include "rtc_base/containers/flat_set.h"
 #include "system_wrappers/include/field_trial.h"
diff --git a/api/frame_transformer_factory.cc b/api/frame_transformer_factory.cc
index 841ab0f..8807301 100644
--- a/api/frame_transformer_factory.cc
+++ b/api/frame_transformer_factory.cc
@@ -10,8 +10,12 @@
 
 #include "api/frame_transformer_factory.h"
 
+#include <memory>
+
+#include "api/frame_transformer_interface.h"
 #include "audio/channel_send_frame_transformer_delegate.h"
 #include "modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.h"
+#include "rtc_base/checks.h"
 
 namespace webrtc {
 
diff --git a/api/frame_transformer_factory.h b/api/frame_transformer_factory.h
index a73ff62..fda6117 100644
--- a/api/frame_transformer_factory.h
+++ b/api/frame_transformer_factory.h
@@ -12,12 +12,9 @@
 #define API_FRAME_TRANSFORMER_FACTORY_H_
 
 #include <memory>
-#include <vector>
 
 #include "api/frame_transformer_interface.h"
-#include "api/scoped_refptr.h"
-#include "api/video/encoded_frame.h"
-#include "api/video/video_frame_metadata.h"
+#include "rtc_base/system/rtc_export.h"
 
 // This file contains EXPERIMENTAL functions to create video frames from
 // either an old video frame or directly from parameters.
diff --git a/api/function_view.h b/api/function_view.h
index 5ae1bd6..b191a05 100644
--- a/api/function_view.h
+++ b/api/function_view.h
@@ -11,6 +11,7 @@
 #ifndef API_FUNCTION_VIEW_H_
 #define API_FUNCTION_VIEW_H_
 
+#include <cstddef>
 #include <type_traits>
 #include <utility>
 
diff --git a/api/ice_transport_factory.cc b/api/ice_transport_factory.cc
index e88ac18..13c4017 100644
--- a/api/ice_transport_factory.cc
+++ b/api/ice_transport_factory.cc
@@ -13,12 +13,15 @@
 #include <memory>
 #include <utility>
 
+#include "api/ice_transport_interface.h"
 #include "api/make_ref_counted.h"
+#include "api/scoped_refptr.h"
+#include "api/sequence_checker.h"
 #include "p2p/base/ice_transport_internal.h"
 #include "p2p/base/p2p_constants.h"
 #include "p2p/base/p2p_transport_channel.h"
 #include "p2p/base/port_allocator.h"
-#include "rtc_base/thread.h"
+#include "rtc_base/thread_annotations.h"
 
 namespace webrtc {
 
diff --git a/api/ice_transport_factory.h b/api/ice_transport_factory.h
index 2268ea5..a5cee12 100644
--- a/api/ice_transport_factory.h
+++ b/api/ice_transport_factory.h
@@ -16,7 +16,7 @@
 #include "rtc_base/system/rtc_export.h"
 
 namespace cricket {
-class PortAllocator;
+class PortAllocator;  // IWYU pragma: keep
 }  // namespace cricket
 
 namespace webrtc {
diff --git a/api/legacy_stats_types.h b/api/legacy_stats_types.h
index 70f21d4..2b54614 100644
--- a/api/legacy_stats_types.h
+++ b/api/legacy_stats_types.h
@@ -14,7 +14,9 @@
 #ifndef API_LEGACY_STATS_TYPES_H_
 #define API_LEGACY_STATS_TYPES_H_
 
-#include <algorithm>
+#include <stddef.h>
+#include <stdint.h>
+
 #include <list>
 #include <map>
 #include <string>
@@ -23,7 +25,9 @@
 #include "api/ref_count.h"
 #include "api/scoped_refptr.h"
 #include "api/sequence_checker.h"
+#include "rtc_base/checks.h"
 #include "rtc_base/system/rtc_export.h"
+#include "rtc_base/thread_annotations.h"
 
 namespace webrtc {
 
diff --git a/api/media_stream_interface.h b/api/media_stream_interface.h
index d050fe7..1597b8d 100644
--- a/api/media_stream_interface.h
+++ b/api/media_stream_interface.h
@@ -17,6 +17,7 @@
 #define API_MEDIA_STREAM_INTERFACE_H_
 
 #include <stddef.h>
+#include <stdint.h>
 
 #include <string>
 #include <vector>
@@ -31,6 +32,7 @@
 #include "api/video/video_sink_interface.h"
 #include "api/video/video_source_interface.h"
 #include "api/video_track_source_constraints.h"
+#include "rtc_base/checks.h"
 #include "rtc_base/system/rtc_export.h"
 
 namespace webrtc {
diff --git a/api/metronome/test/fake_metronome.cc b/api/metronome/test/fake_metronome.cc
index bd54d5b..563bd7e 100644
--- a/api/metronome/test/fake_metronome.cc
+++ b/api/metronome/test/fake_metronome.cc
@@ -10,6 +10,7 @@
 
 #include "api/metronome/test/fake_metronome.h"
 
+#include <cstddef>
 #include <utility>
 #include <vector>
 
diff --git a/api/neteq/BUILD.gn b/api/neteq/BUILD.gn
index c29660d..b995b22 100644
--- a/api/neteq/BUILD.gn
+++ b/api/neteq/BUILD.gn
@@ -17,6 +17,7 @@
   ]
 
   deps = [
+    "..:array_view",
     "..:rtp_headers",
     "..:rtp_packet_info",
     "..:scoped_refptr",
diff --git a/api/neteq/custom_neteq_factory.h b/api/neteq/custom_neteq_factory.h
index d080f68..1e9a1fc 100644
--- a/api/neteq/custom_neteq_factory.h
+++ b/api/neteq/custom_neteq_factory.h
@@ -14,6 +14,7 @@
 #include <memory>
 
 #include "api/audio_codecs/audio_decoder_factory.h"
+#include "api/neteq/neteq.h"
 #include "api/neteq/neteq_controller_factory.h"
 #include "api/neteq/neteq_factory.h"
 #include "api/scoped_refptr.h"
diff --git a/api/neteq/default_neteq_controller_factory.h b/api/neteq/default_neteq_controller_factory.h
index 611afc2..4df307f 100644
--- a/api/neteq/default_neteq_controller_factory.h
+++ b/api/neteq/default_neteq_controller_factory.h
@@ -13,6 +13,7 @@
 
 #include <memory>
 
+#include "api/neteq/neteq_controller.h"
 #include "api/neteq/neteq_controller_factory.h"
 
 namespace webrtc {
diff --git a/api/neteq/neteq.h b/api/neteq/neteq.h
index bdf78ed..77ccb31 100644
--- a/api/neteq/neteq.h
+++ b/api/neteq/neteq.h
@@ -12,25 +12,23 @@
 #define API_NETEQ_NETEQ_H_
 
 #include <stddef.h>  // Provide access to size_t.
+#include <stdint.h>
 
 #include <map>
 #include <string>
 #include <vector>
 
 #include "absl/types/optional.h"
+#include "api/array_view.h"
 #include "api/audio_codecs/audio_codec_pair_id.h"
-#include "api/audio_codecs/audio_decoder.h"
 #include "api/audio_codecs/audio_format.h"
 #include "api/rtp_headers.h"
-#include "api/scoped_refptr.h"
 #include "api/units/timestamp.h"
 
 namespace webrtc {
 
 // Forward declarations.
 class AudioFrame;
-class AudioDecoderFactory;
-class Clock;
 
 struct NetEqNetworkStatistics {
   uint16_t current_buffer_size_ms;    // Current jitter buffer size in ms.
diff --git a/api/neteq/tick_timer_unittest.cc b/api/neteq/tick_timer_unittest.cc
index 863c011..25d3a8a 100644
--- a/api/neteq/tick_timer_unittest.cc
+++ b/api/neteq/tick_timer_unittest.cc
@@ -10,9 +10,9 @@
 
 #include "api/neteq/tick_timer.h"
 
+#include <cstdint>
 #include <memory>
 
-#include "test/gmock.h"
 #include "test/gtest.h"
 
 namespace webrtc {
diff --git a/api/numerics/samples_stats_counter.h b/api/numerics/samples_stats_counter.h
index c4eabff..57a53a2 100644
--- a/api/numerics/samples_stats_counter.h
+++ b/api/numerics/samples_stats_counter.h
@@ -11,6 +11,9 @@
 #ifndef API_NUMERICS_SAMPLES_STATS_COUNTER_H_
 #define API_NUMERICS_SAMPLES_STATS_COUNTER_H_
 
+#include <stddef.h>
+#include <stdint.h>
+
 #include <map>
 #include <string>
 #include <vector>
diff --git a/api/peer_connection_interface.h b/api/peer_connection_interface.h
index 628a9f3..a422eae 100644
--- a/api/peer_connection_interface.h
+++ b/api/peer_connection_interface.h
@@ -66,6 +66,7 @@
 
 #ifndef API_PEER_CONNECTION_INTERFACE_H_
 #define API_PEER_CONNECTION_INTERFACE_H_
+// IWYU pragma: no_include "pc/media_factory.h"
 
 #include <stdint.h>
 #include <stdio.h>
@@ -80,7 +81,9 @@
 #include "absl/types/optional.h"
 #include "api/adaptation/resource.h"
 #include "api/async_dns_resolver.h"
+#include "api/audio/audio_device.h"
 #include "api/audio/audio_mixer.h"
+#include "api/audio/audio_processing.h"
 #include "api/audio_codecs/audio_decoder_factory.h"
 #include "api/audio_codecs/audio_encoder_factory.h"
 #include "api/audio_options.h"
@@ -123,32 +126,36 @@
 #include "api/video_codecs/video_encoder_factory.h"
 #include "call/rtp_transport_controller_send_factory_interface.h"
 #include "media/base/media_config.h"
-#include "media/base/media_engine.h"
 // TODO(bugs.webrtc.org/7447): We plan to provide a way to let applications
 // inject a PacketSocketFactory and/or NetworkManager, and not expose
 // PortAllocator in the PeerConnection api.
+#include "api/audio/audio_frame_processor.h"
 #include "api/ref_count.h"
+#include "api/units/time_delta.h"
+#include "p2p/base/port.h"
 #include "p2p/base/port_allocator.h"
+#include "rtc_base/checks.h"
 #include "rtc_base/network.h"
 #include "rtc_base/network_constants.h"
 #include "rtc_base/network_monitor_factory.h"
 #include "rtc_base/rtc_certificate.h"
 #include "rtc_base/rtc_certificate_generator.h"
-#include "rtc_base/socket_address.h"
+#include "rtc_base/socket_factory.h"
 #include "rtc_base/ssl_certificate.h"
 #include "rtc_base/ssl_stream_adapter.h"
 #include "rtc_base/system/rtc_export.h"
 #include "rtc_base/thread.h"
 
 namespace rtc {
-class Thread;
+class Thread;  // IWYU pragma: keep
 }  // namespace rtc
 
 namespace webrtc {
-
+// IWYU pragma: begin_keep
 // MediaFactory class definition is not part of the api.
 class MediaFactory;
 
+// IWYU pragma: end_keep
 // MediaStream container interface.
 class StreamCollectionInterface : public webrtc::RefCountInterface {
  public:
diff --git a/api/rtc_error.h b/api/rtc_error.h
index 7adf30e..917db7d 100644
--- a/api/rtc_error.h
+++ b/api/rtc_error.h
@@ -14,6 +14,8 @@
 #ifdef WEBRTC_UNIT_TEST
 #include <ostream>
 #endif  // WEBRTC_UNIT_TEST
+#include <stdint.h>
+
 #include <string>
 #include <utility>  // For std::move.
 
diff --git a/api/rtp_headers.h b/api/rtp_headers.h
index 7ededb9..129ab5f 100644
--- a/api/rtp_headers.h
+++ b/api/rtp_headers.h
@@ -17,12 +17,13 @@
 #include <string>
 
 #include "absl/types/optional.h"
-#include "api/array_view.h"
 #include "api/units/timestamp.h"
 #include "api/video/color_space.h"
 #include "api/video/video_content_type.h"
 #include "api/video/video_rotation.h"
 #include "api/video/video_timing.h"
+#include "rtc_base/checks.h"
+#include "rtc_base/system/rtc_export.h"
 
 namespace webrtc {
 
diff --git a/api/rtp_packet_info.cc b/api/rtp_packet_info.cc
index cfe6a24..90cd275 100644
--- a/api/rtp_packet_info.cc
+++ b/api/rtp_packet_info.cc
@@ -10,8 +10,15 @@
 
 #include "api/rtp_packet_info.h"
 
+#include <stddef.h>
+
 #include <algorithm>
+#include <cstdint>
 #include <utility>
+#include <vector>
+
+#include "api/rtp_headers.h"
+#include "api/units/timestamp.h"
 
 namespace webrtc {
 
diff --git a/api/rtp_packet_info_unittest.cc b/api/rtp_packet_info_unittest.cc
index d35edf7..49ed337 100644
--- a/api/rtp_packet_info_unittest.cc
+++ b/api/rtp_packet_info_unittest.cc
@@ -8,9 +8,15 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "api/rtp_packet_infos.h"
+#include "api/rtp_packet_info.h"
+
+#include <cstdint>
+#include <vector>
+
+#include "absl/types/optional.h"
+#include "api/rtp_headers.h"
 #include "api/units/time_delta.h"
-#include "test/gmock.h"
+#include "api/units/timestamp.h"
 #include "test/gtest.h"
 
 namespace webrtc {
diff --git a/api/rtp_packet_infos.h b/api/rtp_packet_infos.h
index 7445729..dfb4e1e 100644
--- a/api/rtp_packet_infos.h
+++ b/api/rtp_packet_infos.h
@@ -11,7 +11,6 @@
 #ifndef API_RTP_PACKET_INFOS_H_
 #define API_RTP_PACKET_INFOS_H_
 
-#include <cstdint>
 #include <utility>
 #include <vector>
 
diff --git a/api/rtp_packet_infos_unittest.cc b/api/rtp_packet_infos_unittest.cc
index a90cfa0..544bb93 100644
--- a/api/rtp_packet_infos_unittest.cc
+++ b/api/rtp_packet_infos_unittest.cc
@@ -10,6 +10,11 @@
 
 #include "api/rtp_packet_infos.h"
 
+#include <stddef.h>
+
+#include "api/rtp_headers.h"
+#include "api/rtp_packet_info.h"
+#include "api/units/timestamp.h"
 #include "test/gmock.h"
 #include "test/gtest.h"
 
diff --git a/api/rtp_parameters.cc b/api/rtp_parameters.cc
index 3ff4b58..283d238 100644
--- a/api/rtp_parameters.cc
+++ b/api/rtp_parameters.cc
@@ -10,12 +10,16 @@
 #include "api/rtp_parameters.h"
 
 #include <algorithm>
+#include <cstdint>
 #include <string>
 #include <tuple>
-#include <utility>
+#include <vector>
 
+#include "absl/strings/string_view.h"
 #include "api/array_view.h"
+#include "api/rtp_transceiver_direction.h"
 #include "media/base/media_constants.h"
+#include "rtc_base/checks.h"
 #include "rtc_base/strings/string_builder.h"
 
 namespace webrtc {
diff --git a/api/rtp_transceiver_interface.h b/api/rtp_transceiver_interface.h
index 940264e..555566d 100644
--- a/api/rtp_transceiver_interface.h
+++ b/api/rtp_transceiver_interface.h
@@ -19,6 +19,7 @@
 #include "api/array_view.h"
 #include "api/media_types.h"
 #include "api/ref_count.h"
+#include "api/rtc_error.h"
 #include "api/rtp_parameters.h"
 #include "api/rtp_receiver_interface.h"
 #include "api/rtp_sender_interface.h"
diff --git a/api/scoped_refptr.h b/api/scoped_refptr.h
index 61b2eb1..35ad2fe 100644
--- a/api/scoped_refptr.h
+++ b/api/scoped_refptr.h
@@ -63,7 +63,7 @@
 #ifndef API_SCOPED_REFPTR_H_
 #define API_SCOPED_REFPTR_H_
 
-#include <memory>
+#include <cstddef>
 #include <utility>
 
 namespace webrtc {
diff --git a/api/scoped_refptr_unittest.cc b/api/scoped_refptr_unittest.cc
index 22b6120..490b61d 100644
--- a/api/scoped_refptr_unittest.cc
+++ b/api/scoped_refptr_unittest.cc
@@ -10,6 +10,7 @@
 
 #include "api/scoped_refptr.h"
 
+#include <type_traits>
 #include <utility>
 #include <vector>
 
diff --git a/api/sctp_transport_interface.h b/api/sctp_transport_interface.h
index cfd7e13..25c2ba0 100644
--- a/api/sctp_transport_interface.h
+++ b/api/sctp_transport_interface.h
@@ -14,8 +14,8 @@
 #include "absl/types/optional.h"
 #include "api/dtls_transport_interface.h"
 #include "api/ref_count.h"
-#include "api/rtc_error.h"
 #include "api/scoped_refptr.h"
+#include "rtc_base/system/rtc_export.h"
 
 namespace webrtc {
 
diff --git a/api/sequence_checker.h b/api/sequence_checker.h
index 5ff5860..2c352f7 100644
--- a/api/sequence_checker.h
+++ b/api/sequence_checker.h
@@ -10,6 +10,7 @@
 #ifndef API_SEQUENCE_CHECKER_H_
 #define API_SEQUENCE_CHECKER_H_
 
+#include "api/task_queue/task_queue_base.h"
 #include "rtc_base/checks.h"
 #include "rtc_base/synchronization/sequence_checker_internal.h"
 #include "rtc_base/thread_annotations.h"
diff --git a/api/sequence_checker_unittest.cc b/api/sequence_checker_unittest.cc
index e54f33d..3579fa1 100644
--- a/api/sequence_checker_unittest.cc
+++ b/api/sequence_checker_unittest.cc
@@ -10,14 +10,18 @@
 
 #include "api/sequence_checker.h"
 
+#include <functional>
 #include <memory>
-#include <utility>
 
+#include "absl/functional/any_invocable.h"
 #include "api/function_view.h"
 #include "api/units/time_delta.h"
+#include "rtc_base/checks.h"
 #include "rtc_base/event.h"
 #include "rtc_base/platform_thread.h"
+#include "rtc_base/synchronization/sequence_checker_internal.h"
 #include "rtc_base/task_queue_for_test.h"
+#include "rtc_base/thread_annotations.h"
 #include "test/gmock.h"
 #include "test/gtest.h"
 
diff --git a/api/voip/test/compile_all_headers.cc b/api/voip/test/compile_all_headers.cc
index 73a0f0d..c95ba78 100644
--- a/api/voip/test/compile_all_headers.cc
+++ b/api/voip/test/compile_all_headers.cc
@@ -11,4 +11,3 @@
 // This file verifies that all include files in this directory can be
 // compiled without errors or other required includes.
 
-#include "api/voip/test/mock_voip_engine.h"
diff --git a/modules/audio_coding/BUILD.gn b/modules/audio_coding/BUILD.gn
index 655a934..5416f83 100644
--- a/modules/audio_coding/BUILD.gn
+++ b/modules/audio_coding/BUILD.gn
@@ -505,6 +505,7 @@
 
   deps = [
     ":audio_coding_opus_common",
+    "../../api:array_view",
     "../../api/audio_codecs:audio_codecs_api",
     "../../api/audio_codecs/opus:audio_decoder_opus_config",
     "../../api/audio_codecs/opus:audio_encoder_opus_config",
@@ -513,6 +514,7 @@
     "../../rtc_base:checks",
     "../../rtc_base:logging",
     "../../rtc_base:macromagic",
+    "../../rtc_base:safe_conversions",
     "../../rtc_base:safe_minmax",
     "../../rtc_base:stringutils",
     "//third_party/abseil-cpp/absl/memory",
diff --git a/modules/audio_coding/acm2/acm_remixing.h b/modules/audio_coding/acm2/acm_remixing.h
index 661569b..827f7bd 100644
--- a/modules/audio_coding/acm2/acm_remixing.h
+++ b/modules/audio_coding/acm2/acm_remixing.h
@@ -13,6 +13,7 @@
 
 #include <vector>
 
+#include "api/array_view.h"
 #include "api/audio/audio_frame.h"
 
 namespace webrtc {
diff --git a/modules/audio_coding/codecs/opus/audio_encoder_multi_channel_opus_impl.cc b/modules/audio_coding/codecs/opus/audio_encoder_multi_channel_opus_impl.cc
index 38a11c1..9d140f7 100644
--- a/modules/audio_coding/codecs/opus/audio_encoder_multi_channel_opus_impl.cc
+++ b/modules/audio_coding/codecs/opus/audio_encoder_multi_channel_opus_impl.cc
@@ -20,15 +20,17 @@
 #include "modules/audio_coding/codecs/opus/audio_encoder_multi_channel_opus_impl.h"
 
 #include <algorithm>
+#include <iterator>
 #include <memory>
 #include <string>
 #include <vector>
 
 #include "absl/strings/match.h"
+#include "api/audio_codecs/opus/audio_encoder_opus_config.h"
 #include "modules/audio_coding/codecs/opus/audio_coder_opus_common.h"
-#include "rtc_base/arraysize.h"
 #include "rtc_base/checks.h"
 #include "rtc_base/logging.h"
+#include "rtc_base/numerics/safe_conversions.h"
 #include "rtc_base/string_to_number.h"
 
 namespace webrtc {
diff --git a/modules/audio_coding/codecs/opus/audio_encoder_multi_channel_opus_impl.h b/modules/audio_coding/codecs/opus/audio_encoder_multi_channel_opus_impl.h
index 8a72105..6d6e63b 100644
--- a/modules/audio_coding/codecs/opus/audio_encoder_multi_channel_opus_impl.h
+++ b/modules/audio_coding/codecs/opus/audio_encoder_multi_channel_opus_impl.h
@@ -11,16 +11,21 @@
 #ifndef MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_MULTI_CHANNEL_OPUS_IMPL_H_
 #define MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_MULTI_CHANNEL_OPUS_IMPL_H_
 
+#include <stddef.h>
+#include <stdint.h>
+
 #include <memory>
 #include <utility>
 #include <vector>
 
 #include "absl/types/optional.h"
+#include "api/array_view.h"
 #include "api/audio_codecs/audio_encoder.h"
 #include "api/audio_codecs/audio_format.h"
 #include "api/audio_codecs/opus/audio_encoder_multi_channel_opus_config.h"
 #include "api/units/time_delta.h"
 #include "modules/audio_coding/codecs/opus/opus_interface.h"
+#include "rtc_base/buffer.h"
 
 namespace webrtc {
 
diff --git a/rtc_base/synchronization/BUILD.gn b/rtc_base/synchronization/BUILD.gn
index cc30b1b..6b05f5c 100644
--- a/rtc_base/synchronization/BUILD.gn
+++ b/rtc_base/synchronization/BUILD.gn
@@ -44,7 +44,10 @@
 }
 
 rtc_library("sequence_checker_internal") {
-  visibility = [ "../../api:sequence_checker" ]
+  visibility = [
+    "../../api:rtc_api_unittests",
+    "../../api:sequence_checker",
+  ]
   sources = [
     "sequence_checker_internal.cc",
     "sequence_checker_internal.h",
diff --git a/rtc_tools/data_channel_benchmark/BUILD.gn b/rtc_tools/data_channel_benchmark/BUILD.gn
index 4535372..f6a7bfb 100644
--- a/rtc_tools/data_channel_benchmark/BUILD.gn
+++ b/rtc_tools/data_channel_benchmark/BUILD.gn
@@ -46,8 +46,13 @@
     "../../api:libjingle_peerconnection_api",
     "../../api:rtc_error",
     "../../api:scoped_refptr",
+    "../../api/audio:audio_device",
+    "../../api/audio:audio_mixer_api",
+    "../../api/audio:audio_processing",
     "../../api/audio_codecs:builtin_audio_decoder_factory",
     "../../api/audio_codecs:builtin_audio_encoder_factory",
+    "../../api/video_codecs:video_codecs_api",
+    "../../api/video_codecs:video_codecs_api",
     "../../api/video_codecs:video_decoder_factory_template",
     "../../api/video_codecs:video_decoder_factory_template_dav1d_adapter",
     "../../api/video_codecs:video_decoder_factory_template_libvpx_vp8_adapter",
@@ -58,6 +63,7 @@
     "../../api/video_codecs:video_encoder_factory_template_libvpx_vp8_adapter",
     "../../api/video_codecs:video_encoder_factory_template_libvpx_vp9_adapter",
     "../../api/video_codecs:video_encoder_factory_template_open_h264_adapter",
+    "../../rtc_base:checks",
     "../../rtc_base:logging",
     "../../rtc_base:refcount",
     "../../rtc_base:rtc_event",
diff --git a/rtc_tools/data_channel_benchmark/peer_connection_client.cc b/rtc_tools/data_channel_benchmark/peer_connection_client.cc
index a6f8bf5..4432956 100644
--- a/rtc_tools/data_channel_benchmark/peer_connection_client.cc
+++ b/rtc_tools/data_channel_benchmark/peer_connection_client.cc
@@ -13,6 +13,9 @@
 #include <string>
 #include <utility>
 
+#include "api/audio/audio_device.h"
+#include "api/audio/audio_mixer.h"
+#include "api/audio/audio_processing.h"
 #include "api/audio_codecs/builtin_audio_decoder_factory.h"
 #include "api/audio_codecs/builtin_audio_encoder_factory.h"
 #include "api/create_peerconnection_factory.h"
@@ -20,18 +23,23 @@
 #include "api/peer_connection_interface.h"
 #include "api/rtc_error.h"
 #include "api/scoped_refptr.h"
+#include "api/set_local_description_observer_interface.h"
 #include "api/set_remote_description_observer_interface.h"
+#include "api/video_codecs/video_decoder_factory.h"
 #include "api/video_codecs/video_decoder_factory_template.h"
 #include "api/video_codecs/video_decoder_factory_template_dav1d_adapter.h"
 #include "api/video_codecs/video_decoder_factory_template_libvpx_vp8_adapter.h"
 #include "api/video_codecs/video_decoder_factory_template_libvpx_vp9_adapter.h"
 #include "api/video_codecs/video_decoder_factory_template_open_h264_adapter.h"
+#include "api/video_codecs/video_encoder_factory.h"
 #include "api/video_codecs/video_encoder_factory_template.h"
 #include "api/video_codecs/video_encoder_factory_template_libaom_av1_adapter.h"
 #include "api/video_codecs/video_encoder_factory_template_libvpx_vp8_adapter.h"
 #include "api/video_codecs/video_encoder_factory_template_libvpx_vp9_adapter.h"
 #include "api/video_codecs/video_encoder_factory_template_open_h264_adapter.h"
+#include "rtc_base/checks.h"
 #include "rtc_base/logging.h"
+#include "rtc_base/ref_counted_object.h"
 #include "rtc_base/thread.h"
 
 namespace {
diff --git a/rtc_tools/data_channel_benchmark/peer_connection_client.h b/rtc_tools/data_channel_benchmark/peer_connection_client.h
index 62b205c..c1842ef5 100644
--- a/rtc_tools/data_channel_benchmark/peer_connection_client.h
+++ b/rtc_tools/data_channel_benchmark/peer_connection_client.h
@@ -12,10 +12,12 @@
 
 #include <stdint.h>
 
+#include <functional>
 #include <memory>
 #include <string>
 #include <vector>
 
+#include "api/data_channel_interface.h"
 #include "api/jsep.h"
 #include "api/peer_connection_interface.h"
 #include "api/rtp_receiver_interface.h"
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index e7ec3e3..380d2dc 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -1074,6 +1074,7 @@
         "../api/rtc_event_log:rtc_event_log_factory",
         "../api/task_queue:default_task_queue_factory",
         "../api/transport:field_trial_based_config",
+        "../api/transport:network_control",
         "../api/transport/rtp:rtp_source",
         "../api/video:video_frame",
         "../api/video:video_rtp_headers",
@@ -1102,7 +1103,10 @@
       ]
 
       if (is_ios) {
-        deps += [ ":native_api_audio_device_module" ]
+        deps += [
+          ":native_api_audio_device_module",
+          "../api/transport:network_control",
+        ]
       }
     }
 
diff --git a/sdk/objc/api/peerconnection/RTCPeerConnectionFactory+Native.h b/sdk/objc/api/peerconnection/RTCPeerConnectionFactory+Native.h
index f361b9f..52b99ff 100644
--- a/sdk/objc/api/peerconnection/RTCPeerConnectionFactory+Native.h
+++ b/sdk/objc/api/peerconnection/RTCPeerConnectionFactory+Native.h
@@ -10,17 +10,17 @@
 
 #import "RTCPeerConnectionFactory.h"
 
+#include "api/audio/audio_device.h"
+#include "api/audio/audio_processing.h"
+#include "api/audio_codecs/audio_decoder_factory.h"
+#include "api/audio_codecs/audio_encoder_factory.h"
 #include "api/scoped_refptr.h"
+#include "api/transport/network_control.h"
+#include "api/video_codecs/video_decoder_factory.h"
+#include "api/video_codecs/video_encoder_factory.h"
 
 namespace webrtc {
 
-class AudioDeviceModule;
-class AudioEncoderFactory;
-class AudioDecoderFactory;
-class NetworkControllerFactoryInterface;
-class VideoEncoderFactory;
-class VideoDecoderFactory;
-class AudioProcessing;
 struct PeerConnectionDependencies;
 
 }  // namespace webrtc
diff --git a/sdk/objc/api/peerconnection/RTCPeerConnectionFactoryBuilder.h b/sdk/objc/api/peerconnection/RTCPeerConnectionFactoryBuilder.h
index f0b0de1..64c2be3 100644
--- a/sdk/objc/api/peerconnection/RTCPeerConnectionFactoryBuilder.h
+++ b/sdk/objc/api/peerconnection/RTCPeerConnectionFactoryBuilder.h
@@ -10,18 +10,13 @@
 
 #import "RTCPeerConnectionFactory.h"
 
+#include "api/audio/audio_device.h"
+#include "api/audio/audio_processing.h"
+#include "api/audio_codecs/audio_decoder_factory.h"
+#include "api/audio_codecs/audio_encoder_factory.h"
 #include "api/scoped_refptr.h"
-
-namespace webrtc {
-
-class AudioDeviceModule;
-class AudioEncoderFactory;
-class AudioDecoderFactory;
-class VideoEncoderFactory;
-class VideoDecoderFactory;
-class AudioProcessing;
-
-}  // namespace webrtc
+#include "api/video_codecs/video_decoder_factory.h"
+#include "api/video_codecs/video_encoder_factory.h"
 
 NS_ASSUME_NONNULL_BEGIN
 
diff --git a/test/pc/e2e/BUILD.gn b/test/pc/e2e/BUILD.gn
index 10a9606..62c720b 100644
--- a/test/pc/e2e/BUILD.gn
+++ b/test/pc/e2e/BUILD.gn
@@ -164,12 +164,18 @@
       ]
       deps = [
         "../..:fileutils",
+        "../../../api:array_view",
         "../../../api:peer_network_dependencies",
+        "../../../api:rtp_parameters",
         "../../../api/test/pclf:media_configuration",
         "../../../api/test/pclf:media_quality_test_params",
         "../../../api/test/pclf:peer_configurer",
+        "../../../api/video_codecs:scalability_mode",
+        "../../../media:media_constants",
         "../../../modules/video_coding/svc:scalability_mode_util",
         "../../../modules/video_coding/svc:scalability_structures",
+        "../../../modules/video_coding/svc:scalable_video_controller",
+        "../../../rtc_base:checks",
         "../../../rtc_base:macromagic",
         "//third_party/abseil-cpp/absl/strings:string_view",
       ]
diff --git a/test/pc/e2e/peer_params_preprocessor.cc b/test/pc/e2e/peer_params_preprocessor.cc
index fa3351a..3647c01 100644
--- a/test/pc/e2e/peer_params_preprocessor.cc
+++ b/test/pc/e2e/peer_params_preprocessor.cc
@@ -10,17 +10,26 @@
 
 #include "test/pc/e2e/peer_params_preprocessor.h"
 
+#include <stddef.h>
+
+#include <optional>
 #include <set>
 #include <string>
+#include <utility>
+#include <vector>
 
 #include "absl/strings/string_view.h"
+#include "api/array_view.h"
+#include "api/rtp_parameters.h"
 #include "api/test/pclf/media_configuration.h"
 #include "api/test/pclf/media_quality_test_params.h"
 #include "api/test/pclf/peer_configurer.h"
-#include "api/test/peer_network_dependencies.h"
+#include "api/video_codecs/scalability_mode.h"
+#include "media/base/media_constants.h"
 #include "modules/video_coding/svc/create_scalability_structure.h"
 #include "modules/video_coding/svc/scalability_mode_util.h"
-#include "rtc_base/arraysize.h"
+#include "modules/video_coding/svc/scalable_video_controller.h"
+#include "rtc_base/checks.h"
 #include "test/testsupport/file_utils.h"
 
 namespace webrtc {