Replace ArrayView with std::span in logging/

Search&Replace MakeArrayView and ArrayView with std::span
Search&Replace include "api/array_view.h" with include <span>
Remove build dependencies on array_view target

Bug: webrtc:439801349
Change-Id: I9bdaea50fd34abff83cc7571a7fadc55a940df1d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/455500
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Auto-Submit: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#47112}
diff --git a/logging/BUILD.gn b/logging/BUILD.gn
index 9f5b865..4091433 100644
--- a/logging/BUILD.gn
+++ b/logging/BUILD.gn
@@ -58,7 +58,6 @@
   deps = [
     ":rtc_event_log_parse_status",
     ":rtc_event_number_encodings",
-    "../api:array_view",
     "../api/rtc_event_log",
     "../api/units:timestamp",
     "../rtc_base:bitstream_reader",
@@ -92,7 +91,6 @@
   deps = [
     ":rtc_event_field",
     ":rtc_event_log_parse_status",
-    "../api:array_view",
     "../api/rtc_event_log",
     "../api/units:timestamp",
     "//third_party/abseil-cpp/absl/memory",
@@ -119,7 +117,6 @@
     ":rtc_event_field",
     ":rtc_event_log_parse_status",
     ":rtc_stream_config",
-    "../api:array_view",
     "../api/rtc_event_log",
     "../api/units:timestamp",
     "../modules/audio_coding:audio_network_adaptor_config",
@@ -140,7 +137,6 @@
   deps = [
     ":rtc_event_field",
     ":rtc_event_log_parse_status",
-    "../api:array_view",
     "../api/rtc_event_log",
     "../api/units:timestamp",
     "//third_party/abseil-cpp/absl/strings:string_view",
@@ -168,7 +164,6 @@
   deps = [
     ":rtc_event_field",
     ":rtc_event_log_parse_status",
-    "../api:array_view",
     "../api/rtc_event_log",
     "../api/transport:bandwidth_usage",
     "../api/units:data_rate",
@@ -188,7 +183,6 @@
 
   deps = [
     ":rtc_event_log_parse_status",
-    "../api:array_view",
     "../api/rtc_event_log",
     "../api/units:data_rate",
     "../api/units:data_size",
@@ -209,7 +203,6 @@
   deps = [
     ":rtc_event_field",
     ":rtc_event_log_parse_status",
-    "../api:array_view",
     "../api/rtc_event_log",
     "../api/units:timestamp",
     "../api/video:video_frame",
@@ -236,7 +229,6 @@
   deps = [
     ":rtc_event_field",
     ":rtc_event_log_parse_status",
-    "../api:array_view",
     "../api:rtp_headers",
     "../api/rtc_event_log",
     "../api/units:timestamp",
@@ -261,7 +253,6 @@
     ":rtc_event_field",
     ":rtc_event_log_parse_status",
     ":rtc_stream_config",
-    "../api:array_view",
     "../api/rtc_event_log",
     "../api/units:timestamp",
     "../rtc_base:checks",
@@ -373,7 +364,6 @@
       ":rtc_event_rtp_rtcp",
       ":rtc_event_video",
       ":rtc_stream_config",
-      "../api:array_view",
       "../api:candidate",
       "../api:dtls_transport_interface",
       "../api/rtc_event_log",
@@ -407,7 +397,6 @@
       ":rtc_event_log_optional_blob_encoding",
       ":rtc_event_log_parse_status",
       ":rtc_event_log_proto",  # Why does this need to be included here?
-      "../api:array_view",
       "../rtc_base:bitstream_reader",
       "../rtc_base:checks",
       "../rtc_base:logging",
@@ -598,7 +587,6 @@
         ":rtc_event_rtp_rtcp",
         ":rtc_event_video",
         ":rtc_stream_config",
-        "../api:array_view",
         "../api:candidate",
         "../api:dtls_transport_interface",
         "../api:field_trials",
@@ -650,7 +638,6 @@
         deps = [
           ":rtc_event_log_parser",
           ":rtc_event_rtp_rtcp",
-          "../api:array_view",
           "../api:rtp_headers",
           "../api/rtc_event_log",
           "../modules/rtp_rtcp",
@@ -688,7 +675,6 @@
   deps = [
     ":rtc_event_field",
     ":rtc_event_log_parse_status",
-    "../api:array_view",
     "../api:candidate",
     "../api:dtls_transport_interface",
     "../api:libjingle_logging_api",
diff --git a/logging/rtc_event_log/dependency_descriptor_encoder_decoder.cc b/logging/rtc_event_log/dependency_descriptor_encoder_decoder.cc
index ca947dd..9955247 100644
--- a/logging/rtc_event_log/dependency_descriptor_encoder_decoder.cc
+++ b/logging/rtc_event_log/dependency_descriptor_encoder_decoder.cc
@@ -13,11 +13,11 @@
 #include <cstddef>
 #include <cstdint>
 #include <optional>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "logging/rtc_event_log/encoder/delta_encoding.h"
 #include "logging/rtc_event_log/encoder/optional_blob_encoding.h"
 #include "logging/rtc_event_log/events/rtc_event_log_parse_status.h"
@@ -30,7 +30,7 @@
 // static
 std::optional<rtclog2::DependencyDescriptorsWireInfo>
 RtcEventLogDependencyDescriptorEncoderDecoder::Encode(
-    const std::vector<ArrayView<const uint8_t>>& raw_dd_data) {
+    const std::vector<std::span<const uint8_t>>& raw_dd_data) {
   if (raw_dd_data.empty()) {
     return {};
   }
@@ -43,9 +43,8 @@
   }
 
   rtclog2::DependencyDescriptorsWireInfo res;
-  const ArrayView<const uint8_t>& base_dd = raw_dd_data[0];
-  auto delta_dds =
-      MakeArrayView(raw_dd_data.data(), raw_dd_data.size()).subspan(1);
+  const std::span<const uint8_t>& base_dd = raw_dd_data[0];
+  auto delta_dds = std::span(raw_dd_data.data(), raw_dd_data.size()).subspan(1);
 
   // Start and end bit.
   {
diff --git a/logging/rtc_event_log/dependency_descriptor_encoder_decoder.h b/logging/rtc_event_log/dependency_descriptor_encoder_decoder.h
index 80f35f2..d0867e9 100644
--- a/logging/rtc_event_log/dependency_descriptor_encoder_decoder.h
+++ b/logging/rtc_event_log/dependency_descriptor_encoder_decoder.h
@@ -14,9 +14,9 @@
 #include <cstddef>
 #include <cstdint>
 #include <optional>
+#include <span>
 #include <vector>
 
-#include "api/array_view.h"
 #include "logging/rtc_event_log/events/rtc_event_log_parse_status.h"
 #include "logging/rtc_event_log/rtc_event_log2_proto_include.h"  // IWYU pragma: keep
 
@@ -25,7 +25,7 @@
 class RtcEventLogDependencyDescriptorEncoderDecoder {
  public:
   static std::optional<rtclog2::DependencyDescriptorsWireInfo> Encode(
-      const std::vector<ArrayView<const uint8_t>>& raw_dd_data);
+      const std::vector<std::span<const uint8_t>>& raw_dd_data);
   static RtcEventLogParseStatusOr<std::vector<std::vector<uint8_t>>> Decode(
       const rtclog2::DependencyDescriptorsWireInfo& dd_wire_info,
       size_t num_packets);
diff --git a/logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.cc b/logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.cc
index 5434a40..c225616 100644
--- a/logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.cc
+++ b/logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.cc
@@ -15,10 +15,10 @@
 #include <deque>
 #include <memory>
 #include <optional>
+#include <span>
 #include <string>
 #include <vector>
 
-#include "api/array_view.h"
 #include "api/candidate.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "api/rtp_headers.h"
@@ -753,7 +753,7 @@
 
 std::string RtcEventLogEncoderLegacy::EncodeRtpPacket(
     int64_t timestamp_us,
-    ArrayView<const uint8_t> header,
+    std::span<const uint8_t> header,
     size_t packet_length,
     int probe_cluster_id,
     bool is_incoming) {
diff --git a/logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.h b/logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.h
index c03d3db..98252cc 100644
--- a/logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.h
+++ b/logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.h
@@ -15,9 +15,9 @@
 #include <cstdint>
 #include <deque>
 #include <memory>
+#include <span>
 #include <string>
 
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "logging/rtc_event_log/encoder/rtc_event_log_encoder.h"
 #include "rtc_base/buffer.h"
@@ -100,7 +100,7 @@
                                const Buffer& packet,
                                bool is_incoming);
   std::string EncodeRtpPacket(int64_t timestamp_us,
-                              ArrayView<const uint8_t> header,
+                              std::span<const uint8_t> header,
                               size_t packet_length,
                               int probe_cluster_id,
                               bool is_incoming);
diff --git a/logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.cc b/logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.cc
index 47396b7..5d1342e 100644
--- a/logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.cc
+++ b/logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.cc
@@ -17,11 +17,11 @@
 #include <map>
 #include <memory>
 #include <optional>
+#include <span>
 #include <string>
 #include <type_traits>
 #include <vector>
 
-#include "api/array_view.h"
 #include "api/candidate.h"
 #include "api/dtls_transport_interface.h"
 #include "api/field_trials_view.h"
@@ -340,7 +340,7 @@
 }
 
 template <typename EventType, typename ProtoType>
-void EncodeRtcpPacket(ArrayView<const EventType*> batch,
+void EncodeRtcpPacket(std::span<const EventType*> batch,
                       ProtoType* proto_batch) {
   if (batch.empty()) {
     return;
@@ -468,7 +468,7 @@
     // TODO(webrtc:14975) Remove this kill switch after DD in RTC event log has
     //                    been rolled out.
     if (encode_dependency_descriptor_) {
-      std::vector<ArrayView<const uint8_t>> raw_dds(batch.size());
+      std::vector<std::span<const uint8_t>> raw_dds(batch.size());
       bool has_dd = false;
       for (size_t i = 0; i < batch.size(); ++i) {
         raw_dds[i] =
@@ -973,7 +973,7 @@
 }
 
 void RtcEventLogEncoderNewFormat::EncodeAlrState(
-    ArrayView<const RtcEventAlrState*> batch,
+    std::span<const RtcEventAlrState*> batch,
     rtclog2::EventStream* event_stream) {
   for (const RtcEventAlrState* base_event : batch) {
     rtclog2::AlrState* proto_batch = event_stream->add_alr_states();
@@ -984,7 +984,7 @@
 }
 
 void RtcEventLogEncoderNewFormat::EncodeAudioNetworkAdaptation(
-    ArrayView<const RtcEventAudioNetworkAdaptation*> batch,
+    std::span<const RtcEventAudioNetworkAdaptation*> batch,
     rtclog2::EventStream* event_stream) {
   if (batch.empty())
     return;
@@ -1135,7 +1135,7 @@
 }
 
 void RtcEventLogEncoderNewFormat::EncodeAudioPlayout(
-    ArrayView<const RtcEventAudioPlayout*> batch,
+    std::span<const RtcEventAudioPlayout*> batch,
     rtclog2::EventStream* event_stream) {
   if (batch.empty())
     return;
@@ -1177,7 +1177,7 @@
 }
 
 void RtcEventLogEncoderNewFormat::EncodeNetEqSetMinimumDelay(
-    ArrayView<const RtcEventNetEqSetMinimumDelay*> batch,
+    std::span<const RtcEventNetEqSetMinimumDelay*> batch,
     rtclog2::EventStream* event_stream) {
   if (encode_neteq_set_minimum_delay_kill_switch_) {
     return;
@@ -1235,7 +1235,7 @@
 }
 
 void RtcEventLogEncoderNewFormat::EncodeAudioRecvStreamConfig(
-    ArrayView<const RtcEventAudioReceiveStreamConfig*> batch,
+    std::span<const RtcEventAudioReceiveStreamConfig*> batch,
     rtclog2::EventStream* event_stream) {
   for (const RtcEventAudioReceiveStreamConfig* base_event : batch) {
     rtclog2::AudioRecvStreamConfig* proto_batch =
@@ -1254,7 +1254,7 @@
 }
 
 void RtcEventLogEncoderNewFormat::EncodeAudioSendStreamConfig(
-    ArrayView<const RtcEventAudioSendStreamConfig*> batch,
+    std::span<const RtcEventAudioSendStreamConfig*> batch,
     rtclog2::EventStream* event_stream) {
   for (const RtcEventAudioSendStreamConfig* base_event : batch) {
     rtclog2::AudioSendStreamConfig* proto_batch =
@@ -1272,7 +1272,7 @@
 }
 
 void RtcEventLogEncoderNewFormat::EncodeBweUpdateDelayBased(
-    ArrayView<const RtcEventBweUpdateDelayBased*> batch,
+    std::span<const RtcEventBweUpdateDelayBased*> batch,
     rtclog2::EventStream* event_stream) {
   if (batch.empty())
     return;
@@ -1329,7 +1329,7 @@
 }
 
 void RtcEventLogEncoderNewFormat::EncodeBweUpdateLossBased(
-    ArrayView<const RtcEventBweUpdateLossBased*> batch,
+    std::span<const RtcEventBweUpdateLossBased*> batch,
     rtclog2::EventStream* event_stream) {
   if (batch.empty())
     return;
@@ -1393,7 +1393,7 @@
 }
 
 void RtcEventLogEncoderNewFormat::EncodeBweUpdateScream(
-    ArrayView<const RtcEventBweUpdateScream*> batch,
+    std::span<const RtcEventBweUpdateScream*> batch,
     rtclog2::EventStream* event_stream) {
   if (batch.empty())
     return;
@@ -1490,7 +1490,7 @@
 }
 
 void RtcEventLogEncoderNewFormat::EncodeDtlsTransportState(
-    ArrayView<const RtcEventDtlsTransportState*> batch,
+    std::span<const RtcEventDtlsTransportState*> batch,
     rtclog2::EventStream* event_stream) {
   for (const RtcEventDtlsTransportState* base_event : batch) {
     rtclog2::DtlsTransportStateEvent* proto_batch =
@@ -1502,7 +1502,7 @@
 }
 
 void RtcEventLogEncoderNewFormat::EncodeDtlsWritableState(
-    ArrayView<const RtcEventDtlsWritableState*> batch,
+    std::span<const RtcEventDtlsWritableState*> batch,
     rtclog2::EventStream* event_stream) {
   for (const RtcEventDtlsWritableState* base_event : batch) {
     rtclog2::DtlsWritableState* proto_batch =
@@ -1513,7 +1513,7 @@
 }
 
 void RtcEventLogEncoderNewFormat::EncodeProbeClusterCreated(
-    ArrayView<const RtcEventProbeClusterCreated*> batch,
+    std::span<const RtcEventProbeClusterCreated*> batch,
     rtclog2::EventStream* event_stream) {
   for (const RtcEventProbeClusterCreated* base_event : batch) {
     rtclog2::BweProbeCluster* proto_batch = event_stream->add_probe_clusters();
@@ -1526,7 +1526,7 @@
 }
 
 void RtcEventLogEncoderNewFormat::EncodeProbeResultFailure(
-    ArrayView<const RtcEventProbeResultFailure*> batch,
+    std::span<const RtcEventProbeResultFailure*> batch,
     rtclog2::EventStream* event_stream) {
   for (const RtcEventProbeResultFailure* base_event : batch) {
     rtclog2::BweProbeResultFailure* proto_batch =
@@ -1540,7 +1540,7 @@
 }
 
 void RtcEventLogEncoderNewFormat::EncodeProbeResultSuccess(
-    ArrayView<const RtcEventProbeResultSuccess*> batch,
+    std::span<const RtcEventProbeResultSuccess*> batch,
     rtclog2::EventStream* event_stream) {
   for (const RtcEventProbeResultSuccess* base_event : batch) {
     rtclog2::BweProbeResultSuccess* proto_batch =
@@ -1553,7 +1553,7 @@
 }
 
 void RtcEventLogEncoderNewFormat::EncodeRouteChange(
-    ArrayView<const RtcEventRouteChange*> batch,
+    std::span<const RtcEventRouteChange*> batch,
     rtclog2::EventStream* event_stream) {
   for (const RtcEventRouteChange* base_event : batch) {
     rtclog2::RouteChange* proto_batch = event_stream->add_route_changes();
@@ -1565,7 +1565,7 @@
 }
 
 void RtcEventLogEncoderNewFormat::EncodeRemoteEstimate(
-    ArrayView<const RtcEventRemoteEstimate*> batch,
+    std::span<const RtcEventRemoteEstimate*> batch,
     rtclog2::EventStream* event_stream) {
   if (batch.empty())
     return;
@@ -1637,7 +1637,7 @@
 }
 
 void RtcEventLogEncoderNewFormat::EncodeRtcpPacketIncoming(
-    ArrayView<const RtcEventRtcpPacketIncoming*> batch,
+    std::span<const RtcEventRtcpPacketIncoming*> batch,
     rtclog2::EventStream* event_stream) {
   if (batch.empty()) {
     return;
@@ -1646,7 +1646,7 @@
 }
 
 void RtcEventLogEncoderNewFormat::EncodeRtcpPacketOutgoing(
-    ArrayView<const RtcEventRtcpPacketOutgoing*> batch,
+    std::span<const RtcEventRtcpPacketOutgoing*> batch,
     rtclog2::EventStream* event_stream) {
   if (batch.empty()) {
     return;
@@ -1665,7 +1665,7 @@
 }
 
 void RtcEventLogEncoderNewFormat::EncodeFramesDecoded(
-    ArrayView<const RtcEventFrameDecoded* const> batch,
+    std::span<const RtcEventFrameDecoded* const> batch,
     rtclog2::EventStream* event_stream) {
   if (batch.empty()) {
     return;
@@ -1774,7 +1774,7 @@
 }
 
 void RtcEventLogEncoderNewFormat::EncodeVideoRecvStreamConfig(
-    ArrayView<const RtcEventVideoReceiveStreamConfig*> batch,
+    std::span<const RtcEventVideoReceiveStreamConfig*> batch,
     rtclog2::EventStream* event_stream) {
   for (const RtcEventVideoReceiveStreamConfig* base_event : batch) {
     rtclog2::VideoRecvStreamConfig* proto_batch =
@@ -1794,7 +1794,7 @@
 }
 
 void RtcEventLogEncoderNewFormat::EncodeVideoSendStreamConfig(
-    ArrayView<const RtcEventVideoSendStreamConfig*> batch,
+    std::span<const RtcEventVideoSendStreamConfig*> batch,
     rtclog2::EventStream* event_stream) {
   for (const RtcEventVideoSendStreamConfig* base_event : batch) {
     rtclog2::VideoSendStreamConfig* proto_batch =
@@ -1813,7 +1813,7 @@
 }
 
 void RtcEventLogEncoderNewFormat::EncodeIceCandidatePairConfig(
-    ArrayView<const RtcEventIceCandidatePairConfig*> batch,
+    std::span<const RtcEventIceCandidatePairConfig*> batch,
     rtclog2::EventStream* event_stream) {
   for (const RtcEventIceCandidatePairConfig* base_event : batch) {
     rtclog2::IceCandidatePairConfig* proto_batch =
@@ -1842,7 +1842,7 @@
 }
 
 void RtcEventLogEncoderNewFormat::EncodeIceCandidatePairEvent(
-    ArrayView<const RtcEventIceCandidatePair*> batch,
+    std::span<const RtcEventIceCandidatePair*> batch,
     rtclog2::EventStream* event_stream) {
   for (const RtcEventIceCandidatePair* base_event : batch) {
     rtclog2::IceCandidatePairEvent* proto_batch =
diff --git a/logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.h b/logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.h
index 57e6f8d..099c5df 100644
--- a/logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.h
+++ b/logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.h
@@ -15,10 +15,10 @@
 #include <deque>
 #include <map>
 #include <memory>
+#include <span>
 #include <string>
 #include <vector>
 
-#include "api/array_view.h"
 #include "api/field_trials_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "logging/rtc_event_log/encoder/rtc_event_log_encoder.h"
@@ -73,66 +73,66 @@
 
  private:
   // Encoding entry-point for the various RtcEvent subclasses.
-  void EncodeAlrState(ArrayView<const RtcEventAlrState*> batch,
+  void EncodeAlrState(std::span<const RtcEventAlrState*> batch,
                       rtclog2::EventStream* event_stream);
   void EncodeAudioNetworkAdaptation(
-      ArrayView<const RtcEventAudioNetworkAdaptation*> batch,
+      std::span<const RtcEventAudioNetworkAdaptation*> batch,
       rtclog2::EventStream* event_stream);
-  void EncodeAudioPlayout(ArrayView<const RtcEventAudioPlayout*> batch,
+  void EncodeAudioPlayout(std::span<const RtcEventAudioPlayout*> batch,
                           rtclog2::EventStream* event_stream);
   void EncodeAudioRecvStreamConfig(
-      ArrayView<const RtcEventAudioReceiveStreamConfig*> batch,
+      std::span<const RtcEventAudioReceiveStreamConfig*> batch,
       rtclog2::EventStream* event_stream);
   void EncodeAudioSendStreamConfig(
-      ArrayView<const RtcEventAudioSendStreamConfig*> batch,
+      std::span<const RtcEventAudioSendStreamConfig*> batch,
       rtclog2::EventStream* event_stream);
   void EncodeBweUpdateDelayBased(
-      ArrayView<const RtcEventBweUpdateDelayBased*> batch,
+      std::span<const RtcEventBweUpdateDelayBased*> batch,
       rtclog2::EventStream* event_stream);
   void EncodeBweUpdateLossBased(
-      ArrayView<const RtcEventBweUpdateLossBased*> batch,
+      std::span<const RtcEventBweUpdateLossBased*> batch,
       rtclog2::EventStream* event_stream);
-  void EncodeBweUpdateScream(ArrayView<const RtcEventBweUpdateScream*> batch,
+  void EncodeBweUpdateScream(std::span<const RtcEventBweUpdateScream*> batch,
                              rtclog2::EventStream* event_stream);
   void EncodeDtlsTransportState(
-      ArrayView<const RtcEventDtlsTransportState*> batch,
+      std::span<const RtcEventDtlsTransportState*> batch,
       rtclog2::EventStream* event_stream);
   void EncodeDtlsWritableState(
-      ArrayView<const RtcEventDtlsWritableState*> batch,
+      std::span<const RtcEventDtlsWritableState*> batch,
       rtclog2::EventStream* event_stream);
-  void EncodeFramesDecoded(ArrayView<const RtcEventFrameDecoded* const> batch,
+  void EncodeFramesDecoded(std::span<const RtcEventFrameDecoded* const> batch,
                            rtclog2::EventStream* event_stream);
   void EncodeIceCandidatePairConfig(
-      ArrayView<const RtcEventIceCandidatePairConfig*> batch,
+      std::span<const RtcEventIceCandidatePairConfig*> batch,
       rtclog2::EventStream* event_stream);
   void EncodeIceCandidatePairEvent(
-      ArrayView<const RtcEventIceCandidatePair*> batch,
+      std::span<const RtcEventIceCandidatePair*> batch,
       rtclog2::EventStream* event_stream);
-  void EncodeLoggingStarted(ArrayView<const RtcEventLoggingStarted*> batch,
+  void EncodeLoggingStarted(std::span<const RtcEventLoggingStarted*> batch,
                             rtclog2::EventStream* event_stream);
-  void EncodeLoggingStopped(ArrayView<const RtcEventLoggingStopped*> batch,
+  void EncodeLoggingStopped(std::span<const RtcEventLoggingStopped*> batch,
                             rtclog2::EventStream* event_stream);
   void EncodeNetEqSetMinimumDelay(
-      ArrayView<const RtcEventNetEqSetMinimumDelay*> batch,
+      std::span<const RtcEventNetEqSetMinimumDelay*> batch,
       rtclog2::EventStream* event_stream);
   void EncodeProbeClusterCreated(
-      ArrayView<const RtcEventProbeClusterCreated*> batch,
+      std::span<const RtcEventProbeClusterCreated*> batch,
       rtclog2::EventStream* event_stream);
   void EncodeProbeResultFailure(
-      ArrayView<const RtcEventProbeResultFailure*> batch,
+      std::span<const RtcEventProbeResultFailure*> batch,
       rtclog2::EventStream* event_stream);
   void EncodeProbeResultSuccess(
-      ArrayView<const RtcEventProbeResultSuccess*> batch,
+      std::span<const RtcEventProbeResultSuccess*> batch,
       rtclog2::EventStream* event_stream);
-  void EncodeRouteChange(ArrayView<const RtcEventRouteChange*> batch,
+  void EncodeRouteChange(std::span<const RtcEventRouteChange*> batch,
                          rtclog2::EventStream* event_stream);
-  void EncodeRemoteEstimate(ArrayView<const RtcEventRemoteEstimate*> batch,
+  void EncodeRemoteEstimate(std::span<const RtcEventRemoteEstimate*> batch,
                             rtclog2::EventStream* event_stream);
   void EncodeRtcpPacketIncoming(
-      ArrayView<const RtcEventRtcpPacketIncoming*> batch,
+      std::span<const RtcEventRtcpPacketIncoming*> batch,
       rtclog2::EventStream* event_stream);
   void EncodeRtcpPacketOutgoing(
-      ArrayView<const RtcEventRtcpPacketOutgoing*> batch,
+      std::span<const RtcEventRtcpPacketOutgoing*> batch,
       rtclog2::EventStream* event_stream);
   void EncodeRtpPacketIncoming(
       const std::map<uint32_t, std::vector<const RtcEventRtpPacketIncoming*>>&
@@ -143,10 +143,10 @@
           batch,
       rtclog2::EventStream* event_stream);
   void EncodeVideoRecvStreamConfig(
-      ArrayView<const RtcEventVideoReceiveStreamConfig*> batch,
+      std::span<const RtcEventVideoReceiveStreamConfig*> batch,
       rtclog2::EventStream* event_stream);
   void EncodeVideoSendStreamConfig(
-      ArrayView<const RtcEventVideoSendStreamConfig*> batch,
+      std::span<const RtcEventVideoSendStreamConfig*> batch,
       rtclog2::EventStream* event_stream);
   template <typename Batch, typename ProtoType>
   void EncodeRtpPacket(const Batch& batch, ProtoType* proto_batch);
diff --git a/logging/rtc_event_log/encoder/rtc_event_log_encoder_v3.h b/logging/rtc_event_log/encoder/rtc_event_log_encoder_v3.h
index d5d2b6e..c77c65a 100644
--- a/logging/rtc_event_log/encoder/rtc_event_log_encoder_v3.h
+++ b/logging/rtc_event_log/encoder/rtc_event_log_encoder_v3.h
@@ -16,9 +16,9 @@
 #include <functional>
 #include <map>
 #include <memory>
+#include <span>
 #include <string>
 
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "logging/rtc_event_log/encoder/rtc_event_log_encoder.h"
 
@@ -39,7 +39,7 @@
 
  private:
   std::map<RtcEvent::Type,
-           std::function<std::string(webrtc::ArrayView<const RtcEvent*>)>>
+           std::function<std::string(std::span<const RtcEvent*>)>>
       encoders_;
 };
 
diff --git a/logging/rtc_event_log/events/fixed_length_encoding_parameters_v3.cc b/logging/rtc_event_log/events/fixed_length_encoding_parameters_v3.cc
index e2ef9b9..3353077 100644
--- a/logging/rtc_event_log/events/fixed_length_encoding_parameters_v3.cc
+++ b/logging/rtc_event_log/events/fixed_length_encoding_parameters_v3.cc
@@ -13,8 +13,8 @@
 #include <algorithm>
 #include <cstdint>
 #include <optional>
+#include <span>
 
-#include "api/array_view.h"
 #include "logging/rtc_event_log/events/rtc_event_field_extraction.h"
 #include "rtc_base/checks.h"
 #include "rtc_base/logging.h"
@@ -29,7 +29,7 @@
 FixedLengthEncodingParametersV3
 FixedLengthEncodingParametersV3::CalculateParameters(
     uint64_t base,
-    const ArrayView<const uint64_t> values,
+    const std::span<const uint64_t> values,
     uint64_t value_bit_width,
     bool values_optional) {
   // As a special case, if all of the elements are identical to the base
diff --git a/logging/rtc_event_log/events/fixed_length_encoding_parameters_v3.h b/logging/rtc_event_log/events/fixed_length_encoding_parameters_v3.h
index 9e4f529..044e37e 100644
--- a/logging/rtc_event_log/events/fixed_length_encoding_parameters_v3.h
+++ b/logging/rtc_event_log/events/fixed_length_encoding_parameters_v3.h
@@ -13,8 +13,8 @@
 
 #include <cstdint>
 #include <optional>
+#include <span>
 
-#include "api/array_view.h"
 #include "logging/rtc_event_log/events/rtc_event_field_extraction.h"
 
 namespace webrtc {
@@ -34,7 +34,7 @@
 
   static FixedLengthEncodingParametersV3 CalculateParameters(
       uint64_t base,
-      ArrayView<const uint64_t> values,
+      std::span<const uint64_t> values,
       uint64_t value_bit_width,
       bool values_optional);
   static std::optional<FixedLengthEncodingParametersV3> ParseDeltaHeader(
diff --git a/logging/rtc_event_log/events/rtc_event_alr_state.h b/logging/rtc_event_log/events/rtc_event_alr_state.h
index a732187..09fc129 100644
--- a/logging/rtc_event_log/events/rtc_event_alr_state.h
+++ b/logging/rtc_event_log/events/rtc_event_alr_state.h
@@ -13,11 +13,11 @@
 
 #include <cstdint>
 #include <memory>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "api/units/timestamp.h"
 #include "logging/rtc_event_log/events/rtc_event_definition.h"
@@ -53,7 +53,7 @@
 
   bool in_alr() const { return in_alr_; }
 
-  static std::string Encode(ArrayView<const RtcEvent*> batch) {
+  static std::string Encode(std::span<const RtcEvent*> batch) {
     return RtcEventAlrState::definition_.EncodeBatch(batch);
   }
 
diff --git a/logging/rtc_event_log/events/rtc_event_audio_network_adaptation.h b/logging/rtc_event_log/events/rtc_event_audio_network_adaptation.h
index ea78ef4..b0fa86e 100644
--- a/logging/rtc_event_log/events/rtc_event_audio_network_adaptation.h
+++ b/logging/rtc_event_log/events/rtc_event_audio_network_adaptation.h
@@ -15,11 +15,11 @@
 #include <cstdint>
 #include <memory>
 #include <optional>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "api/units/timestamp.h"
 #include "logging/rtc_event_log/events/rtc_event_log_parse_status.h"
@@ -66,7 +66,7 @@
   const std::optional<bool>& enable_dtx() const { return enable_dtx_; }
   const std::optional<size_t>& num_channels() const { return num_channels_; }
 
-  static std::string Encode(ArrayView<const RtcEvent*> /* batch */) {
+  static std::string Encode(std::span<const RtcEvent*> /* batch */) {
     // TODO(terelius): Implement
     return "";
   }
diff --git a/logging/rtc_event_log/events/rtc_event_audio_playout.h b/logging/rtc_event_log/events/rtc_event_audio_playout.h
index d9683ed..e05830d 100644
--- a/logging/rtc_event_log/events/rtc_event_audio_playout.h
+++ b/logging/rtc_event_log/events/rtc_event_audio_playout.h
@@ -15,11 +15,11 @@
 
 #include <map>
 #include <memory>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "api/units/timestamp.h"
 #include "logging/rtc_event_log/events/rtc_event_definition.h"
@@ -55,7 +55,7 @@
 
   uint32_t ssrc() const { return ssrc_; }
 
-  static std::string Encode(ArrayView<const RtcEvent*> batch) {
+  static std::string Encode(std::span<const RtcEvent*> batch) {
     return RtcEventAudioPlayout::definition_.EncodeBatch(batch);
   }
 
diff --git a/logging/rtc_event_log/events/rtc_event_audio_receive_stream_config.h b/logging/rtc_event_log/events/rtc_event_audio_receive_stream_config.h
index 5e74754..965d974 100644
--- a/logging/rtc_event_log/events/rtc_event_audio_receive_stream_config.h
+++ b/logging/rtc_event_log/events/rtc_event_audio_receive_stream_config.h
@@ -13,11 +13,11 @@
 
 #include <cstdint>
 #include <memory>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "api/units/timestamp.h"
 #include "logging/rtc_event_log/events/rtc_event_log_parse_status.h"
@@ -53,7 +53,7 @@
 
   const rtclog::StreamConfig& config() const { return *config_; }
 
-  static std::string Encode(ArrayView<const RtcEvent*> /* batch */) {
+  static std::string Encode(std::span<const RtcEvent*> /* batch */) {
     // TODO(terelius): Implement
     return "";
   }
diff --git a/logging/rtc_event_log/events/rtc_event_audio_send_stream_config.h b/logging/rtc_event_log/events/rtc_event_audio_send_stream_config.h
index 861d067..5978cf2 100644
--- a/logging/rtc_event_log/events/rtc_event_audio_send_stream_config.h
+++ b/logging/rtc_event_log/events/rtc_event_audio_send_stream_config.h
@@ -13,11 +13,11 @@
 
 #include <cstdint>
 #include <memory>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "api/units/timestamp.h"
 #include "logging/rtc_event_log/events/rtc_event_log_parse_status.h"
@@ -53,7 +53,7 @@
 
   const rtclog::StreamConfig& config() const { return *config_; }
 
-  static std::string Encode(ArrayView<const RtcEvent*> /* batch */) {
+  static std::string Encode(std::span<const RtcEvent*> /* batch */) {
     // TODO(terelius): Implement
     return "";
   }
diff --git a/logging/rtc_event_log/events/rtc_event_begin_log.cc b/logging/rtc_event_log/events/rtc_event_begin_log.cc
index acdb0f8..1f3d290 100644
--- a/logging/rtc_event_log/events/rtc_event_begin_log.cc
+++ b/logging/rtc_event_log/events/rtc_event_begin_log.cc
@@ -11,11 +11,11 @@
 #include "logging/rtc_event_log/events/rtc_event_begin_log.h"
 
 #include <cstdint>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "api/units/timestamp.h"
 #include "logging/rtc_event_log/events/rtc_event_field_encoding.h"
@@ -30,7 +30,7 @@
 
 RtcEventBeginLog::~RtcEventBeginLog() = default;
 
-std::string RtcEventBeginLog::Encode(ArrayView<const RtcEvent*> batch) {
+std::string RtcEventBeginLog::Encode(std::span<const RtcEvent*> batch) {
   EventEncoder encoder(event_params_, batch);
 
   encoder.EncodeField(
@@ -49,7 +49,7 @@
   if (!status.ok())
     return status;
 
-  ArrayView<LoggedStartEvent> output_batch =
+  std::span<LoggedStartEvent> output_batch =
       ExtendLoggedBatch(output, parser.NumEventsInBatch());
 
   constexpr FieldParameters timestamp_params{
@@ -57,7 +57,7 @@
       .field_id = FieldParameters::kTimestampField,
       .field_type = FieldType::kVarInt,
       .value_width = 64};
-  RtcEventLogParseStatusOr<ArrayView<uint64_t>> result =
+  RtcEventLogParseStatusOr<std::span<uint64_t>> result =
       parser.ParseNumericField(timestamp_params);
   if (!result.ok())
     return result.status();
diff --git a/logging/rtc_event_log/events/rtc_event_begin_log.h b/logging/rtc_event_log/events/rtc_event_begin_log.h
index 0cbad4c..7136833 100644
--- a/logging/rtc_event_log/events/rtc_event_begin_log.h
+++ b/logging/rtc_event_log/events/rtc_event_begin_log.h
@@ -12,11 +12,11 @@
 #define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_BEGIN_LOG_H_
 
 #include <cstdint>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "api/units/timestamp.h"
 #include "logging/rtc_event_log/events/rtc_event_field_encoding.h"
@@ -53,7 +53,7 @@
   Type GetType() const override { return kType; }
   bool IsConfigEvent() const override { return false; }
 
-  static std::string Encode(ArrayView<const RtcEvent*> batch);
+  static std::string Encode(std::span<const RtcEvent*> batch);
 
   static RtcEventLogParseStatus Parse(absl::string_view encoded_bytes,
                                       bool batched,
diff --git a/logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.h b/logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.h
index 417d248..0fb1041 100644
--- a/logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.h
+++ b/logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.h
@@ -15,11 +15,11 @@
 
 #include <limits>
 #include <memory>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "api/transport/bandwidth_usage.h"
 #include "api/units/timestamp.h"
@@ -104,7 +104,7 @@
   int32_t bitrate_bps() const { return bitrate_bps_; }
   BandwidthUsage detector_state() const { return detector_state_; }
 
-  static std::string Encode(ArrayView<const RtcEvent*> batch) {
+  static std::string Encode(std::span<const RtcEvent*> batch) {
     return RtcEventBweUpdateDelayBased::definition_.EncodeBatch(batch);
   }
 
diff --git a/logging/rtc_event_log/events/rtc_event_bwe_update_loss_based.h b/logging/rtc_event_log/events/rtc_event_bwe_update_loss_based.h
index b854800..9f10f93 100644
--- a/logging/rtc_event_log/events/rtc_event_bwe_update_loss_based.h
+++ b/logging/rtc_event_log/events/rtc_event_bwe_update_loss_based.h
@@ -14,11 +14,11 @@
 #include <stdint.h>
 
 #include <memory>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "api/units/timestamp.h"
 #include "logging/rtc_event_log/events/rtc_event_log_parse_status.h"
@@ -64,7 +64,7 @@
   uint8_t fraction_loss() const { return fraction_loss_; }
   int32_t total_packets() const { return total_packets_; }
 
-  static std::string Encode(ArrayView<const RtcEvent*> /* batch */) {
+  static std::string Encode(std::span<const RtcEvent*> /* batch */) {
     // TODO(terelius): Implement
     return "";
   }
diff --git a/logging/rtc_event_log/events/rtc_event_bwe_update_scream.h b/logging/rtc_event_log/events/rtc_event_bwe_update_scream.h
index 538e797..0580ffa 100644
--- a/logging/rtc_event_log/events/rtc_event_bwe_update_scream.h
+++ b/logging/rtc_event_log/events/rtc_event_bwe_update_scream.h
@@ -14,11 +14,11 @@
 #include <stdint.h>
 
 #include <memory>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "api/units/data_rate.h"
 #include "api/units/data_size.h"
@@ -82,7 +82,7 @@
   uint32_t avg_queue_delay_ms() const { return avg_queue_delay_ms_; }
   uint32_t l4s_marked_permille() const { return l4s_marked_permille_; }
 
-  static std::string Encode(ArrayView<const RtcEvent*> batch) {
+  static std::string Encode(std::span<const RtcEvent*> batch) {
     // TODO(terelius): Implement
     return "";
   }
diff --git a/logging/rtc_event_log/events/rtc_event_definition.h b/logging/rtc_event_log/events/rtc_event_definition.h
index f924c7c..0c221ed 100644
--- a/logging/rtc_event_log/events/rtc_event_definition.h
+++ b/logging/rtc_event_log/events/rtc_event_definition.h
@@ -12,11 +12,11 @@
 #define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_DEFINITION_H_
 
 #include <cstdint>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "logging/rtc_event_log/events/rtc_event_field_encoding.h"
 #include "logging/rtc_event_log/events/rtc_event_field_encoding_parser.h"
@@ -35,8 +35,8 @@
 template <typename EventType, typename LoggedType, typename... Ts>
 class RtcEventDefinitionImpl {
  public:
-  void EncodeImpl(EventEncoder&, ArrayView<const RtcEvent*>) const {}
-  RtcEventLogParseStatus ParseImpl(EventParser&, ArrayView<LoggedType>) const {
+  void EncodeImpl(EventEncoder&, std::span<const RtcEvent*>) const {}
+  RtcEventLogParseStatus ParseImpl(EventParser&, std::span<LoggedType>) const {
     return RtcEventLogParseStatus::Success();
   }
 };
@@ -51,15 +51,15 @@
       : field_(field), rest_(rest...) {}
 
   void EncodeImpl(EventEncoder& encoder,
-                  ArrayView<const RtcEvent*> batch) const {
+                  std::span<const RtcEvent*> batch) const {
     auto values = ExtractRtcEventMember(batch, field_.event_member);
     encoder.EncodeField(field_.params, values);
     rest_.EncodeImpl(encoder, batch);
   }
 
   RtcEventLogParseStatus ParseImpl(EventParser& parser,
-                                   ArrayView<LoggedType> output_batch) const {
-    RtcEventLogParseStatusOr<ArrayView<uint64_t>> result =
+                                   std::span<LoggedType> output_batch) const {
+    RtcEventLogParseStatusOr<std::span<uint64_t>> result =
         parser.ParseNumericField(field_.params);
     if (!result.ok())
       return result.status();
@@ -106,7 +106,7 @@
       RtcEventFieldDefinition<EventType, LoggedType, Ts>... fields)
       : params_(params), fields_(fields...) {}
 
-  std::string EncodeBatch(ArrayView<const RtcEvent*> batch) const {
+  std::string EncodeBatch(std::span<const RtcEvent*> batch) const {
     EventEncoder encoder(params_, batch);
     fields_.EncodeImpl(encoder, batch);
     return encoder.AsString();
@@ -120,7 +120,7 @@
     if (!status.ok())
       return status;
 
-    ArrayView<LoggedType> output_batch =
+    std::span<LoggedType> output_batch =
         ExtendLoggedBatch(output, parser.NumEventsInBatch());
 
     constexpr FieldParameters timestamp_params{
@@ -128,7 +128,7 @@
         .field_id = FieldParameters::kTimestampField,
         .field_type = FieldType::kVarInt,
         .value_width = 64};
-    RtcEventLogParseStatusOr<ArrayView<uint64_t>> result =
+    RtcEventLogParseStatusOr<std::span<uint64_t>> result =
         parser.ParseNumericField(timestamp_params);
     if (!result.ok())
       return result.status();
diff --git a/logging/rtc_event_log/events/rtc_event_dtls_transport_state.h b/logging/rtc_event_log/events/rtc_event_dtls_transport_state.h
index a2ffbcf..aa821e1 100644
--- a/logging/rtc_event_log/events/rtc_event_dtls_transport_state.h
+++ b/logging/rtc_event_log/events/rtc_event_dtls_transport_state.h
@@ -13,11 +13,11 @@
 
 #include <cstdint>
 #include <memory>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/dtls_transport_interface.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "api/units/timestamp.h"
@@ -50,7 +50,7 @@
     return dtls_transport_state_;
   }
 
-  static std::string Encode(ArrayView<const RtcEvent*> /* batch */) {
+  static std::string Encode(std::span<const RtcEvent*> /* batch */) {
     // TODO(terelius): Implement
     return "";
   }
diff --git a/logging/rtc_event_log/events/rtc_event_dtls_writable_state.h b/logging/rtc_event_log/events/rtc_event_dtls_writable_state.h
index f1da19f..4ebf693 100644
--- a/logging/rtc_event_log/events/rtc_event_dtls_writable_state.h
+++ b/logging/rtc_event_log/events/rtc_event_dtls_writable_state.h
@@ -13,11 +13,11 @@
 
 #include <cstdint>
 #include <memory>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "api/units/timestamp.h"
 #include "logging/rtc_event_log/events/rtc_event_log_parse_status.h"
@@ -50,7 +50,7 @@
 
   bool writable() const { return writable_; }
 
-  static std::string Encode(ArrayView<const RtcEvent*> /* batch */) {
+  static std::string Encode(std::span<const RtcEvent*> /* batch */) {
     // TODO(terelius): Implement
     return "";
   }
diff --git a/logging/rtc_event_log/events/rtc_event_end_log.cc b/logging/rtc_event_log/events/rtc_event_end_log.cc
index e5455da..e912e80 100644
--- a/logging/rtc_event_log/events/rtc_event_end_log.cc
+++ b/logging/rtc_event_log/events/rtc_event_end_log.cc
@@ -11,11 +11,11 @@
 #include "logging/rtc_event_log/events/rtc_event_end_log.h"
 
 #include <cstdint>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "api/units/timestamp.h"
 #include "logging/rtc_event_log/events/rtc_event_field_encoding.h"
@@ -29,7 +29,7 @@
 
 RtcEventEndLog::~RtcEventEndLog() = default;
 
-std::string RtcEventEndLog::Encode(ArrayView<const RtcEvent*> batch) {
+std::string RtcEventEndLog::Encode(std::span<const RtcEvent*> batch) {
   EventEncoder encoder(event_params_, batch);
   return encoder.AsString();
 }
@@ -43,7 +43,7 @@
   if (!status.ok())
     return status;
 
-  ArrayView<LoggedStopEvent> output_batch =
+  std::span<LoggedStopEvent> output_batch =
       ExtendLoggedBatch(output, parser.NumEventsInBatch());
 
   constexpr FieldParameters timestamp_params{
@@ -51,7 +51,7 @@
       .field_id = FieldParameters::kTimestampField,
       .field_type = FieldType::kVarInt,
       .value_width = 64};
-  RtcEventLogParseStatusOr<ArrayView<uint64_t>> result =
+  RtcEventLogParseStatusOr<std::span<uint64_t>> result =
       parser.ParseNumericField(timestamp_params);
   if (!result.ok())
     return result.status();
diff --git a/logging/rtc_event_log/events/rtc_event_end_log.h b/logging/rtc_event_log/events/rtc_event_end_log.h
index bb7f7f4..aba1043 100644
--- a/logging/rtc_event_log/events/rtc_event_end_log.h
+++ b/logging/rtc_event_log/events/rtc_event_end_log.h
@@ -12,11 +12,11 @@
 #define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_END_LOG_H_
 
 #include <cstdint>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "api/units/timestamp.h"
 #include "logging/rtc_event_log/events/rtc_event_field_encoding.h"
@@ -46,7 +46,7 @@
   Type GetType() const override { return kType; }
   bool IsConfigEvent() const override { return false; }
 
-  static std::string Encode(ArrayView<const RtcEvent*> batch);
+  static std::string Encode(std::span<const RtcEvent*> batch);
 
   static RtcEventLogParseStatus Parse(absl::string_view encoded_bytes,
                                       bool batched,
diff --git a/logging/rtc_event_log/events/rtc_event_field_encoding.cc b/logging/rtc_event_log/events/rtc_event_field_encoding.cc
index 2fdfe22..b0f6290 100644
--- a/logging/rtc_event_log/events/rtc_event_field_encoding.cc
+++ b/logging/rtc_event_log/events/rtc_event_field_encoding.cc
@@ -14,11 +14,11 @@
 #include <cstdint>
 #include <limits>
 #include <optional>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "logging/rtc_event_log/encoder/bit_writer.h"
 #include "logging/rtc_event_log/encoder/var_int.h"
@@ -107,7 +107,7 @@
 
 std::string EncodeDeltasV3(FixedLengthEncodingParametersV3 params,
                            uint64_t base,
-                           ArrayView<const uint64_t> values) {
+                           std::span<const uint64_t> values) {
   size_t outputbound = (values.size() * params.delta_bit_width() + 7) / 8;
   BitWriter writer(outputbound);
 
@@ -142,7 +142,7 @@
 }
 
 EventEncoder::EventEncoder(EventParameters params,
-                           ArrayView<const RtcEvent*> batch) {
+                           std::span<const RtcEvent*> batch) {
   batch_size_ = batch.size();
   if (!batch.empty()) {
     // Encode event type.
@@ -212,9 +212,9 @@
   const bool values_optional = values.size() != batch_size_;
 
   // Compute delta parameters
-  ArrayView<const uint64_t> all_values(values);
+  std::span<const uint64_t> all_values(values);
   uint64_t base = values[0];
-  ArrayView<const uint64_t> remaining_values = all_values.subspan(1);
+  std::span<const uint64_t> remaining_values = all_values.subspan(1);
 
   FixedLengthEncodingParametersV3 delta_params =
       FixedLengthEncodingParametersV3::CalculateParameters(
diff --git a/logging/rtc_event_log/events/rtc_event_field_encoding.h b/logging/rtc_event_log/events/rtc_event_field_encoding.h
index baa50b2..ba8427a 100644
--- a/logging/rtc_event_log/events/rtc_event_field_encoding.h
+++ b/logging/rtc_event_log/events/rtc_event_field_encoding.h
@@ -14,12 +14,12 @@
 #include <cstddef>
 #include <cstdint>
 #include <optional>
+#include <span>
 #include <string>
 #include <type_traits>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "logging/rtc_event_log/events/fixed_length_encoding_parameters_v3.h"
 #include "logging/rtc_event_log/events/rtc_event_field_extraction.h"
@@ -71,7 +71,7 @@
 // The EventEncoder is used to encode a batch of events.
 class EventEncoder {
  public:
-  EventEncoder(EventParameters params, ArrayView<const RtcEvent*> batch);
+  EventEncoder(EventParameters params, std::span<const RtcEvent*> batch);
 
   void EncodeField(const FieldParameters& params,
                    const std::vector<uint64_t>& values,
@@ -94,7 +94,7 @@
 std::string EncodeSingleValue(uint64_t value, FieldType field_type);
 std::string EncodeDeltasV3(FixedLengthEncodingParametersV3 params,
                            uint64_t base,
-                           ArrayView<const uint64_t> values);
+                           std::span<const uint64_t> values);
 
 // Given a batch of RtcEvents and a member pointer, extract that
 // member from each event in the batch. Signed integer members are
@@ -107,7 +107,7 @@
 template <typename T,
           typename E,
           std::enable_if_t<std::is_integral<T>::value, bool> = true>
-std::vector<uint64_t> ExtractRtcEventMember(ArrayView<const RtcEvent*> batch,
+std::vector<uint64_t> ExtractRtcEventMember(std::span<const RtcEvent*> batch,
                                             const T E::* member) {
   std::vector<uint64_t> values;
   values.reserve(batch.size());
@@ -128,7 +128,7 @@
 template <typename T,
           typename E,
           std::enable_if_t<std::is_integral<T>::value, bool> = true>
-ValuesWithPositions ExtractRtcEventMember(ArrayView<const RtcEvent*> batch,
+ValuesWithPositions ExtractRtcEventMember(std::span<const RtcEvent*> batch,
                                           const std::optional<T> E::* member) {
   ValuesWithPositions result;
   result.position_mask.reserve(batch.size());
@@ -149,7 +149,7 @@
 template <typename T,
           typename E,
           std::enable_if_t<std::is_enum<T>::value, bool> = true>
-std::vector<uint64_t> ExtractRtcEventMember(ArrayView<const RtcEvent*> batch,
+std::vector<uint64_t> ExtractRtcEventMember(std::span<const RtcEvent*> batch,
                                             const T E::* member) {
   std::vector<uint64_t> values;
   values.reserve(batch.size());
@@ -164,7 +164,7 @@
 // Extract a string field from a batch of RtcEvents.
 template <typename E>
 std::vector<absl::string_view> ExtractRtcEventMember(
-    ArrayView<const RtcEvent*> batch,
+    std::span<const RtcEvent*> batch,
     const std::string E::* member) {
   std::vector<absl::string_view> values;
   values.reserve(batch.size());
diff --git a/logging/rtc_event_log/events/rtc_event_field_encoding_parser.cc b/logging/rtc_event_log/events/rtc_event_field_encoding_parser.cc
index 3e04b42..ef97c46 100644
--- a/logging/rtc_event_log/events/rtc_event_field_encoding_parser.cc
+++ b/logging/rtc_event_log/events/rtc_event_field_encoding_parser.cc
@@ -14,10 +14,10 @@
 #include <cstddef>
 #include <cstdint>
 #include <optional>
+#include <span>
 #include <tuple>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "logging/rtc_event_log/encoder/var_int.h"
 #include "logging/rtc_event_log/events/fixed_length_encoding_parameters_v3.h"
 #include "logging/rtc_event_log/events/rtc_event_field_encoding.h"
@@ -355,15 +355,15 @@
   return RtcEventLogParseStatus::Success();
 }
 
-RtcEventLogParseStatusOr<ArrayView<absl::string_view>>
+RtcEventLogParseStatusOr<std::span<absl::string_view>>
 EventParser::ParseStringField(const FieldParameters& params,
                               bool required_field) {
-  using StatusOr = RtcEventLogParseStatusOr<ArrayView<absl::string_view>>;
+  using StatusOr = RtcEventLogParseStatusOr<std::span<absl::string_view>>;
   RTC_DCHECK_EQ(params.field_type, FieldType::kString);
   auto status = ParseField(params);
   if (!status.ok())
     return StatusOr(status);
-  ArrayView<absl::string_view> strings = GetStrings();
+  std::span<absl::string_view> strings = GetStrings();
   if (required_field && strings.size() != NumEventsInBatch()) {
     return StatusOr::Error("Required string field not found", __FILE__,
                            __LINE__);
@@ -371,15 +371,15 @@
   return StatusOr(strings);
 }
 
-RtcEventLogParseStatusOr<ArrayView<uint64_t>> EventParser::ParseNumericField(
+RtcEventLogParseStatusOr<std::span<uint64_t>> EventParser::ParseNumericField(
     const FieldParameters& params,
     bool required_field) {
-  using StatusOr = RtcEventLogParseStatusOr<ArrayView<uint64_t>>;
+  using StatusOr = RtcEventLogParseStatusOr<std::span<uint64_t>>;
   RTC_DCHECK_NE(params.field_type, FieldType::kString);
   auto status = ParseField(params);
   if (!status.ok())
     return StatusOr(status);
-  ArrayView<uint64_t> values = GetValues();
+  std::span<uint64_t> values = GetValues();
   if (required_field && values.size() != NumEventsInBatch()) {
     return StatusOr::Error("Required numerical field not found", __FILE__,
                            __LINE__);
diff --git a/logging/rtc_event_log/events/rtc_event_field_encoding_parser.h b/logging/rtc_event_log/events/rtc_event_field_encoding_parser.h
index 2de5189..93b68cf 100644
--- a/logging/rtc_event_log/events/rtc_event_field_encoding_parser.h
+++ b/logging/rtc_event_log/events/rtc_event_field_encoding_parser.h
@@ -14,13 +14,13 @@
 #include <cstddef>
 #include <cstdint>
 #include <optional>
+#include <span>
 #include <string>
 #include <type_traits>
 #include <vector>
 
 #include "absl/base/attributes.h"
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/units/timestamp.h"
 #include "logging/rtc_event_log/events/fixed_length_encoding_parameters_v3.h"
 #include "logging/rtc_event_log/events/rtc_event_field_encoding.h"
@@ -33,8 +33,8 @@
 class EventParser {
  public:
   struct ValueAndPostionView {
-    ArrayView<uint64_t> values;
-    ArrayView<uint8_t> positions;
+    std::span<uint64_t> values;
+    std::span<uint8_t> positions;
   };
 
   EventParser() = default;
@@ -48,10 +48,10 @@
   // other fields that may occur before it. If 'required_field == true',
   // then failing to find the field is an error, otherwise the functions
   // return success, but with an empty view of values.
-  RtcEventLogParseStatusOr<ArrayView<absl::string_view>> ParseStringField(
+  RtcEventLogParseStatusOr<std::span<absl::string_view>> ParseStringField(
       const FieldParameters& params,
       bool required_field = true);
-  RtcEventLogParseStatusOr<ArrayView<uint64_t>> ParseNumericField(
+  RtcEventLogParseStatusOr<std::span<uint64_t>> ParseNumericField(
       const FieldParameters& params,
       bool required_field = true);
   RtcEventLogParseStatusOr<ValueAndPostionView> ParseOptionalNumericField(
@@ -90,9 +90,9 @@
   void SetError() { error_ = true; }
   bool Ok() const { return !error_; }
 
-  ArrayView<uint64_t> GetValues() { return values_; }
-  ArrayView<uint8_t> GetPositions() { return positions_; }
-  ArrayView<absl::string_view> GetStrings() { return strings_; }
+  std::span<uint64_t> GetValues() { return values_; }
+  std::span<uint8_t> GetPositions() { return positions_; }
+  std::span<absl::string_view> GetStrings() { return strings_; }
 
   void ClearTemporaries() {
     positions_.clear();
@@ -122,9 +122,9 @@
           typename E,
           std::enable_if_t<std::is_integral<T>::value, bool> = true>
 ABSL_MUST_USE_RESULT RtcEventLogParseStatus
-PopulateRtcEventMember(const ArrayView<uint64_t> values,
+PopulateRtcEventMember(const std::span<uint64_t> values,
                        T E::* member,
-                       ArrayView<E> output) {
+                       std::span<E> output) {
   size_t batch_size = values.size();
   RTC_CHECK_EQ(output.size(), batch_size);
   for (size_t i = 0; i < batch_size; ++i) {
@@ -138,10 +138,10 @@
           typename E,
           std::enable_if_t<std::is_integral<T>::value, bool> = true>
 ABSL_MUST_USE_RESULT RtcEventLogParseStatus
-PopulateRtcEventMember(const ArrayView<uint8_t> positions,
-                       const ArrayView<uint64_t> values,
+PopulateRtcEventMember(const std::span<uint8_t> positions,
+                       const std::span<uint64_t> values,
                        std::optional<T> E::* member,
-                       ArrayView<E> output) {
+                       std::span<E> output) {
   size_t batch_size = positions.size();
   RTC_CHECK_EQ(output.size(), batch_size);
   RTC_CHECK_LE(values.size(), batch_size);
@@ -164,9 +164,9 @@
           typename E,
           std::enable_if_t<std::is_enum<T>::value, bool> = true>
 ABSL_MUST_USE_RESULT RtcEventLogParseStatus
-PopulateRtcEventMember(const ArrayView<uint64_t> values,
+PopulateRtcEventMember(const std::span<uint64_t> values,
                        T E::* member,
-                       ArrayView<E> output) {
+                       std::span<E> output) {
   size_t batch_size = values.size();
   RTC_CHECK_EQ(output.size(), batch_size);
   for (size_t i = 0; i < batch_size; ++i) {
@@ -182,9 +182,9 @@
 // Same as above, but for string fields.
 template <typename E>
 ABSL_MUST_USE_RESULT RtcEventLogParseStatus
-PopulateRtcEventMember(const ArrayView<absl::string_view> values,
+PopulateRtcEventMember(const std::span<absl::string_view> values,
                        std::string E::* member,
-                       ArrayView<E> output) {
+                       std::span<E> output) {
   size_t batch_size = values.size();
   RTC_CHECK_EQ(output.size(), batch_size);
   for (size_t i = 0; i < batch_size; ++i) {
@@ -197,9 +197,9 @@
 // N.B. Assumes that the encoded value uses millisecond precision.
 template <typename E>
 ABSL_MUST_USE_RESULT RtcEventLogParseStatus
-PopulateRtcEventTimestamp(const ArrayView<uint64_t>& values,
+PopulateRtcEventTimestamp(const std::span<uint64_t>& values,
                           Timestamp E::* timestamp,
-                          ArrayView<E> output) {
+                          std::span<E> output) {
   size_t batch_size = values.size();
   RTC_CHECK_EQ(batch_size, output.size());
   for (size_t i = 0; i < batch_size; ++i) {
@@ -210,10 +210,10 @@
 }
 
 template <typename E>
-ArrayView<E> ExtendLoggedBatch(std::vector<E>& output, size_t new_elements) {
+std::span<E> ExtendLoggedBatch(std::vector<E>& output, size_t new_elements) {
   size_t old_size = output.size();
   output.resize(old_size + new_elements);
-  ArrayView<E> output_batch = output;
+  std::span<E> output_batch = output;
   output_batch = output_batch.subspan(old_size);
   RTC_DCHECK_EQ(output_batch.size(), new_elements);
   return output_batch;
diff --git a/logging/rtc_event_log/events/rtc_event_field_encoding_unittest.cc b/logging/rtc_event_log/events/rtc_event_field_encoding_unittest.cc
index 218197a..95a7a58 100644
--- a/logging/rtc_event_log/events/rtc_event_field_encoding_unittest.cc
+++ b/logging/rtc_event_log/events/rtc_event_field_encoding_unittest.cc
@@ -14,13 +14,13 @@
 #include <cstdio>
 #include <limits>
 #include <optional>
+#include <span>
 #include <string>
 #include <tuple>
 #include <type_traits>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "logging/rtc_event_log/encoder/var_int.h"
 #include "logging/rtc_event_log/events/rtc_event_field_encoding_parser.h"
@@ -366,8 +366,8 @@
     size_t size_before = parser_.RemainingBytes();
     auto result = parser_.ParseOptionalNumericField(params);
     ASSERT_TRUE(result.ok()) << result.message().c_str();
-    ArrayView<uint64_t> values = result.value().values;
-    ArrayView<uint8_t> positions = result.value().positions;
+    std::span<uint64_t> values = result.value().values;
+    std::span<uint8_t> positions = result.value().positions;
     ASSERT_EQ(positions.size(), expected_values.size());
     auto value_it = values.begin();
     for (size_t i = 0; i < expected_values.size(); i++) {
@@ -396,8 +396,8 @@
     auto result =
         parser_.ParseOptionalNumericField(params, /*required_field=*/false);
     ASSERT_TRUE(result.ok()) << result.message().c_str();
-    ArrayView<uint64_t> values = result.value().values;
-    ArrayView<uint8_t> positions = result.value().positions;
+    std::span<uint64_t> values = result.value().values;
+    std::span<uint8_t> positions = result.value().positions;
     EXPECT_EQ(positions.size(), 0u);
     EXPECT_EQ(values.size(), 0u);
   }
diff --git a/logging/rtc_event_log/events/rtc_event_frame_decoded.h b/logging/rtc_event_log/events/rtc_event_frame_decoded.h
index e726545..c11664b 100644
--- a/logging/rtc_event_log/events/rtc_event_frame_decoded.h
+++ b/logging/rtc_event_log/events/rtc_event_frame_decoded.h
@@ -15,11 +15,11 @@
 
 #include <map>
 #include <memory>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "api/units/timestamp.h"
 #include "api/video/video_codec_type.h"
@@ -65,7 +65,7 @@
   VideoCodecType codec() const { return codec_; }
   uint8_t qp() const { return qp_; }
 
-  static std::string Encode(ArrayView<const RtcEvent*> /* batch */) {
+  static std::string Encode(std::span<const RtcEvent*> /* batch */) {
     // TODO(terelius): Implement
     return "";
   }
diff --git a/logging/rtc_event_log/events/rtc_event_ice_candidate_pair.h b/logging/rtc_event_log/events/rtc_event_ice_candidate_pair.h
index 3029c32..a935a3a 100644
--- a/logging/rtc_event_log/events/rtc_event_ice_candidate_pair.h
+++ b/logging/rtc_event_log/events/rtc_event_ice_candidate_pair.h
@@ -14,11 +14,11 @@
 #include <stdint.h>
 
 #include <memory>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "api/units/timestamp.h"
 #include "logging/rtc_event_log/events/rtc_event_log_parse_status.h"
@@ -73,7 +73,7 @@
   uint32_t candidate_pair_id() const { return candidate_pair_id_; }
   uint32_t transaction_id() const { return transaction_id_; }
 
-  static std::string Encode(ArrayView<const RtcEvent*> /* batch */) {
+  static std::string Encode(std::span<const RtcEvent*> /* batch */) {
     // TODO(terelius): Implement
     return "";
   }
diff --git a/logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.h b/logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.h
index 76bd1f7..097f789 100644
--- a/logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.h
+++ b/logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.h
@@ -14,11 +14,11 @@
 #include <stdint.h>
 
 #include <memory>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/candidate.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "api/units/timestamp.h"
@@ -118,7 +118,7 @@
     return candidate_pair_desc_;
   }
 
-  static std::string Encode(ArrayView<const RtcEvent*> /* batch */) {
+  static std::string Encode(std::span<const RtcEvent*> /* batch */) {
     // TODO(terelius): Implement
     return "";
   }
diff --git a/logging/rtc_event_log/events/rtc_event_probe_cluster_created.h b/logging/rtc_event_log/events/rtc_event_probe_cluster_created.h
index c789257..f777f30 100644
--- a/logging/rtc_event_log/events/rtc_event_probe_cluster_created.h
+++ b/logging/rtc_event_log/events/rtc_event_probe_cluster_created.h
@@ -14,11 +14,11 @@
 #include <stdint.h>
 
 #include <memory>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "api/units/timestamp.h"
 #include "logging/rtc_event_log/events/rtc_event_log_parse_status.h"
@@ -69,7 +69,7 @@
   uint32_t min_probes() const { return min_probes_; }
   uint32_t min_bytes() const { return min_bytes_; }
 
-  static std::string Encode(ArrayView<const RtcEvent*> /* batch */) {
+  static std::string Encode(std::span<const RtcEvent*> /* batch */) {
     // TODO(terelius): Implement
     return "";
   }
diff --git a/logging/rtc_event_log/events/rtc_event_probe_result_failure.h b/logging/rtc_event_log/events/rtc_event_probe_result_failure.h
index 5d90b77..985757b 100644
--- a/logging/rtc_event_log/events/rtc_event_probe_result_failure.h
+++ b/logging/rtc_event_log/events/rtc_event_probe_result_failure.h
@@ -14,11 +14,11 @@
 #include <stdint.h>
 
 #include <memory>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "api/units/timestamp.h"
 #include "logging/rtc_event_log/events/rtc_event_log_parse_status.h"
@@ -63,7 +63,7 @@
   int32_t id() const { return id_; }
   ProbeFailureReason failure_reason() const { return failure_reason_; }
 
-  static std::string Encode(ArrayView<const RtcEvent*> /* batch */) {
+  static std::string Encode(std::span<const RtcEvent*> /* batch */) {
     // TODO(terelius): Implement
     return "";
   }
diff --git a/logging/rtc_event_log/events/rtc_event_probe_result_success.h b/logging/rtc_event_log/events/rtc_event_probe_result_success.h
index 198c606..488cabe 100644
--- a/logging/rtc_event_log/events/rtc_event_probe_result_success.h
+++ b/logging/rtc_event_log/events/rtc_event_probe_result_success.h
@@ -14,11 +14,11 @@
 #include <stdint.h>
 
 #include <memory>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "api/units/timestamp.h"
 #include "logging/rtc_event_log/events/rtc_event_log_parse_status.h"
@@ -56,7 +56,7 @@
   int32_t id() const { return id_; }
   int32_t bitrate_bps() const { return bitrate_bps_; }
 
-  static std::string Encode(ArrayView<const RtcEvent*> /* batch */) {
+  static std::string Encode(std::span<const RtcEvent*> /* batch */) {
     // TODO(terelius): Implement
     return "";
   }
diff --git a/logging/rtc_event_log/events/rtc_event_remote_estimate.h b/logging/rtc_event_log/events/rtc_event_remote_estimate.h
index c1de1c6..fe4a49e 100644
--- a/logging/rtc_event_log/events/rtc_event_remote_estimate.h
+++ b/logging/rtc_event_log/events/rtc_event_remote_estimate.h
@@ -12,11 +12,11 @@
 
 #include <cstdint>
 #include <optional>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "api/units/data_rate.h"
 #include "api/units/timestamp.h"
@@ -48,7 +48,7 @@
   Type GetType() const override { return kType; }
   bool IsConfigEvent() const override { return false; }
 
-  static std::string Encode(ArrayView<const RtcEvent*> /* batch */) {
+  static std::string Encode(std::span<const RtcEvent*> /* batch */) {
     // TODO(terelius): Implement
     return "";
   }
diff --git a/logging/rtc_event_log/events/rtc_event_route_change.h b/logging/rtc_event_log/events/rtc_event_route_change.h
index 6eb8a9c..4827ed4 100644
--- a/logging/rtc_event_log/events/rtc_event_route_change.h
+++ b/logging/rtc_event_log/events/rtc_event_route_change.h
@@ -13,11 +13,11 @@
 
 #include <cstdint>
 #include <memory>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "api/units/timestamp.h"
 #include "logging/rtc_event_log/events/rtc_event_log_parse_status.h"
@@ -53,7 +53,7 @@
   bool connected() const { return connected_; }
   uint32_t overhead() const { return overhead_; }
 
-  static std::string Encode(ArrayView<const RtcEvent*> /* batch */) {
+  static std::string Encode(std::span<const RtcEvent*> /* batch */) {
     // TODO(terelius): Implement
     return "";
   }
diff --git a/logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.cc b/logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.cc
index e5c834a1..8d0426a 100644
--- a/logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.cc
+++ b/logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.cc
@@ -12,15 +12,15 @@
 
 #include <cstdint>
 #include <memory>
+#include <span>
 
 #include "absl/memory/memory.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 
 namespace webrtc {
 
 RtcEventRtcpPacketIncoming::RtcEventRtcpPacketIncoming(
-    ArrayView<const uint8_t> packet)
+    std::span<const uint8_t> packet)
     : packet_(packet.data(), packet.size()) {}
 
 RtcEventRtcpPacketIncoming::RtcEventRtcpPacketIncoming(
diff --git a/logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.h b/logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.h
index 69c2e6b..c23ae21 100644
--- a/logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.h
+++ b/logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.h
@@ -14,11 +14,11 @@
 #include <stdint.h>
 
 #include <memory>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "logging/rtc_event_log/events/logged_rtp_rtcp.h"
 #include "logging/rtc_event_log/events/rtc_event_log_parse_status.h"
@@ -30,7 +30,7 @@
  public:
   static constexpr Type kType = Type::RtcpPacketIncoming;
 
-  explicit RtcEventRtcpPacketIncoming(ArrayView<const uint8_t> packet);
+  explicit RtcEventRtcpPacketIncoming(std::span<const uint8_t> packet);
   ~RtcEventRtcpPacketIncoming() override;
 
   Type GetType() const override { return kType; }
@@ -40,7 +40,7 @@
 
   const Buffer& packet() const { return packet_; }
 
-  static std::string Encode(ArrayView<const RtcEvent*> /* batch */) {
+  static std::string Encode(std::span<const RtcEvent*> /* batch */) {
     // TODO(terelius): Implement
     return "";
   }
diff --git a/logging/rtc_event_log/events/rtc_event_rtcp_packet_outgoing.cc b/logging/rtc_event_log/events/rtc_event_rtcp_packet_outgoing.cc
index 5926e5c..1b84727 100644
--- a/logging/rtc_event_log/events/rtc_event_rtcp_packet_outgoing.cc
+++ b/logging/rtc_event_log/events/rtc_event_rtcp_packet_outgoing.cc
@@ -12,15 +12,15 @@
 
 #include <cstdint>
 #include <memory>
+#include <span>
 
 #include "absl/memory/memory.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 
 namespace webrtc {
 
 RtcEventRtcpPacketOutgoing::RtcEventRtcpPacketOutgoing(
-    ArrayView<const uint8_t> packet)
+    std::span<const uint8_t> packet)
     : packet_(packet.data(), packet.size()) {}
 
 RtcEventRtcpPacketOutgoing::RtcEventRtcpPacketOutgoing(
diff --git a/logging/rtc_event_log/events/rtc_event_rtcp_packet_outgoing.h b/logging/rtc_event_log/events/rtc_event_rtcp_packet_outgoing.h
index 9916c94..4704fea 100644
--- a/logging/rtc_event_log/events/rtc_event_rtcp_packet_outgoing.h
+++ b/logging/rtc_event_log/events/rtc_event_rtcp_packet_outgoing.h
@@ -14,11 +14,11 @@
 #include <stdint.h>
 
 #include <memory>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "logging/rtc_event_log/events/logged_rtp_rtcp.h"
 #include "logging/rtc_event_log/events/rtc_event_log_parse_status.h"
@@ -30,7 +30,7 @@
  public:
   static constexpr Type kType = Type::RtcpPacketOutgoing;
 
-  explicit RtcEventRtcpPacketOutgoing(ArrayView<const uint8_t> packet);
+  explicit RtcEventRtcpPacketOutgoing(std::span<const uint8_t> packet);
   ~RtcEventRtcpPacketOutgoing() override;
 
   Type GetType() const override { return kType; }
@@ -40,7 +40,7 @@
 
   const Buffer& packet() const { return packet_; }
 
-  static std::string Encode(ArrayView<const RtcEvent*> /* batch */) {
+  static std::string Encode(std::span<const RtcEvent*> /* batch */) {
     // TODO(terelius): Implement
     return "";
   }
diff --git a/logging/rtc_event_log/events/rtc_event_rtp_packet_incoming.h b/logging/rtc_event_log/events/rtc_event_rtp_packet_incoming.h
index 03bb5ef..23cd3ae 100644
--- a/logging/rtc_event_log/events/rtc_event_rtp_packet_incoming.h
+++ b/logging/rtc_event_log/events/rtc_event_rtp_packet_incoming.h
@@ -16,12 +16,12 @@
 #include <map>
 #include <memory>
 #include <optional>
+#include <span>
 #include <string>
 #include <utility>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "logging/rtc_event_log/events/logged_rtp_rtcp.h"
 #include "logging/rtc_event_log/events/rtc_event_log_parse_status.h"
@@ -47,8 +47,8 @@
 
   size_t packet_length() const { return packet_.size(); }
 
-  ArrayView<const uint8_t> RawHeader() const {
-    return MakeArrayView(packet_.data(), header_length());
+  std::span<const uint8_t> RawHeader() const {
+    return std::span(packet_.data(), header_length());
   }
   uint32_t Ssrc() const { return packet_.Ssrc(); }
   uint32_t Timestamp() const { return packet_.Timestamp(); }
@@ -60,7 +60,7 @@
     return packet_.GetExtension<ExtensionTrait>(std::forward<Args>(args)...);
   }
   template <typename ExtensionTrait>
-  ArrayView<const uint8_t> GetRawExtension() const {
+  std::span<const uint8_t> GetRawExtension() const {
     return packet_.GetRawExtension<ExtensionTrait>();
   }
   template <typename ExtensionTrait>
@@ -75,7 +75,7 @@
     return rtx_original_sequence_number_;
   }
 
-  static std::string Encode(ArrayView<const RtcEvent*> /* batch */) {
+  static std::string Encode(std::span<const RtcEvent*> /* batch */) {
     // TODO(terelius): Implement
     return "";
   }
diff --git a/logging/rtc_event_log/events/rtc_event_rtp_packet_outgoing.h b/logging/rtc_event_log/events/rtc_event_rtp_packet_outgoing.h
index bfe55fd..ce3931e 100644
--- a/logging/rtc_event_log/events/rtc_event_rtp_packet_outgoing.h
+++ b/logging/rtc_event_log/events/rtc_event_rtp_packet_outgoing.h
@@ -16,12 +16,12 @@
 #include <map>
 #include <memory>
 #include <optional>
+#include <span>
 #include <string>
 #include <utility>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "logging/rtc_event_log/events/logged_rtp_rtcp.h"
 #include "logging/rtc_event_log/events/rtc_event_log_parse_status.h"
@@ -48,8 +48,8 @@
 
   size_t packet_length() const { return packet_.size(); }
 
-  ArrayView<const uint8_t> RawHeader() const {
-    return MakeArrayView(packet_.data(), header_length());
+  std::span<const uint8_t> RawHeader() const {
+    return std::span(packet_.data(), header_length());
   }
   uint32_t Ssrc() const { return packet_.Ssrc(); }
   uint32_t Timestamp() const { return packet_.Timestamp(); }
@@ -61,7 +61,7 @@
     return packet_.GetExtension<ExtensionTrait>(std::forward<Args>(args)...);
   }
   template <typename ExtensionTrait>
-  ArrayView<const uint8_t> GetRawExtension() const {
+  std::span<const uint8_t> GetRawExtension() const {
     return packet_.GetRawExtension<ExtensionTrait>();
   }
   template <typename ExtensionTrait>
@@ -77,7 +77,7 @@
     return rtx_original_sequence_number_;
   }
 
-  static std::string Encode(ArrayView<const RtcEvent*> /* batch */) {
+  static std::string Encode(std::span<const RtcEvent*> /* batch */) {
     // TODO(terelius): Implement
     return "";
   }
diff --git a/logging/rtc_event_log/events/rtc_event_video_receive_stream_config.h b/logging/rtc_event_log/events/rtc_event_video_receive_stream_config.h
index f8c222f..c1c5103 100644
--- a/logging/rtc_event_log/events/rtc_event_video_receive_stream_config.h
+++ b/logging/rtc_event_log/events/rtc_event_video_receive_stream_config.h
@@ -13,11 +13,11 @@
 
 #include <cstdint>
 #include <memory>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "api/units/timestamp.h"
 #include "logging/rtc_event_log/events/rtc_event_log_parse_status.h"
@@ -53,7 +53,7 @@
 
   const rtclog::StreamConfig& config() const { return *config_; }
 
-  static std::string Encode(ArrayView<const RtcEvent*> /* batch */) {
+  static std::string Encode(std::span<const RtcEvent*> /* batch */) {
     // TODO(terelius): Implement
     return "";
   }
diff --git a/logging/rtc_event_log/events/rtc_event_video_send_stream_config.h b/logging/rtc_event_log/events/rtc_event_video_send_stream_config.h
index 2d5b85c..eeb0810 100644
--- a/logging/rtc_event_log/events/rtc_event_video_send_stream_config.h
+++ b/logging/rtc_event_log/events/rtc_event_video_send_stream_config.h
@@ -13,11 +13,11 @@
 
 #include <cstdint>
 #include <memory>
+#include <span>
 #include <string>
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtc_event_log/rtc_event.h"
 #include "api/units/timestamp.h"
 #include "logging/rtc_event_log/events/rtc_event_log_parse_status.h"
@@ -53,7 +53,7 @@
 
   const rtclog::StreamConfig& config() const { return *config_; }
 
-  static std::string Encode(ArrayView<const RtcEvent*> /* batch */) {
+  static std::string Encode(std::span<const RtcEvent*> /* batch */) {
     // TODO(terelius): Implement
     return "";
   }
diff --git a/logging/rtc_event_log/rtc_event_log2rtp_dump.cc b/logging/rtc_event_log/rtc_event_log2rtp_dump.cc
index 67b136e..abe5a44 100644
--- a/logging/rtc_event_log/rtc_event_log2rtp_dump.cc
+++ b/logging/rtc_event_log/rtc_event_log2rtp_dump.cc
@@ -13,6 +13,7 @@
 #include <iostream>
 #include <memory>
 #include <optional>
+#include <span>
 #include <string>
 #include <vector>
 
@@ -20,7 +21,6 @@
 #include "absl/flags/parse.h"
 #include "absl/flags/usage.h"
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/rtp_headers.h"
 #include "logging/rtc_event_log/events/logged_rtp_rtcp.h"
 #include "logging/rtc_event_log/rtc_event_log_parser.h"
@@ -108,7 +108,7 @@
   reconstructed_packet.SetTimestamp(incoming.rtp.header.timestamp);
   reconstructed_packet.SetSsrc(incoming.rtp.header.ssrc);
   if (incoming.rtp.header.numCSRCs > 0) {
-    reconstructed_packet.SetCsrcs(webrtc::ArrayView<const uint32_t>(
+    reconstructed_packet.SetCsrcs(std::span<const uint32_t>(
         incoming.rtp.header.arrOfCSRCs, incoming.rtp.header.numCSRCs));
   }
 
diff --git a/logging/rtc_event_log/rtc_event_log_unittest_helper.cc b/logging/rtc_event_log/rtc_event_log_unittest_helper.cc
index db573e7..b711b72 100644
--- a/logging/rtc_event_log/rtc_event_log_unittest_helper.cc
+++ b/logging/rtc_event_log/rtc_event_log_unittest_helper.cc
@@ -17,12 +17,12 @@
 #include <memory>
 #include <numeric>
 #include <optional>
+#include <span>
 #include <utility>
 #include <vector>
 
 #include "absl/algorithm/container.h"
 #include "absl/strings/string_view.h"
-#include "api/array_view.h"
 #include "api/candidate.h"
 #include "api/dtls_transport_interface.h"
 #include "api/rtc_event_log/rtc_event_log.h"
@@ -127,7 +127,7 @@
      .name = RtpExtension::kDependencyDescriptorUri}};
 
 template <typename T>
-void ShuffleInPlace(Random* prng, ArrayView<T> array) {
+void ShuffleInPlace(Random* prng, std::span<T> array) {
   RTC_DCHECK_LE(array.size(), std::numeric_limits<uint32_t>::max());
   for (uint32_t i = 0; i + 1 < array.size(); i++) {
     uint32_t other = prng->Rand(i, static_cast<uint32_t>(array.size() - 1));
@@ -657,7 +657,7 @@
   std::vector<int> id(RtpExtension::kOneByteHeaderExtensionMaxId -
                       RtpExtension::kMinId + 1);
   std::iota(id.begin(), id.end(), RtpExtension::kMinId);
-  ShuffleInPlace(&prng_, ArrayView<int>(id));
+  ShuffleInPlace(&prng_, std::span<int>(id));
 
   auto not_excluded = [&](RTPExtensionType type) -> bool {
     return !absl::c_linear_search(excluded_extensions, type);
@@ -1031,7 +1031,7 @@
     const Event& packet,
     const std::vector<uint8_t>& logged_dd) const {
   if (expect_dependency_descriptor_rtp_header_extension_is_set_) {
-    ArrayView<const uint8_t> original =
+    std::span<const uint8_t> original =
         packet.template GetRawExtension<RtpDependencyDescriptorExtension>();
     EXPECT_THAT(logged_dd, ElementsAreArray(original));
   } else {