Move array_view.h to webrtc/api/
We use ArrayView in our public API, so its header should be in
webrtc/api/.
BUG=none
Review-Url: https://codereview.webrtc.org/3007763002
Cr-Commit-Position: refs/heads/master@{#19658}
diff --git a/webrtc/api/BUILD.gn b/webrtc/api/BUILD.gn
index e58f393..2e3d77a 100644
--- a/webrtc/api/BUILD.gn
+++ b/webrtc/api/BUILD.gn
@@ -198,6 +198,15 @@
}
}
+rtc_source_set("array_view") {
+ sources = [
+ "array_view.h",
+ ]
+ deps = [
+ "../rtc_base:rtc_base_approved",
+ ]
+}
+
rtc_source_set("libjingle_peerconnection_test_api") {
testonly = true
sources = [
@@ -256,6 +265,7 @@
visibility = [ "..:rtc_unittests" ]
}
sources = [
+ "array_view_unittest.cc",
"ortc/mediadescription_unittest.cc",
"ortc/sessiondescription_unittest.cc",
"rtcerror_unittest.cc",
@@ -268,8 +278,11 @@
}
deps = [
+ ":array_view",
":libjingle_peerconnection_api",
":ortc_api",
+ "../rtc_base:rtc_base_approved",
+ "../rtc_base:rtc_base_tests_utils",
"../test:test_support",
]
}
diff --git a/webrtc/api/array_view.h b/webrtc/api/array_view.h
new file mode 100644
index 0000000..c97d388
--- /dev/null
+++ b/webrtc/api/array_view.h
@@ -0,0 +1,263 @@
+/*
+ * Copyright 2015 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef WEBRTC_API_ARRAY_VIEW_H_
+#define WEBRTC_API_ARRAY_VIEW_H_
+
+#include <algorithm>
+#include <type_traits>
+
+#include "webrtc/rtc_base/checks.h"
+#include "webrtc/rtc_base/type_traits.h"
+
+namespace rtc {
+
+// tl;dr: rtc::ArrayView is the same thing as gsl::span from the Guideline
+// Support Library.
+//
+// Many functions read from or write to arrays. The obvious way to do this is
+// to use two arguments, a pointer to the first element and an element count:
+//
+// bool Contains17(const int* arr, size_t size) {
+// for (size_t i = 0; i < size; ++i) {
+// if (arr[i] == 17)
+// return true;
+// }
+// return false;
+// }
+//
+// This is flexible, since it doesn't matter how the array is stored (C array,
+// std::vector, rtc::Buffer, ...), but it's error-prone because the caller has
+// to correctly specify the array length:
+//
+// Contains17(arr, arraysize(arr)); // C array
+// Contains17(arr.data(), arr.size()); // std::vector
+// Contains17(arr, size); // pointer + size
+// ...
+//
+// It's also kind of messy to have two separate arguments for what is
+// conceptually a single thing.
+//
+// Enter rtc::ArrayView<T>. It contains a T pointer (to an array it doesn't
+// own) and a count, and supports the basic things you'd expect, such as
+// indexing and iteration. It allows us to write our function like this:
+//
+// bool Contains17(rtc::ArrayView<const int> arr) {
+// for (auto e : arr) {
+// if (e == 17)
+// return true;
+// }
+// return false;
+// }
+//
+// And even better, because a bunch of things will implicitly convert to
+// ArrayView, we can call it like this:
+//
+// Contains17(arr); // C array
+// Contains17(arr); // std::vector
+// Contains17(rtc::ArrayView<int>(arr, size)); // pointer + size
+// Contains17(nullptr); // nullptr -> empty ArrayView
+// ...
+//
+// ArrayView<T> stores both a pointer and a size, but you may also use
+// ArrayView<T, N>, which has a size that's fixed at compile time (which means
+// it only has to store the pointer).
+//
+// One important point is that ArrayView<T> and ArrayView<const T> are
+// different types, which allow and don't allow mutation of the array elements,
+// respectively. The implicit conversions work just like you'd hope, so that
+// e.g. vector<int> will convert to either ArrayView<int> or ArrayView<const
+// int>, but const vector<int> will convert only to ArrayView<const int>.
+// (ArrayView itself can be the source type in such conversions, so
+// ArrayView<int> will convert to ArrayView<const int>.)
+//
+// Note: ArrayView is tiny (just a pointer and a count if variable-sized, just
+// a pointer if fix-sized) and trivially copyable, so it's probably cheaper to
+// pass it by value than by const reference.
+
+namespace impl {
+
+// Magic constant for indicating that the size of an ArrayView is variable
+// instead of fixed.
+enum : std::ptrdiff_t { kArrayViewVarSize = -4711 };
+
+// Base class for ArrayViews of fixed nonzero size.
+template <typename T, std::ptrdiff_t Size>
+class ArrayViewBase {
+ static_assert(Size > 0, "ArrayView size must be variable or non-negative");
+
+ public:
+ ArrayViewBase(T* data, size_t size) : data_(data) {}
+
+ static constexpr size_t size() { return Size; }
+ static constexpr bool empty() { return false; }
+ T* data() const { return data_; }
+
+ protected:
+ static constexpr bool fixed_size() { return true; }
+
+ private:
+ T* data_;
+};
+
+// Specialized base class for ArrayViews of fixed zero size.
+template <typename T>
+class ArrayViewBase<T, 0> {
+ public:
+ explicit ArrayViewBase(T* data, size_t size) {}
+
+ static constexpr size_t size() { return 0; }
+ static constexpr bool empty() { return true; }
+ T* data() const { return nullptr; }
+
+ protected:
+ static constexpr bool fixed_size() { return true; }
+};
+
+// Specialized base class for ArrayViews of variable size.
+template <typename T>
+class ArrayViewBase<T, impl::kArrayViewVarSize> {
+ public:
+ ArrayViewBase(T* data, size_t size)
+ : data_(size == 0 ? nullptr : data), size_(size) {}
+
+ size_t size() const { return size_; }
+ bool empty() const { return size_ == 0; }
+ T* data() const { return data_; }
+
+ protected:
+ static constexpr bool fixed_size() { return false; }
+
+ private:
+ T* data_;
+ size_t size_;
+};
+
+} // namespace impl
+
+template <typename T, std::ptrdiff_t Size = impl::kArrayViewVarSize>
+class ArrayView final : public impl::ArrayViewBase<T, Size> {
+ public:
+ using value_type = T;
+ using const_iterator = const T*;
+
+ // Construct an ArrayView from a pointer and a length.
+ template <typename U>
+ ArrayView(U* data, size_t size)
+ : impl::ArrayViewBase<T, Size>::ArrayViewBase(data, size) {
+ RTC_DCHECK_EQ(size == 0 ? nullptr : data, this->data());
+ RTC_DCHECK_EQ(size, this->size());
+ RTC_DCHECK_EQ(!this->data(),
+ this->size() == 0); // data is null iff size == 0.
+ }
+
+ // Construct an empty ArrayView. Note that fixed-size ArrayViews of size > 0
+ // cannot be empty.
+ ArrayView() : ArrayView(nullptr, 0) {}
+ ArrayView(std::nullptr_t) // NOLINT
+ : ArrayView() {}
+ ArrayView(std::nullptr_t, size_t size)
+ : ArrayView(static_cast<T*>(nullptr), size) {
+ static_assert(Size == 0 || Size == impl::kArrayViewVarSize, "");
+ RTC_DCHECK_EQ(0, size);
+ }
+
+ // Construct an ArrayView from an array.
+ template <typename U, size_t N>
+ ArrayView(U (&array)[N]) // NOLINT
+ : ArrayView(array, N) {
+ static_assert(Size == N || Size == impl::kArrayViewVarSize,
+ "Array size must match ArrayView size");
+ }
+
+ // (Only if size is fixed.) Construct an ArrayView from any type U that has a
+ // static constexpr size() method whose return value is equal to Size, and a
+ // data() method whose return value converts implicitly to T*. In particular,
+ // this means we allow conversion from ArrayView<T, N> to ArrayView<const T,
+ // N>, but not the other way around. We also don't allow conversion from
+ // ArrayView<T> to ArrayView<T, N>, or from ArrayView<T, M> to ArrayView<T,
+ // N> when M != N.
+ template <
+ typename U,
+ typename std::enable_if<Size != impl::kArrayViewVarSize &&
+ HasDataAndSize<U, T>::value>::type* = nullptr>
+ ArrayView(U& u) // NOLINT
+ : ArrayView(u.data(), u.size()) {
+ static_assert(U::size() == Size, "Sizes must match exactly");
+ }
+
+ // (Only if size is variable.) Construct an ArrayView from any type U that
+ // has a size() method whose return value converts implicitly to size_t, and
+ // a data() method whose return value converts implicitly to T*. In
+ // particular, this means we allow conversion from ArrayView<T> to
+ // ArrayView<const T>, but not the other way around. Other allowed
+ // conversions include
+ // ArrayView<T, N> to ArrayView<T> or ArrayView<const T>,
+ // std::vector<T> to ArrayView<T> or ArrayView<const T>,
+ // const std::vector<T> to ArrayView<const T>,
+ // rtc::Buffer to ArrayView<uint8_t> or ArrayView<const uint8_t>, and
+ // const rtc::Buffer to ArrayView<const uint8_t>.
+ template <
+ typename U,
+ typename std::enable_if<Size == impl::kArrayViewVarSize &&
+ HasDataAndSize<U, T>::value>::type* = nullptr>
+ ArrayView(U& u) // NOLINT
+ : ArrayView(u.data(), u.size()) {}
+
+ // Indexing and iteration. These allow mutation even if the ArrayView is
+ // const, because the ArrayView doesn't own the array. (To prevent mutation,
+ // use a const element type.)
+ T& operator[](size_t idx) const {
+ RTC_DCHECK_LT(idx, this->size());
+ RTC_DCHECK(this->data());
+ return this->data()[idx];
+ }
+ T* begin() const { return this->data(); }
+ T* end() const { return this->data() + this->size(); }
+ const T* cbegin() const { return this->data(); }
+ const T* cend() const { return this->data() + this->size(); }
+
+ ArrayView<T> subview(size_t offset, size_t size) const {
+ return offset < this->size()
+ ? ArrayView<T>(this->data() + offset,
+ std::min(size, this->size() - offset))
+ : ArrayView<T>();
+ }
+ ArrayView<T> subview(size_t offset) const {
+ return subview(offset, this->size());
+ }
+};
+
+// Comparing two ArrayViews compares their (pointer,size) pairs; it does *not*
+// dereference the pointers.
+template <typename T, std::ptrdiff_t Size1, std::ptrdiff_t Size2>
+bool operator==(const ArrayView<T, Size1>& a, const ArrayView<T, Size2>& b) {
+ return a.data() == b.data() && a.size() == b.size();
+}
+template <typename T, std::ptrdiff_t Size1, std::ptrdiff_t Size2>
+bool operator!=(const ArrayView<T, Size1>& a, const ArrayView<T, Size2>& b) {
+ return !(a == b);
+}
+
+// Variable-size ArrayViews are the size of two pointers; fixed-size ArrayViews
+// are the size of one pointer. (And as a special case, fixed-size ArrayViews
+// of size 0 require no storage.)
+static_assert(sizeof(ArrayView<int>) == 2 * sizeof(int*), "");
+static_assert(sizeof(ArrayView<int, 17>) == sizeof(int*), "");
+static_assert(std::is_empty<ArrayView<int, 0>>::value, "");
+
+template <typename T>
+inline ArrayView<T> MakeArrayView(T* data, size_t size) {
+ return ArrayView<T>(data, size);
+}
+
+} // namespace rtc
+
+#endif // WEBRTC_API_ARRAY_VIEW_H_
diff --git a/webrtc/rtc_base/array_view_unittest.cc b/webrtc/api/array_view_unittest.cc
similarity index 99%
rename from webrtc/rtc_base/array_view_unittest.cc
rename to webrtc/api/array_view_unittest.cc
index 6c30bef..b19abc1 100644
--- a/webrtc/rtc_base/array_view_unittest.cc
+++ b/webrtc/api/array_view_unittest.cc
@@ -10,9 +10,10 @@
#include <algorithm>
#include <string>
+#include <utility>
#include <vector>
-#include "webrtc/rtc_base/array_view.h"
+#include "webrtc/api/array_view.h"
#include "webrtc/rtc_base/buffer.h"
#include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/gunit.h"
diff --git a/webrtc/api/audio_codecs/BUILD.gn b/webrtc/api/audio_codecs/BUILD.gn
index 3ed6396..29238e6 100644
--- a/webrtc/api/audio_codecs/BUILD.gn
+++ b/webrtc/api/audio_codecs/BUILD.gn
@@ -26,6 +26,7 @@
"audio_format.h",
]
deps = [
+ "..:array_view",
"../..:webrtc_common",
"../../rtc_base:rtc_base_approved",
]
diff --git a/webrtc/api/audio_codecs/audio_decoder.cc b/webrtc/api/audio_codecs/audio_decoder.cc
index 98dd496..b25e85b 100644
--- a/webrtc/api/audio_codecs/audio_decoder.cc
+++ b/webrtc/api/audio_codecs/audio_decoder.cc
@@ -14,7 +14,7 @@
#include <memory>
#include <utility>
-#include "webrtc/rtc_base/array_view.h"
+#include "webrtc/api/array_view.h"
#include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/sanitizer.h"
#include "webrtc/rtc_base/trace_event.h"
diff --git a/webrtc/api/audio_codecs/audio_decoder.h b/webrtc/api/audio_codecs/audio_decoder.h
index d671839..0d15e6d 100644
--- a/webrtc/api/audio_codecs/audio_decoder.h
+++ b/webrtc/api/audio_codecs/audio_decoder.h
@@ -14,7 +14,7 @@
#include <memory>
#include <vector>
-#include "webrtc/rtc_base/array_view.h"
+#include "webrtc/api/array_view.h"
#include "webrtc/rtc_base/buffer.h"
#include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/optional.h"
diff --git a/webrtc/api/audio_codecs/audio_encoder.h b/webrtc/api/audio_codecs/audio_encoder.h
index bd8c7de..37a03d0 100644
--- a/webrtc/api/audio_codecs/audio_encoder.h
+++ b/webrtc/api/audio_codecs/audio_encoder.h
@@ -16,7 +16,7 @@
#include <string>
#include <vector>
-#include "webrtc/rtc_base/array_view.h"
+#include "webrtc/api/array_view.h"
#include "webrtc/rtc_base/buffer.h"
#include "webrtc/rtc_base/deprecation.h"
#include "webrtc/rtc_base/optional.h"
diff --git a/webrtc/call/BUILD.gn b/webrtc/call/BUILD.gn
index 19bc218..580d606 100644
--- a/webrtc/call/BUILD.gn
+++ b/webrtc/call/BUILD.gn
@@ -45,6 +45,7 @@
"rtp_transport_controller_send_interface.h",
]
deps = [
+ "../api:array_view",
"../rtc_base:rtc_base_approved",
]
}
@@ -66,6 +67,7 @@
deps = [
":rtp_interfaces",
"..:webrtc_common",
+ "../api:array_view",
"../modules/rtp_rtcp",
"../rtc_base:rtc_base_approved",
]
@@ -175,6 +177,7 @@
":rtp_receiver",
":rtp_sender",
"..:webrtc_common",
+ "../api:array_view",
"../api:mock_audio_mixer",
"../logging:rtc_event_log_api",
"../modules/audio_device:mock_audio_device",
diff --git a/webrtc/call/flexfec_receive_stream_unittest.cc b/webrtc/call/flexfec_receive_stream_unittest.cc
index 9c5a691..c3bf2e0 100644
--- a/webrtc/call/flexfec_receive_stream_unittest.cc
+++ b/webrtc/call/flexfec_receive_stream_unittest.cc
@@ -13,6 +13,7 @@
#include <stdint.h>
#include <memory>
+#include "webrtc/api/array_view.h"
#include "webrtc/call/rtp_stream_receiver_controller.h"
#include "webrtc/modules/pacing/packet_router.h"
#include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h"
@@ -21,7 +22,6 @@
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h"
#include "webrtc/modules/utility/include/mock/mock_process_thread.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/ptr_util.h"
#include "webrtc/test/gmock.h"
#include "webrtc/test/gtest.h"
diff --git a/webrtc/call/rtcp_demuxer.h b/webrtc/call/rtcp_demuxer.h
index 1919c2b..7b5af9f 100644
--- a/webrtc/call/rtcp_demuxer.h
+++ b/webrtc/call/rtcp_demuxer.h
@@ -15,8 +15,8 @@
#include <string>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/call/ssrc_binding_observer.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/basictypes.h"
namespace webrtc {
diff --git a/webrtc/call/rtcp_packet_sink_interface.h b/webrtc/call/rtcp_packet_sink_interface.h
index 1b3cfba..22a404d 100644
--- a/webrtc/call/rtcp_packet_sink_interface.h
+++ b/webrtc/call/rtcp_packet_sink_interface.h
@@ -10,7 +10,7 @@
#ifndef WEBRTC_CALL_RTCP_PACKET_SINK_INTERFACE_H_
#define WEBRTC_CALL_RTCP_PACKET_SINK_INTERFACE_H_
-#include "webrtc/rtc_base/array_view.h"
+#include "webrtc/api/array_view.h"
namespace webrtc {
diff --git a/webrtc/call/rtp_rtcp_demuxer_helper.h b/webrtc/call/rtp_rtcp_demuxer_helper.h
index b097d10..02d08aa 100644
--- a/webrtc/call/rtp_rtcp_demuxer_helper.h
+++ b/webrtc/call/rtp_rtcp_demuxer_helper.h
@@ -15,7 +15,7 @@
#include <map>
#include <utility>
-#include "webrtc/rtc_base/array_view.h"
+#include "webrtc/api/array_view.h"
#include "webrtc/rtc_base/basictypes.h"
#include "webrtc/rtc_base/optional.h"
diff --git a/webrtc/common_types.h b/webrtc/common_types.h
index 868bee4..229d858 100644
--- a/webrtc/common_types.h
+++ b/webrtc/common_types.h
@@ -17,10 +17,10 @@
#include <string>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/api/video/video_content_type.h"
#include "webrtc/api/video/video_rotation.h"
#include "webrtc/api/video/video_timing.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/deprecation.h"
#include "webrtc/rtc_base/optional.h"
diff --git a/webrtc/modules/audio_coding/BUILD.gn b/webrtc/modules/audio_coding/BUILD.gn
index 569d214..8d92c46 100644
--- a/webrtc/modules/audio_coding/BUILD.gn
+++ b/webrtc/modules/audio_coding/BUILD.gn
@@ -46,6 +46,7 @@
]
deps = [
"../..:webrtc_common",
+ "../../api:array_view",
"../../api/audio_codecs:audio_codecs_api",
"../../rtc_base:rtc_base_approved",
]
@@ -59,6 +60,7 @@
"acm2/rent_a_codec.h",
]
deps = [
+ "../../api:array_view",
"../../api/audio_codecs:audio_codecs_api",
"../..:webrtc_common",
"../../rtc_base:protobuf_utils",
@@ -123,6 +125,7 @@
deps = audio_coding_deps + [
"..:module_api",
+ "../../api:array_view",
"../../api/audio_codecs:audio_codecs_api",
"../../api/audio_codecs:builtin_audio_decoder_factory",
":audio_coding_module_typedefs",
@@ -140,6 +143,7 @@
"codecs/legacy_encoded_audio_frame.h",
]
deps = [
+ "../../api:array_view",
"../../api/audio_codecs:audio_codecs_api",
"../../rtc_base:rtc_base_approved",
]
@@ -164,6 +168,7 @@
deps = [
"../..:webrtc_common",
+ "../../api:array_view",
"../../api/audio_codecs:audio_codecs_api",
"../../common_audio",
"../../rtc_base:rtc_base_approved",
@@ -1111,6 +1116,7 @@
":pcm16b",
"..:module_api",
"../..:webrtc_common",
+ "../../api:array_view",
"../../common_audio",
"../../rtc_base:rtc_base_approved",
"../../rtc_base:rtc_base_tests_utils",
@@ -1159,6 +1165,7 @@
deps = [
"../..:webrtc_common",
+ "../../api:array_view",
"../../api/audio_codecs:audio_codecs_api",
"../../common_audio",
"../../rtc_base:rtc_base_approved",
diff --git a/webrtc/modules/audio_coding/acm2/acm_receiver.h b/webrtc/modules/audio_coding/acm2/acm_receiver.h
index f51f9b7..5acb013 100644
--- a/webrtc/modules/audio_coding/acm2/acm_receiver.h
+++ b/webrtc/modules/audio_coding/acm2/acm_receiver.h
@@ -16,13 +16,13 @@
#include <string>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/common_audio/vad/include/webrtc_vad.h"
#include "webrtc/modules/audio_coding/acm2/acm_resampler.h"
#include "webrtc/modules/audio_coding/acm2/call_statistics.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module.h"
#include "webrtc/modules/audio_coding/neteq/include/neteq.h"
#include "webrtc/modules/include/module_common_types.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/criticalsection.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/rtc_base/thread_annotations.h"
diff --git a/webrtc/modules/audio_coding/acm2/rent_a_codec.h b/webrtc/modules/audio_coding/acm2/rent_a_codec.h
index a9ed85c..3dd9dc8 100644
--- a/webrtc/modules/audio_coding/acm2/rent_a_codec.h
+++ b/webrtc/modules/audio_coding/acm2/rent_a_codec.h
@@ -15,11 +15,11 @@
#include <map>
#include <memory>
+#include "webrtc/api/array_view.h"
#include "webrtc/api/audio_codecs/audio_decoder.h"
#include "webrtc/api/audio_codecs/audio_encoder.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h"
#include "webrtc/modules/audio_coding/neteq/neteq_decoder_enum.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/rtc_base/scoped_ref_ptr.h"
diff --git a/webrtc/modules/audio_coding/codecs/audio_format_conversion.cc b/webrtc/modules/audio_coding/codecs/audio_format_conversion.cc
index af58bc4..17f8d96 100644
--- a/webrtc/modules/audio_coding/codecs/audio_format_conversion.cc
+++ b/webrtc/modules/audio_coding/codecs/audio_format_conversion.cc
@@ -12,7 +12,7 @@
#include <string.h>
-#include "webrtc/rtc_base/array_view.h"
+#include "webrtc/api/array_view.h"
#include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/rtc_base/safe_conversions.h"
diff --git a/webrtc/modules/audio_coding/codecs/cng/webrtc_cng.h b/webrtc/modules/audio_coding/codecs/cng/webrtc_cng.h
index c751341..98231e7 100644
--- a/webrtc/modules/audio_coding/codecs/cng/webrtc_cng.h
+++ b/webrtc/modules/audio_coding/codecs/cng/webrtc_cng.h
@@ -14,7 +14,7 @@
#include <cstddef>
-#include "webrtc/rtc_base/array_view.h"
+#include "webrtc/api/array_view.h"
#include "webrtc/rtc_base/buffer.h"
#include "webrtc/typedefs.h"
diff --git a/webrtc/modules/audio_coding/codecs/legacy_encoded_audio_frame.h b/webrtc/modules/audio_coding/codecs/legacy_encoded_audio_frame.h
index 65f4654..e8ea029 100644
--- a/webrtc/modules/audio_coding/codecs/legacy_encoded_audio_frame.h
+++ b/webrtc/modules/audio_coding/codecs/legacy_encoded_audio_frame.h
@@ -13,8 +13,8 @@
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/api/audio_codecs/audio_decoder.h"
-#include "webrtc/rtc_base/array_view.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_coding/neteq/tools/audio_loop.h b/webrtc/modules/audio_coding/neteq/tools/audio_loop.h
index 2c4aed8..d226df4 100644
--- a/webrtc/modules/audio_coding/neteq/tools/audio_loop.h
+++ b/webrtc/modules/audio_coding/neteq/tools/audio_loop.h
@@ -14,7 +14,7 @@
#include <memory>
#include <string>
-#include "webrtc/rtc_base/array_view.h"
+#include "webrtc/api/array_view.h"
#include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/typedefs.h"
diff --git a/webrtc/modules/audio_coding/neteq/tools/fake_decode_from_file.h b/webrtc/modules/audio_coding/neteq/tools/fake_decode_from_file.h
index d39af1e..d293ecd 100644
--- a/webrtc/modules/audio_coding/neteq/tools/fake_decode_from_file.h
+++ b/webrtc/modules/audio_coding/neteq/tools/fake_decode_from_file.h
@@ -13,9 +13,9 @@
#include <memory>
+#include "webrtc/api/array_view.h"
#include "webrtc/api/audio_codecs/audio_decoder.h"
#include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/optional.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_device/BUILD.gn b/webrtc/modules/audio_device/BUILD.gn
index 1569eb2..b9716ae 100644
--- a/webrtc/modules/audio_device/BUILD.gn
+++ b/webrtc/modules/audio_device/BUILD.gn
@@ -51,6 +51,7 @@
deps = [
"..:module_api",
"../..:webrtc_common",
+ "../../api:array_view",
"../../common_audio",
"../../rtc_base:rtc_base_approved",
"../../rtc_base:rtc_task_queue",
@@ -281,6 +282,7 @@
deps = [
":audio_device",
":mock_audio_device",
+ "../../api:array_view",
"../../rtc_base:rtc_base_approved",
"../../system_wrappers:system_wrappers",
"../../test:test_support",
diff --git a/webrtc/modules/audio_device/android/opensles_player.cc b/webrtc/modules/audio_device/android/opensles_player.cc
index 0ffb259..513f823 100644
--- a/webrtc/modules/audio_device/android/opensles_player.cc
+++ b/webrtc/modules/audio_device/android/opensles_player.cc
@@ -12,10 +12,10 @@
#include <android/log.h>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_device/android/audio_common.h"
#include "webrtc/modules/audio_device/android/audio_manager.h"
#include "webrtc/modules/audio_device/fine_audio_buffer.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/arraysize.h"
#include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/format_macros.h"
diff --git a/webrtc/modules/audio_device/android/opensles_recorder.cc b/webrtc/modules/audio_device/android/opensles_recorder.cc
index b180254..e3a6e61 100644
--- a/webrtc/modules/audio_device/android/opensles_recorder.cc
+++ b/webrtc/modules/audio_device/android/opensles_recorder.cc
@@ -12,10 +12,10 @@
#include <android/log.h>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_device/android/audio_common.h"
#include "webrtc/modules/audio_device/android/audio_manager.h"
#include "webrtc/modules/audio_device/fine_audio_buffer.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/arraysize.h"
#include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/format_macros.h"
diff --git a/webrtc/modules/audio_device/audio_device_unittest.cc b/webrtc/modules/audio_device/audio_device_unittest.cc
index 1327cda..67e9f47 100644
--- a/webrtc/modules/audio_device/audio_device_unittest.cc
+++ b/webrtc/modules/audio_device/audio_device_unittest.cc
@@ -12,10 +12,10 @@
#include <cstring>
#include <numeric>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_device/audio_device_impl.h"
#include "webrtc/modules/audio_device/include/audio_device.h"
#include "webrtc/modules/audio_device/include/mock_audio_transport.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/buffer.h"
#include "webrtc/rtc_base/criticalsection.h"
#include "webrtc/rtc_base/event.h"
diff --git a/webrtc/modules/audio_device/fine_audio_buffer.h b/webrtc/modules/audio_device/fine_audio_buffer.h
index f2ee20f..df806db 100644
--- a/webrtc/modules/audio_device/fine_audio_buffer.h
+++ b/webrtc/modules/audio_device/fine_audio_buffer.h
@@ -13,7 +13,7 @@
#include <memory>
-#include "webrtc/rtc_base/array_view.h"
+#include "webrtc/api/array_view.h"
#include "webrtc/rtc_base/buffer.h"
#include "webrtc/typedefs.h"
diff --git a/webrtc/modules/audio_device/fine_audio_buffer_unittest.cc b/webrtc/modules/audio_device/fine_audio_buffer_unittest.cc
index 21043ea..ada14e0 100644
--- a/webrtc/modules/audio_device/fine_audio_buffer_unittest.cc
+++ b/webrtc/modules/audio_device/fine_audio_buffer_unittest.cc
@@ -13,8 +13,8 @@
#include <limits.h>
#include <memory>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_device/mock_audio_device_buffer.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/test/gmock.h"
#include "webrtc/test/gtest.h"
diff --git a/webrtc/modules/audio_device/ios/audio_device_ios.mm b/webrtc/modules/audio_device/ios/audio_device_ios.mm
index fb2f65d..81558b5 100644
--- a/webrtc/modules/audio_device/ios/audio_device_ios.mm
+++ b/webrtc/modules/audio_device/ios/audio_device_ios.mm
@@ -15,8 +15,8 @@
#include <cmath>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_device/fine_audio_buffer.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/atomicops.h"
#include "webrtc/rtc_base/bind.h"
#include "webrtc/rtc_base/checks.h"
diff --git a/webrtc/modules/audio_mixer/BUILD.gn b/webrtc/modules/audio_mixer/BUILD.gn
index e7323f1..5b03a9a 100644
--- a/webrtc/modules/audio_mixer/BUILD.gn
+++ b/webrtc/modules/audio_mixer/BUILD.gn
@@ -40,6 +40,7 @@
":audio_frame_manipulator",
"..:module_api",
"../..:webrtc_common",
+ "../../api:array_view",
"../../audio/utility:audio_frame_operations",
"../../rtc_base:rtc_base_approved",
"../../system_wrappers",
@@ -88,6 +89,7 @@
":audio_frame_manipulator",
":audio_mixer_impl",
"..:module_api",
+ "../../api:array_view",
"../../api:audio_mixer_api",
"../../audio/utility:audio_frame_operations",
"../../rtc_base:rtc_base_approved",
diff --git a/webrtc/modules/audio_mixer/frame_combiner.cc b/webrtc/modules/audio_mixer/frame_combiner.cc
index 35b9949..ad9ddaf 100644
--- a/webrtc/modules/audio_mixer/frame_combiner.cc
+++ b/webrtc/modules/audio_mixer/frame_combiner.cc
@@ -15,10 +15,10 @@
#include <functional>
#include <memory>
+#include "webrtc/api/array_view.h"
#include "webrtc/audio/utility/audio_frame_operations.h"
#include "webrtc/modules/audio_mixer/audio_frame_manipulator.h"
#include "webrtc/modules/audio_mixer/audio_mixer_impl.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/logging.h"
diff --git a/webrtc/modules/audio_mixer/gain_change_calculator.h b/webrtc/modules/audio_mixer/gain_change_calculator.h
index cb742cd..e234384 100644
--- a/webrtc/modules/audio_mixer/gain_change_calculator.h
+++ b/webrtc/modules/audio_mixer/gain_change_calculator.h
@@ -11,7 +11,7 @@
#ifndef WEBRTC_MODULES_AUDIO_MIXER_GAIN_CHANGE_CALCULATOR_H_
#define WEBRTC_MODULES_AUDIO_MIXER_GAIN_CHANGE_CALCULATOR_H_
-#include "webrtc/rtc_base/array_view.h"
+#include "webrtc/api/array_view.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/BUILD.gn b/webrtc/modules/audio_processing/BUILD.gn
index 204a988..e0719b4 100644
--- a/webrtc/modules/audio_processing/BUILD.gn
+++ b/webrtc/modules/audio_processing/BUILD.gn
@@ -237,6 +237,7 @@
":aec_dump_interface",
"..:module_api",
"../..:webrtc_common",
+ "../../api:array_view",
"../../audio/utility:audio_frame_operations",
"../../rtc_base:gtest_prod",
"../../rtc_base:protobuf_utils",
@@ -316,6 +317,7 @@
]
deps = [
+ "../../api:array_view",
"../../rtc_base:rtc_base_approved",
]
}
@@ -550,6 +552,7 @@
":audioproc_test_utils",
"..:module_api",
"../..:webrtc_common",
+ "../../api:array_view",
"../../common_audio:common_audio",
"../../rtc_base:gtest_prod",
"../../rtc_base:protobuf_utils",
@@ -774,6 +777,7 @@
deps = [
":audio_processing",
"..:module_api",
+ "../../api:array_view",
"../../common_audio",
"../../rtc_base:rtc_base_approved",
"../../system_wrappers:system_wrappers",
diff --git a/webrtc/modules/audio_processing/aec3/adaptive_fir_filter.h b/webrtc/modules/audio_processing/aec3/adaptive_fir_filter.h
index 6fae158..ee2cbbd 100644
--- a/webrtc/modules/audio_processing/aec3/adaptive_fir_filter.h
+++ b/webrtc/modules/audio_processing/aec3/adaptive_fir_filter.h
@@ -15,12 +15,12 @@
#include <memory>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/aec3/aec3_common.h"
#include "webrtc/modules/audio_processing/aec3/aec3_fft.h"
#include "webrtc/modules/audio_processing/aec3/fft_data.h"
#include "webrtc/modules/audio_processing/aec3/render_buffer.h"
#include "webrtc/modules/audio_processing/logging/apm_data_dumper.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/constructormagic.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/aec3/aec3_fft.h b/webrtc/modules/audio_processing/aec3/aec3_fft.h
index f0b98b3..d8531d2 100644
--- a/webrtc/modules/audio_processing/aec3/aec3_fft.h
+++ b/webrtc/modules/audio_processing/aec3/aec3_fft.h
@@ -13,10 +13,10 @@
#include <array>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/aec3/aec3_common.h"
#include "webrtc/modules/audio_processing/aec3/fft_data.h"
#include "webrtc/modules/audio_processing/utility/ooura_fft.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/constructormagic.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/aec3/aec_state.cc b/webrtc/modules/audio_processing/aec3/aec_state.cc
index d4a3c76..8323099 100644
--- a/webrtc/modules/audio_processing/aec3/aec_state.cc
+++ b/webrtc/modules/audio_processing/aec3/aec_state.cc
@@ -14,8 +14,8 @@
#include <numeric>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/logging/apm_data_dumper.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/atomicops.h"
#include "webrtc/rtc_base/checks.h"
diff --git a/webrtc/modules/audio_processing/aec3/aec_state.h b/webrtc/modules/audio_processing/aec3/aec_state.h
index 44a1767..8dc4530 100644
--- a/webrtc/modules/audio_processing/aec3/aec_state.h
+++ b/webrtc/modules/audio_processing/aec3/aec_state.h
@@ -15,13 +15,13 @@
#include <memory>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/aec3/aec3_common.h"
#include "webrtc/modules/audio_processing/aec3/echo_path_variability.h"
#include "webrtc/modules/audio_processing/aec3/erl_estimator.h"
#include "webrtc/modules/audio_processing/aec3/erle_estimator.h"
#include "webrtc/modules/audio_processing/aec3/render_buffer.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/optional.h"
diff --git a/webrtc/modules/audio_processing/aec3/block_framer.h b/webrtc/modules/audio_processing/aec3/block_framer.h
index d6c9144..de7c79a 100644
--- a/webrtc/modules/audio_processing/aec3/block_framer.h
+++ b/webrtc/modules/audio_processing/aec3/block_framer.h
@@ -13,8 +13,8 @@
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/aec3/aec3_common.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/constructormagic.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/aec3/cascaded_biquad_filter.h b/webrtc/modules/audio_processing/aec3/cascaded_biquad_filter.h
index 8e11a8d..997e6ea 100644
--- a/webrtc/modules/audio_processing/aec3/cascaded_biquad_filter.h
+++ b/webrtc/modules/audio_processing/aec3/cascaded_biquad_filter.h
@@ -13,7 +13,7 @@
#include <vector>
-#include "webrtc/rtc_base/array_view.h"
+#include "webrtc/api/array_view.h"
#include "webrtc/rtc_base/constructormagic.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/aec3/decimator_by_4.h b/webrtc/modules/audio_processing/aec3/decimator_by_4.h
index 93b4b58..cafe82c 100644
--- a/webrtc/modules/audio_processing/aec3/decimator_by_4.h
+++ b/webrtc/modules/audio_processing/aec3/decimator_by_4.h
@@ -13,9 +13,9 @@
#include <array>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/aec3/aec3_common.h"
#include "webrtc/modules/audio_processing/aec3/cascaded_biquad_filter.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/constructormagic.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/aec3/echo_remover.cc b/webrtc/modules/audio_processing/aec3/echo_remover.cc
index 6380a96..bac3704 100644
--- a/webrtc/modules/audio_processing/aec3/echo_remover.cc
+++ b/webrtc/modules/audio_processing/aec3/echo_remover.cc
@@ -15,6 +15,7 @@
#include <numeric>
#include <string>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/aec3/aec3_common.h"
#include "webrtc/modules/audio_processing/aec3/aec_state.h"
#include "webrtc/modules/audio_processing/aec3/comfort_noise_generator.h"
@@ -29,7 +30,6 @@
#include "webrtc/modules/audio_processing/aec3/suppression_filter.h"
#include "webrtc/modules/audio_processing/aec3/suppression_gain.h"
#include "webrtc/modules/audio_processing/logging/apm_data_dumper.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/atomicops.h"
#include "webrtc/rtc_base/constructormagic.h"
diff --git a/webrtc/modules/audio_processing/aec3/fft_data.h b/webrtc/modules/audio_processing/aec3/fft_data.h
index b5dfe24..bfd182b 100644
--- a/webrtc/modules/audio_processing/aec3/fft_data.h
+++ b/webrtc/modules/audio_processing/aec3/fft_data.h
@@ -18,8 +18,8 @@
#include <algorithm>
#include <array>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/aec3/aec3_common.h"
-#include "webrtc/rtc_base/array_view.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/aec3/frame_blocker.h b/webrtc/modules/audio_processing/aec3/frame_blocker.h
index 7b29071..d7cfd09 100644
--- a/webrtc/modules/audio_processing/aec3/frame_blocker.h
+++ b/webrtc/modules/audio_processing/aec3/frame_blocker.h
@@ -14,8 +14,8 @@
#include <stddef.h>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/aec3/aec3_common.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/constructormagic.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/aec3/matched_filter_lag_aggregator_unittest.cc b/webrtc/modules/audio_processing/aec3/matched_filter_lag_aggregator_unittest.cc
index 1c2e5ab..0144bf4 100644
--- a/webrtc/modules/audio_processing/aec3/matched_filter_lag_aggregator_unittest.cc
+++ b/webrtc/modules/audio_processing/aec3/matched_filter_lag_aggregator_unittest.cc
@@ -14,9 +14,9 @@
#include <string>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/aec3/aec3_common.h"
#include "webrtc/modules/audio_processing/logging/apm_data_dumper.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/test/gtest.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/aec3/mock/mock_render_delay_controller.h b/webrtc/modules/audio_processing/aec3/mock/mock_render_delay_controller.h
index 6a00b5e..46a59dc 100644
--- a/webrtc/modules/audio_processing/aec3/mock/mock_render_delay_controller.h
+++ b/webrtc/modules/audio_processing/aec3/mock/mock_render_delay_controller.h
@@ -11,9 +11,9 @@
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_MOCK_MOCK_RENDER_DELAY_CONTROLLER_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_MOCK_MOCK_RENDER_DELAY_CONTROLLER_H_
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/aec3/downsampled_render_buffer.h"
#include "webrtc/modules/audio_processing/aec3/render_delay_controller.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/test/gmock.h"
diff --git a/webrtc/modules/audio_processing/aec3/output_selector.h b/webrtc/modules/audio_processing/aec3/output_selector.h
index 8876e23..920280a 100644
--- a/webrtc/modules/audio_processing/aec3/output_selector.h
+++ b/webrtc/modules/audio_processing/aec3/output_selector.h
@@ -11,7 +11,7 @@
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_OUTPUT_SELECTOR_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_OUTPUT_SELECTOR_H_
-#include "webrtc/rtc_base/array_view.h"
+#include "webrtc/api/array_view.h"
#include "webrtc/rtc_base/constructormagic.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/aec3/render_buffer.h b/webrtc/modules/audio_processing/aec3/render_buffer.h
index ba7aa53..bc88767 100644
--- a/webrtc/modules/audio_processing/aec3/render_buffer.h
+++ b/webrtc/modules/audio_processing/aec3/render_buffer.h
@@ -14,9 +14,9 @@
#include <memory>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/aec3/aec3_fft.h"
#include "webrtc/modules/audio_processing/aec3/fft_data.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/constructormagic.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/aec3/render_delay_buffer.h b/webrtc/modules/audio_processing/aec3/render_delay_buffer.h
index 17a75da..865a00d 100644
--- a/webrtc/modules/audio_processing/aec3/render_delay_buffer.h
+++ b/webrtc/modules/audio_processing/aec3/render_delay_buffer.h
@@ -15,11 +15,11 @@
#include <array>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/aec3/aec3_common.h"
#include "webrtc/modules/audio_processing/aec3/downsampled_render_buffer.h"
#include "webrtc/modules/audio_processing/aec3/fft_data.h"
#include "webrtc/modules/audio_processing/aec3/render_buffer.h"
-#include "webrtc/rtc_base/array_view.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/aec3/render_delay_buffer_unittest.cc b/webrtc/modules/audio_processing/aec3/render_delay_buffer_unittest.cc
index 4a16fee..120ddb2 100644
--- a/webrtc/modules/audio_processing/aec3/render_delay_buffer_unittest.cc
+++ b/webrtc/modules/audio_processing/aec3/render_delay_buffer_unittest.cc
@@ -15,9 +15,9 @@
#include <string>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/aec3/aec3_common.h"
#include "webrtc/modules/audio_processing/logging/apm_data_dumper.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/random.h"
#include "webrtc/test/gtest.h"
diff --git a/webrtc/modules/audio_processing/aec3/render_delay_controller.h b/webrtc/modules/audio_processing/aec3/render_delay_controller.h
index ef0aaac..c1e2229 100644
--- a/webrtc/modules/audio_processing/aec3/render_delay_controller.h
+++ b/webrtc/modules/audio_processing/aec3/render_delay_controller.h
@@ -11,11 +11,11 @@
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_CONTROLLER_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_CONTROLLER_H_
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/aec3/downsampled_render_buffer.h"
#include "webrtc/modules/audio_processing/aec3/render_delay_buffer.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/modules/audio_processing/logging/apm_data_dumper.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/optional.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/aec3/render_signal_analyzer_unittest.cc b/webrtc/modules/audio_processing/aec3/render_signal_analyzer_unittest.cc
index d6701e2..e1f1e0f 100644
--- a/webrtc/modules/audio_processing/aec3/render_signal_analyzer_unittest.cc
+++ b/webrtc/modules/audio_processing/aec3/render_signal_analyzer_unittest.cc
@@ -14,12 +14,12 @@
#include <array>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/aec3/aec3_common.h"
#include "webrtc/modules/audio_processing/aec3/aec3_fft.h"
#include "webrtc/modules/audio_processing/aec3/fft_data.h"
#include "webrtc/modules/audio_processing/aec3/render_buffer.h"
#include "webrtc/modules/audio_processing/test/echo_canceller_test_tools.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/random.h"
#include "webrtc/test/gtest.h"
diff --git a/webrtc/modules/audio_processing/aec3/residual_echo_estimator.h b/webrtc/modules/audio_processing/aec3/residual_echo_estimator.h
index 5d2835d..0e86ac1 100644
--- a/webrtc/modules/audio_processing/aec3/residual_echo_estimator.h
+++ b/webrtc/modules/audio_processing/aec3/residual_echo_estimator.h
@@ -15,11 +15,11 @@
#include <array>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/aec3/aec3_common.h"
#include "webrtc/modules/audio_processing/aec3/aec_state.h"
#include "webrtc/modules/audio_processing/aec3/render_buffer.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/constructormagic.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/aec3/subtractor.cc b/webrtc/modules/audio_processing/aec3/subtractor.cc
index 20ba510..f63505f 100644
--- a/webrtc/modules/audio_processing/aec3/subtractor.cc
+++ b/webrtc/modules/audio_processing/aec3/subtractor.cc
@@ -12,8 +12,8 @@
#include <algorithm>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/logging/apm_data_dumper.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/safe_minmax.h"
diff --git a/webrtc/modules/audio_processing/aec3/vector_math.h b/webrtc/modules/audio_processing/aec3/vector_math.h
index 008aa86..d1a7e51 100644
--- a/webrtc/modules/audio_processing/aec3/vector_math.h
+++ b/webrtc/modules/audio_processing/aec3/vector_math.h
@@ -23,8 +23,8 @@
#include <array>
#include <functional>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/aec3/aec3_common.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/checks.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/agc2/digital_gain_applier.h b/webrtc/modules/audio_processing/agc2/digital_gain_applier.h
index d9ad1d9..d74ba33 100644
--- a/webrtc/modules/audio_processing/agc2/digital_gain_applier.h
+++ b/webrtc/modules/audio_processing/agc2/digital_gain_applier.h
@@ -11,8 +11,8 @@
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AGC2_DIGITAL_GAIN_APPLIER_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_AGC2_DIGITAL_GAIN_APPLIER_H_
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/audio_buffer.h"
-#include "webrtc/rtc_base/array_view.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/agc2/gain_controller2_unittest.cc b/webrtc/modules/audio_processing/agc2/gain_controller2_unittest.cc
index faa8d16..7668d23 100644
--- a/webrtc/modules/audio_processing/agc2/gain_controller2_unittest.cc
+++ b/webrtc/modules/audio_processing/agc2/gain_controller2_unittest.cc
@@ -11,10 +11,10 @@
#include <memory>
#include <string>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/agc2/digital_gain_applier.h"
#include "webrtc/modules/audio_processing/agc2/gain_controller2.h"
#include "webrtc/modules/audio_processing/audio_buffer.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/test/gtest.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/audio_processing_impl_locking_unittest.cc b/webrtc/modules/audio_processing/audio_processing_impl_locking_unittest.cc
index f8707c3..4189d6f 100644
--- a/webrtc/modules/audio_processing/audio_processing_impl_locking_unittest.cc
+++ b/webrtc/modules/audio_processing/audio_processing_impl_locking_unittest.cc
@@ -14,9 +14,9 @@
#include <memory>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/test/test_utils.h"
#include "webrtc/modules/include/module_common_types.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/criticalsection.h"
#include "webrtc/rtc_base/event.h"
#include "webrtc/rtc_base/platform_thread.h"
diff --git a/webrtc/modules/audio_processing/audio_processing_performance_unittest.cc b/webrtc/modules/audio_processing/audio_processing_performance_unittest.cc
index e478c72..2f641de 100644
--- a/webrtc/modules/audio_processing/audio_processing_performance_unittest.cc
+++ b/webrtc/modules/audio_processing/audio_processing_performance_unittest.cc
@@ -15,9 +15,9 @@
#include <memory>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/test/test_utils.h"
#include "webrtc/modules/include/module_common_types.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/atomicops.h"
#include "webrtc/rtc_base/platform_thread.h"
#include "webrtc/rtc_base/random.h"
diff --git a/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer_unittest.cc b/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer_unittest.cc
index c81d76c..bb1f0ef 100644
--- a/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer_unittest.cc
+++ b/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer_unittest.cc
@@ -15,10 +15,10 @@
#include <math.h>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/audio_buffer.h"
#include "webrtc/modules/audio_processing/test/audio_buffer_tools.h"
#include "webrtc/modules/audio_processing/test/bitexactness_tools.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/test/gtest.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/echo_cancellation_bit_exact_unittest.cc b/webrtc/modules/audio_processing/echo_cancellation_bit_exact_unittest.cc
index a4bc4f6..c4cd768 100644
--- a/webrtc/modules/audio_processing/echo_cancellation_bit_exact_unittest.cc
+++ b/webrtc/modules/audio_processing/echo_cancellation_bit_exact_unittest.cc
@@ -9,11 +9,11 @@
*/
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/audio_buffer.h"
#include "webrtc/modules/audio_processing/echo_cancellation_impl.h"
#include "webrtc/modules/audio_processing/test/audio_buffer_tools.h"
#include "webrtc/modules/audio_processing/test/bitexactness_tools.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/test/gtest.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/echo_control_mobile_unittest.cc b/webrtc/modules/audio_processing/echo_control_mobile_unittest.cc
index aa4ad3c..9941eca 100644
--- a/webrtc/modules/audio_processing/echo_control_mobile_unittest.cc
+++ b/webrtc/modules/audio_processing/echo_control_mobile_unittest.cc
@@ -9,11 +9,11 @@
*/
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/audio_buffer.h"
#include "webrtc/modules/audio_processing/echo_control_mobile_impl.h"
#include "webrtc/modules/audio_processing/test/audio_buffer_tools.h"
#include "webrtc/modules/audio_processing/test/bitexactness_tools.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/test/gtest.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/gain_control_unittest.cc b/webrtc/modules/audio_processing/gain_control_unittest.cc
index e047c10..c0c5269 100644
--- a/webrtc/modules/audio_processing/gain_control_unittest.cc
+++ b/webrtc/modules/audio_processing/gain_control_unittest.cc
@@ -9,11 +9,11 @@
*/
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/audio_buffer.h"
#include "webrtc/modules/audio_processing/gain_control_impl.h"
#include "webrtc/modules/audio_processing/test/audio_buffer_tools.h"
#include "webrtc/modules/audio_processing/test/bitexactness_tools.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/test/gtest.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/include/aec_dump.h b/webrtc/modules/audio_processing/include/aec_dump.h
index 84bba85..cec1aa3 100644
--- a/webrtc/modules/audio_processing/include/aec_dump.h
+++ b/webrtc/modules/audio_processing/include/aec_dump.h
@@ -15,7 +15,7 @@
#include <string>
#include <vector>
-#include "webrtc/rtc_base/array_view.h"
+#include "webrtc/api/array_view.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer_unittest.cc b/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer_unittest.cc
index e845687..756b303 100644
--- a/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer_unittest.cc
+++ b/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer_unittest.cc
@@ -15,13 +15,13 @@
#include <memory>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
#include "webrtc/modules/audio_processing/audio_buffer.h"
#include "webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.h"
#include "webrtc/modules/audio_processing/noise_suppression_impl.h"
#include "webrtc/modules/audio_processing/test/audio_buffer_tools.h"
#include "webrtc/modules/audio_processing/test/bitexactness_tools.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/arraysize.h"
#include "webrtc/test/gtest.h"
diff --git a/webrtc/modules/audio_processing/level_controller/biquad_filter.h b/webrtc/modules/audio_processing/level_controller/biquad_filter.h
index 62bacf2..3a052a2 100644
--- a/webrtc/modules/audio_processing/level_controller/biquad_filter.h
+++ b/webrtc/modules/audio_processing/level_controller/biquad_filter.h
@@ -13,7 +13,7 @@
#include <vector>
-#include "webrtc/rtc_base/array_view.h"
+#include "webrtc/api/array_view.h"
#include "webrtc/rtc_base/arraysize.h"
#include "webrtc/rtc_base/constructormagic.h"
diff --git a/webrtc/modules/audio_processing/level_controller/down_sampler.h b/webrtc/modules/audio_processing/level_controller/down_sampler.h
index 95e3248..5469a09 100644
--- a/webrtc/modules/audio_processing/level_controller/down_sampler.h
+++ b/webrtc/modules/audio_processing/level_controller/down_sampler.h
@@ -11,8 +11,8 @@
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_LEVEL_CONTROLLER_DOWN_SAMPLER_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_LEVEL_CONTROLLER_DOWN_SAMPLER_H_
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/level_controller/biquad_filter.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/constructormagic.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/level_controller/gain_applier.cc b/webrtc/modules/audio_processing/level_controller/gain_applier.cc
index 9e2fba0..54bcc5b 100644
--- a/webrtc/modules/audio_processing/level_controller/gain_applier.cc
+++ b/webrtc/modules/audio_processing/level_controller/gain_applier.cc
@@ -12,7 +12,7 @@
#include <algorithm>
-#include "webrtc/rtc_base/array_view.h"
+#include "webrtc/api/array_view.h"
#include "webrtc/rtc_base/checks.h"
#include "webrtc/modules/audio_processing/audio_buffer.h"
diff --git a/webrtc/modules/audio_processing/level_controller/level_controller.cc b/webrtc/modules/audio_processing/level_controller/level_controller.cc
index bc6b706..028501c 100644
--- a/webrtc/modules/audio_processing/level_controller/level_controller.cc
+++ b/webrtc/modules/audio_processing/level_controller/level_controller.cc
@@ -14,6 +14,7 @@
#include <algorithm>
#include <numeric>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/audio_buffer.h"
#include "webrtc/modules/audio_processing/level_controller/gain_applier.h"
#include "webrtc/modules/audio_processing/level_controller/gain_selector.h"
@@ -22,7 +23,6 @@
#include "webrtc/modules/audio_processing/level_controller/saturating_gain_estimator.h"
#include "webrtc/modules/audio_processing/level_controller/signal_classifier.h"
#include "webrtc/modules/audio_processing/logging/apm_data_dumper.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/arraysize.h"
#include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/logging.h"
diff --git a/webrtc/modules/audio_processing/level_controller/level_controller_complexity_unittest.cc b/webrtc/modules/audio_processing/level_controller/level_controller_complexity_unittest.cc
index 7acdfc6..62859ee 100644
--- a/webrtc/modules/audio_processing/level_controller/level_controller_complexity_unittest.cc
+++ b/webrtc/modules/audio_processing/level_controller/level_controller_complexity_unittest.cc
@@ -11,6 +11,7 @@
#include <numeric>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/audio_buffer.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/modules/audio_processing/level_controller/level_controller.h"
@@ -18,7 +19,6 @@
#include "webrtc/modules/audio_processing/test/bitexactness_tools.h"
#include "webrtc/modules/audio_processing/test/performance_timer.h"
#include "webrtc/modules/audio_processing/test/simulator_buffers.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/random.h"
#include "webrtc/system_wrappers/include/clock.h"
#include "webrtc/test/gtest.h"
diff --git a/webrtc/modules/audio_processing/level_controller/level_controller_unittest.cc b/webrtc/modules/audio_processing/level_controller/level_controller_unittest.cc
index 633bfaf..b7571e9 100644
--- a/webrtc/modules/audio_processing/level_controller/level_controller_unittest.cc
+++ b/webrtc/modules/audio_processing/level_controller/level_controller_unittest.cc
@@ -10,12 +10,12 @@
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/audio_buffer.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/modules/audio_processing/level_controller/level_controller.h"
#include "webrtc/modules/audio_processing/test/audio_buffer_tools.h"
#include "webrtc/modules/audio_processing/test/bitexactness_tools.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/test/gtest.h"
diff --git a/webrtc/modules/audio_processing/level_controller/noise_spectrum_estimator.cc b/webrtc/modules/audio_processing/level_controller/noise_spectrum_estimator.cc
index f1c1f2b..f7b1e19 100644
--- a/webrtc/modules/audio_processing/level_controller/noise_spectrum_estimator.cc
+++ b/webrtc/modules/audio_processing/level_controller/noise_spectrum_estimator.cc
@@ -13,8 +13,8 @@
#include <string.h>
#include <algorithm>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/logging/apm_data_dumper.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/arraysize.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/level_controller/noise_spectrum_estimator.h b/webrtc/modules/audio_processing/level_controller/noise_spectrum_estimator.h
index 1102966..196f056 100644
--- a/webrtc/modules/audio_processing/level_controller/noise_spectrum_estimator.h
+++ b/webrtc/modules/audio_processing/level_controller/noise_spectrum_estimator.h
@@ -11,7 +11,7 @@
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_LEVEL_CONTROLLER_NOISE_SPECTRUM_ESTIMATOR_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_LEVEL_CONTROLLER_NOISE_SPECTRUM_ESTIMATOR_H_
-#include "webrtc/rtc_base/array_view.h"
+#include "webrtc/api/array_view.h"
#include "webrtc/rtc_base/constructormagic.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/level_controller/signal_classifier.cc b/webrtc/modules/audio_processing/level_controller/signal_classifier.cc
index 98686ac..f557730 100644
--- a/webrtc/modules/audio_processing/level_controller/signal_classifier.cc
+++ b/webrtc/modules/audio_processing/level_controller/signal_classifier.cc
@@ -14,11 +14,11 @@
#include <numeric>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/audio_buffer.h"
#include "webrtc/modules/audio_processing/level_controller/down_sampler.h"
#include "webrtc/modules/audio_processing/level_controller/noise_spectrum_estimator.h"
#include "webrtc/modules/audio_processing/logging/apm_data_dumper.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/constructormagic.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/level_controller/signal_classifier.h b/webrtc/modules/audio_processing/level_controller/signal_classifier.h
index 5e0749a..1ec1951 100644
--- a/webrtc/modules/audio_processing/level_controller/signal_classifier.h
+++ b/webrtc/modules/audio_processing/level_controller/signal_classifier.h
@@ -14,10 +14,10 @@
#include <memory>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/level_controller/down_sampler.h"
#include "webrtc/modules/audio_processing/level_controller/noise_spectrum_estimator.h"
#include "webrtc/modules/audio_processing/utility/ooura_fft.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/constructormagic.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/level_estimator_impl.cc b/webrtc/modules/audio_processing/level_estimator_impl.cc
index 1e52728..27a6137 100644
--- a/webrtc/modules/audio_processing/level_estimator_impl.cc
+++ b/webrtc/modules/audio_processing/level_estimator_impl.cc
@@ -10,9 +10,9 @@
#include "webrtc/modules/audio_processing/level_estimator_impl.h"
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/audio_buffer.h"
#include "webrtc/modules/audio_processing/rms_level.h"
-#include "webrtc/rtc_base/array_view.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/level_estimator_unittest.cc b/webrtc/modules/audio_processing/level_estimator_unittest.cc
index cdb9c4e..a1ba5a2 100644
--- a/webrtc/modules/audio_processing/level_estimator_unittest.cc
+++ b/webrtc/modules/audio_processing/level_estimator_unittest.cc
@@ -9,11 +9,11 @@
*/
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/audio_buffer.h"
#include "webrtc/modules/audio_processing/level_estimator_impl.h"
#include "webrtc/modules/audio_processing/test/audio_buffer_tools.h"
#include "webrtc/modules/audio_processing/test/bitexactness_tools.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/test/gtest.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/logging/apm_data_dumper.h b/webrtc/modules/audio_processing/logging/apm_data_dumper.h
index 82dc122..34213a7 100644
--- a/webrtc/modules/audio_processing/logging/apm_data_dumper.h
+++ b/webrtc/modules/audio_processing/logging/apm_data_dumper.h
@@ -17,8 +17,8 @@
#include <string>
#include <unordered_map>
+#include "webrtc/api/array_view.h"
#include "webrtc/common_audio/wav_file.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/constructormagic.h"
// Check to verify that the define is properly set.
diff --git a/webrtc/modules/audio_processing/low_cut_filter_unittest.cc b/webrtc/modules/audio_processing/low_cut_filter_unittest.cc
index 736f0dc..d1081a4 100644
--- a/webrtc/modules/audio_processing/low_cut_filter_unittest.cc
+++ b/webrtc/modules/audio_processing/low_cut_filter_unittest.cc
@@ -9,11 +9,11 @@
*/
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/audio_buffer.h"
#include "webrtc/modules/audio_processing/low_cut_filter.h"
#include "webrtc/modules/audio_processing/test/audio_buffer_tools.h"
#include "webrtc/modules/audio_processing/test/bitexactness_tools.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/test/gtest.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/noise_suppression_unittest.cc b/webrtc/modules/audio_processing/noise_suppression_unittest.cc
index 835d396..3595413 100644
--- a/webrtc/modules/audio_processing/noise_suppression_unittest.cc
+++ b/webrtc/modules/audio_processing/noise_suppression_unittest.cc
@@ -9,11 +9,11 @@
*/
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/audio_buffer.h"
#include "webrtc/modules/audio_processing/noise_suppression_impl.h"
#include "webrtc/modules/audio_processing/test/audio_buffer_tools.h"
#include "webrtc/modules/audio_processing/test/bitexactness_tools.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/test/gtest.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/residual_echo_detector.h b/webrtc/modules/audio_processing/residual_echo_detector.h
index 8ac25fb..44bc081 100644
--- a/webrtc/modules/audio_processing/residual_echo_detector.h
+++ b/webrtc/modules/audio_processing/residual_echo_detector.h
@@ -13,11 +13,11 @@
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/echo_detector/circular_buffer.h"
#include "webrtc/modules/audio_processing/echo_detector/mean_variance_estimator.h"
#include "webrtc/modules/audio_processing/echo_detector/moving_max.h"
#include "webrtc/modules/audio_processing/echo_detector/normalized_covariance_estimator.h"
-#include "webrtc/rtc_base/array_view.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/residual_echo_detector_complexity_unittest.cc b/webrtc/modules/audio_processing/residual_echo_detector_complexity_unittest.cc
index a239279..5d854c4 100644
--- a/webrtc/modules/audio_processing/residual_echo_detector_complexity_unittest.cc
+++ b/webrtc/modules/audio_processing/residual_echo_detector_complexity_unittest.cc
@@ -11,13 +11,13 @@
#include <numeric>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/audio_buffer.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/modules/audio_processing/residual_echo_detector.h"
#include "webrtc/modules/audio_processing/test/audio_buffer_tools.h"
#include "webrtc/modules/audio_processing/test/performance_timer.h"
#include "webrtc/modules/audio_processing/test/simulator_buffers.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/random.h"
#include "webrtc/system_wrappers/include/clock.h"
#include "webrtc/test/gtest.h"
diff --git a/webrtc/modules/audio_processing/rms_level.h b/webrtc/modules/audio_processing/rms_level.h
index 4701e0c..4ce28a4 100644
--- a/webrtc/modules/audio_processing/rms_level.h
+++ b/webrtc/modules/audio_processing/rms_level.h
@@ -11,7 +11,7 @@
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_RMS_LEVEL_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_RMS_LEVEL_H_
-#include "webrtc/rtc_base/array_view.h"
+#include "webrtc/api/array_view.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/typedefs.h"
diff --git a/webrtc/modules/audio_processing/rms_level_unittest.cc b/webrtc/modules/audio_processing/rms_level_unittest.cc
index 89338ea..9d1f205 100644
--- a/webrtc/modules/audio_processing/rms_level_unittest.cc
+++ b/webrtc/modules/audio_processing/rms_level_unittest.cc
@@ -11,8 +11,8 @@
#include <memory>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/rms_level.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/mathutils.h"
#include "webrtc/rtc_base/safe_conversions.h"
diff --git a/webrtc/modules/audio_processing/test/audio_buffer_tools.h b/webrtc/modules/audio_processing/test/audio_buffer_tools.h
index f35e9a7..96ccad0 100644
--- a/webrtc/modules/audio_processing/test/audio_buffer_tools.h
+++ b/webrtc/modules/audio_processing/test/audio_buffer_tools.h
@@ -12,9 +12,9 @@
#define WEBRTC_MODULES_AUDIO_PROCESSING_TEST_AUDIO_BUFFER_TOOLS_H_
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/audio_buffer.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
-#include "webrtc/rtc_base/array_view.h"
namespace webrtc {
namespace test {
diff --git a/webrtc/modules/audio_processing/test/bitexactness_tools.cc b/webrtc/modules/audio_processing/test/bitexactness_tools.cc
index ae3d216..c5e4d38 100644
--- a/webrtc/modules/audio_processing/test/bitexactness_tools.cc
+++ b/webrtc/modules/audio_processing/test/bitexactness_tools.cc
@@ -15,7 +15,7 @@
#include <string>
#include <vector>
-#include "webrtc/rtc_base/array_view.h"
+#include "webrtc/api/array_view.h"
#include "webrtc/test/testsupport/fileutils.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/test/bitexactness_tools.h b/webrtc/modules/audio_processing/test/bitexactness_tools.h
index e4b863a..3a1722a 100644
--- a/webrtc/modules/audio_processing/test/bitexactness_tools.h
+++ b/webrtc/modules/audio_processing/test/bitexactness_tools.h
@@ -14,8 +14,8 @@
#include <string>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/test/gtest.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/test/conversational_speech/BUILD.gn b/webrtc/modules/audio_processing/test/conversational_speech/BUILD.gn
index 5c681a0..1f24c09 100644
--- a/webrtc/modules/audio_processing/test/conversational_speech/BUILD.gn
+++ b/webrtc/modules/audio_processing/test/conversational_speech/BUILD.gn
@@ -45,6 +45,7 @@
]
deps = [
"../../../..:webrtc_common",
+ "../../../../api:array_view",
"../../../../common_audio",
"../../../../rtc_base:rtc_base_approved",
]
@@ -63,6 +64,7 @@
deps = [
":lib",
"../../../..:webrtc_common",
+ "../../../../api:array_view",
"../../../../common_audio",
"../../../../rtc_base:rtc_base_approved",
"../../../../test:test_support",
diff --git a/webrtc/modules/audio_processing/test/conversational_speech/mock_wavreader.h b/webrtc/modules/audio_processing/test/conversational_speech/mock_wavreader.h
index a49ba2c..8e86f4d 100644
--- a/webrtc/modules/audio_processing/test/conversational_speech/mock_wavreader.h
+++ b/webrtc/modules/audio_processing/test/conversational_speech/mock_wavreader.h
@@ -14,8 +14,8 @@
#include <cstddef>
#include <string>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/test/conversational_speech/wavreader_interface.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/test/gmock.h"
#include "webrtc/typedefs.h"
diff --git a/webrtc/modules/audio_processing/test/conversational_speech/multiend_call.h b/webrtc/modules/audio_processing/test/conversational_speech/multiend_call.h
index b28dc9b..38cc0e2 100644
--- a/webrtc/modules/audio_processing/test/conversational_speech/multiend_call.h
+++ b/webrtc/modules/audio_processing/test/conversational_speech/multiend_call.h
@@ -19,10 +19,10 @@
#include <utility>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/test/conversational_speech/timing.h"
#include "webrtc/modules/audio_processing/test/conversational_speech/wavreader_abstract_factory.h"
#include "webrtc/modules/audio_processing/test/conversational_speech/wavreader_interface.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/constructormagic.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/test/conversational_speech/simulator.cc b/webrtc/modules/audio_processing/test/conversational_speech/simulator.cc
index cb4bcfa..709dec3 100644
--- a/webrtc/modules/audio_processing/test/conversational_speech/simulator.cc
+++ b/webrtc/modules/audio_processing/test/conversational_speech/simulator.cc
@@ -14,9 +14,9 @@
#include <utility>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/common_audio/wav_file.h"
#include "webrtc/modules/audio_processing/test/conversational_speech/wavreader_interface.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/logging.h"
#include "webrtc/rtc_base/pathutils.h"
diff --git a/webrtc/modules/audio_processing/test/conversational_speech/timing.h b/webrtc/modules/audio_processing/test/conversational_speech/timing.h
index 43a533c..62ed1cb 100644
--- a/webrtc/modules/audio_processing/test/conversational_speech/timing.h
+++ b/webrtc/modules/audio_processing/test/conversational_speech/timing.h
@@ -14,7 +14,7 @@
#include <string>
#include <vector>
-#include "webrtc/rtc_base/array_view.h"
+#include "webrtc/api/array_view.h"
namespace webrtc {
namespace test {
diff --git a/webrtc/modules/audio_processing/test/conversational_speech/wavreader_factory.cc b/webrtc/modules/audio_processing/test/conversational_speech/wavreader_factory.cc
index 85ab76d..c2f87a8 100644
--- a/webrtc/modules/audio_processing/test/conversational_speech/wavreader_factory.cc
+++ b/webrtc/modules/audio_processing/test/conversational_speech/wavreader_factory.cc
@@ -12,8 +12,8 @@
#include <cstddef>
+#include "webrtc/api/array_view.h"
#include "webrtc/common_audio/wav_file.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/checks.h"
#include "webrtc/typedefs.h"
diff --git a/webrtc/modules/audio_processing/test/conversational_speech/wavreader_interface.h b/webrtc/modules/audio_processing/test/conversational_speech/wavreader_interface.h
index 1d1459f..74dae400 100644
--- a/webrtc/modules/audio_processing/test/conversational_speech/wavreader_interface.h
+++ b/webrtc/modules/audio_processing/test/conversational_speech/wavreader_interface.h
@@ -13,7 +13,7 @@
#include <stddef.h>
-#include "webrtc/rtc_base/array_view.h"
+#include "webrtc/api/array_view.h"
#include "webrtc/typedefs.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_processing/test/echo_canceller_test_tools.h b/webrtc/modules/audio_processing/test/echo_canceller_test_tools.h
index 27f75ac..1acfeac 100644
--- a/webrtc/modules/audio_processing/test/echo_canceller_test_tools.h
+++ b/webrtc/modules/audio_processing/test/echo_canceller_test_tools.h
@@ -14,7 +14,7 @@
#include <algorithm>
#include <vector>
-#include "webrtc/rtc_base/array_view.h"
+#include "webrtc/api/array_view.h"
#include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/random.h"
diff --git a/webrtc/modules/audio_processing/test/echo_canceller_test_tools_unittest.cc b/webrtc/modules/audio_processing/test/echo_canceller_test_tools_unittest.cc
index aaef88d..0f28327 100644
--- a/webrtc/modules/audio_processing/test/echo_canceller_test_tools_unittest.cc
+++ b/webrtc/modules/audio_processing/test/echo_canceller_test_tools_unittest.cc
@@ -12,7 +12,7 @@
#include <vector>
-#include "webrtc/rtc_base/array_view.h"
+#include "webrtc/api/array_view.h"
#include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/random.h"
#include "webrtc/test/gtest.h"
diff --git a/webrtc/modules/audio_processing/voice_detection_unittest.cc b/webrtc/modules/audio_processing/voice_detection_unittest.cc
index 32a4da5..c4ccd82 100644
--- a/webrtc/modules/audio_processing/voice_detection_unittest.cc
+++ b/webrtc/modules/audio_processing/voice_detection_unittest.cc
@@ -9,11 +9,11 @@
*/
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_processing/audio_buffer.h"
#include "webrtc/modules/audio_processing/test/audio_buffer_tools.h"
#include "webrtc/modules/audio_processing/test/bitexactness_tools.h"
#include "webrtc/modules/audio_processing/voice_detection_impl.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/test/gtest.h"
namespace webrtc {
diff --git a/webrtc/modules/rtp_rtcp/BUILD.gn b/webrtc/modules/rtp_rtcp/BUILD.gn
index 07ac7ae..8d17d1a 100644
--- a/webrtc/modules/rtp_rtcp/BUILD.gn
+++ b/webrtc/modules/rtp_rtcp/BUILD.gn
@@ -167,6 +167,7 @@
deps = [
"..:module_api",
"../..:webrtc_common",
+ "../../api:array_view",
"../../api:libjingle_peerconnection_api",
"../../api:transport_api",
"../../api/audio_codecs:audio_codecs_api",
@@ -341,6 +342,7 @@
":rtp_rtcp",
"..:module_api",
"../..:webrtc_common",
+ "../../api:array_view",
"../../api:libjingle_peerconnection_api",
"../../api:transport_api",
"../../common_video:common_video",
diff --git a/webrtc/modules/rtp_rtcp/include/flexfec_sender.h b/webrtc/modules/rtp_rtcp/include/flexfec_sender.h
index 82a01cc..9404f78 100644
--- a/webrtc/modules/rtp_rtcp/include/flexfec_sender.h
+++ b/webrtc/modules/rtp_rtcp/include/flexfec_sender.h
@@ -14,6 +14,7 @@
#include <memory>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/api/rtpparameters.h"
#include "webrtc/modules/include/module_common_types.h"
#include "webrtc/modules/rtp_rtcp/include/flexfec_sender.h"
@@ -21,7 +22,6 @@
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h"
#include "webrtc/modules/rtp_rtcp/source/ulpfec_generator.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/basictypes.h"
#include "webrtc/rtc_base/random.h"
#include "webrtc/system_wrappers/include/clock.h"
diff --git a/webrtc/modules/rtp_rtcp/include/rtp_header_extension_map.h b/webrtc/modules/rtp_rtcp/include/rtp_header_extension_map.h
index 93cbd10..dcb48b6 100644
--- a/webrtc/modules/rtp_rtcp/include/rtp_header_extension_map.h
+++ b/webrtc/modules/rtp_rtcp/include/rtp_header_extension_map.h
@@ -13,9 +13,9 @@
#include <string>
+#include "webrtc/api/array_view.h"
#include "webrtc/api/rtpparameters.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/basictypes.h"
#include "webrtc/rtc_base/checks.h"
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc
index d42a74e..50585e2 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc
@@ -10,6 +10,7 @@
#include <memory>
+#include "webrtc/api/array_view.h"
#include "webrtc/common_types.h"
#include "webrtc/common_video/include/video_bitrate_allocator.h"
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
@@ -31,7 +32,6 @@
#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
#include "webrtc/modules/rtp_rtcp/source/rtcp_receiver.h"
#include "webrtc/modules/rtp_rtcp/source/time_util.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/arraysize.h"
#include "webrtc/rtc_base/random.h"
#include "webrtc/system_wrappers/include/ntp_time.h"
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_format_h264_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtp_format_h264_unittest.cc
index ec486c0..047b4a3 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_format_h264_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_format_h264_unittest.cc
@@ -11,13 +11,13 @@
#include <memory>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/common_video/h264/h264_common.h"
#include "webrtc/modules/include/module_common_types.h"
#include "webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h"
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_format.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/test/gmock.h"
#include "webrtc/test/gtest.h"
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_format_video_generic_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtp_format_video_generic_unittest.cc
index 91ad001..78ee435 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_format_video_generic_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_format_video_generic_unittest.cc
@@ -13,12 +13,12 @@
#include <memory>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/include/module_common_types.h"
#include "webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h"
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_format_video_generic.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/test/gmock.h"
#include "webrtc/test/gtest.h"
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h b/webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h
index dc63140..866dc28 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h
+++ b/webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h
@@ -13,11 +13,11 @@
#include <stdint.h>
#include <string>
+#include "webrtc/api/array_view.h"
#include "webrtc/api/video/video_content_type.h"
#include "webrtc/api/video/video_rotation.h"
#include "webrtc/api/video/video_timing.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
-#include "webrtc/rtc_base/array_view.h"
namespace webrtc {
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_packet.h b/webrtc/modules/rtp_rtcp/source/rtp_packet.h
index 47aaf57..8797417 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_packet.h
+++ b/webrtc/modules/rtp_rtcp/source/rtp_packet.h
@@ -12,8 +12,8 @@
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/basictypes.h"
#include "webrtc/rtc_base/copyonwritebuffer.h"
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender.h b/webrtc/modules/rtp_rtcp/source/rtp_sender.h
index 9ab3e33..069357f 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_sender.h
+++ b/webrtc/modules/rtp_rtcp/source/rtp_sender.h
@@ -16,6 +16,7 @@
#include <utility>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/api/call/transport.h"
#include "webrtc/common_types.h"
#include "webrtc/modules/rtp_rtcp/include/flexfec_sender.h"
@@ -25,7 +26,6 @@
#include "webrtc/modules/rtp_rtcp/source/rtp_packet_history.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/criticalsection.h"
#include "webrtc/rtc_base/deprecation.h"
diff --git a/webrtc/pc/BUILD.gn b/webrtc/pc/BUILD.gn
index 71e29d8..6473cf6 100644
--- a/webrtc/pc/BUILD.gn
+++ b/webrtc/pc/BUILD.gn
@@ -284,6 +284,7 @@
deps = [
":libjingle_peerconnection",
":rtc_pc",
+ "../api:array_view",
"../logging:rtc_event_log_api",
"../media:rtc_media_base",
"../media:rtc_media_tests_utils",
diff --git a/webrtc/pc/channel_unittest.cc b/webrtc/pc/channel_unittest.cc
index ae34a12..5279683 100644
--- a/webrtc/pc/channel_unittest.cc
+++ b/webrtc/pc/channel_unittest.cc
@@ -10,6 +10,7 @@
#include <memory>
+#include "webrtc/api/array_view.h"
#include "webrtc/media/base/fakemediaengine.h"
#include "webrtc/media/base/fakertp.h"
#include "webrtc/media/base/mediachannel.h"
@@ -18,7 +19,6 @@
#include "webrtc/p2p/base/fakedtlstransport.h"
#include "webrtc/p2p/base/fakepackettransport.h"
#include "webrtc/pc/channel.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/buffer.h"
#include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/fakeclock.h"
diff --git a/webrtc/rtc_base/BUILD.gn b/webrtc/rtc_base/BUILD.gn
index 03e8ea6..1914b27 100644
--- a/webrtc/rtc_base/BUILD.gn
+++ b/webrtc/rtc_base/BUILD.gn
@@ -835,7 +835,6 @@
#visibility = [ "..:rtc_unittests" ]
}
sources = [
- "array_view_unittest.cc",
"atomicops_unittest.cc",
"base64_unittest.cc",
"basictypes_unittest.cc",
@@ -883,6 +882,7 @@
":rtc_base_tests_main",
":rtc_base_tests_utils",
":rtc_task_queue",
+ "../api:array_view",
"../system_wrappers:system_wrappers",
"../test:test_support",
]
diff --git a/webrtc/rtc_base/array_view.h b/webrtc/rtc_base/array_view.h
index afc6999..23c7b5b 100644
--- a/webrtc/rtc_base/array_view.h
+++ b/webrtc/rtc_base/array_view.h
@@ -8,246 +8,12 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+// This header is for backwards compatibility only, and will be removed soon.
+// Include webrtc/api/array_view.h instead.
+
#ifndef WEBRTC_RTC_BASE_ARRAY_VIEW_H_
#define WEBRTC_RTC_BASE_ARRAY_VIEW_H_
-#include "webrtc/rtc_base/checks.h"
-#include "webrtc/rtc_base/type_traits.h"
-
-namespace rtc {
-
-// Many functions read from or write to arrays. The obvious way to do this is
-// to use two arguments, a pointer to the first element and an element count:
-//
-// bool Contains17(const int* arr, size_t size) {
-// for (size_t i = 0; i < size; ++i) {
-// if (arr[i] == 17)
-// return true;
-// }
-// return false;
-// }
-//
-// This is flexible, since it doesn't matter how the array is stored (C array,
-// std::vector, rtc::Buffer, ...), but it's error-prone because the caller has
-// to correctly specify the array length:
-//
-// Contains17(arr, arraysize(arr)); // C array
-// Contains17(arr.data(), arr.size()); // std::vector
-// Contains17(arr, size); // pointer + size
-// ...
-//
-// It's also kind of messy to have two separate arguments for what is
-// conceptually a single thing.
-//
-// Enter rtc::ArrayView<T>. It contains a T pointer (to an array it doesn't
-// own) and a count, and supports the basic things you'd expect, such as
-// indexing and iteration. It allows us to write our function like this:
-//
-// bool Contains17(rtc::ArrayView<const int> arr) {
-// for (auto e : arr) {
-// if (e == 17)
-// return true;
-// }
-// return false;
-// }
-//
-// And even better, because a bunch of things will implicitly convert to
-// ArrayView, we can call it like this:
-//
-// Contains17(arr); // C array
-// Contains17(arr); // std::vector
-// Contains17(rtc::ArrayView<int>(arr, size)); // pointer + size
-// Contains17(nullptr); // nullptr -> empty ArrayView
-// ...
-//
-// ArrayView<T> stores both a pointer and a size, but you may also use
-// ArrayView<T, N>, which has a size that's fixed at compile time (which means
-// it only has to store the pointer).
-//
-// One important point is that ArrayView<T> and ArrayView<const T> are
-// different types, which allow and don't allow mutation of the array elements,
-// respectively. The implicit conversions work just like you'd hope, so that
-// e.g. vector<int> will convert to either ArrayView<int> or ArrayView<const
-// int>, but const vector<int> will convert only to ArrayView<const int>.
-// (ArrayView itself can be the source type in such conversions, so
-// ArrayView<int> will convert to ArrayView<const int>.)
-//
-// Note: ArrayView is tiny (just a pointer and a count if variable-sized, just
-// a pointer if fix-sized) and trivially copyable, so it's probably cheaper to
-// pass it by value than by const reference.
-
-namespace impl {
-
-// Magic constant for indicating that the size of an ArrayView is variable
-// instead of fixed.
-enum : std::ptrdiff_t { kArrayViewVarSize = -4711 };
-
-// Base class for ArrayViews of fixed nonzero size.
-template <typename T, std::ptrdiff_t Size>
-class ArrayViewBase {
- static_assert(Size > 0, "ArrayView size must be variable or non-negative");
-
- public:
- ArrayViewBase(T* data, size_t size) : data_(data) {}
-
- static constexpr size_t size() { return Size; }
- static constexpr bool empty() { return false; }
- T* data() const { return data_; }
-
- protected:
- static constexpr bool fixed_size() { return true; }
-
- private:
- T* data_;
-};
-
-// Specialized base class for ArrayViews of fixed zero size.
-template <typename T>
-class ArrayViewBase<T, 0> {
- public:
- explicit ArrayViewBase(T* data, size_t size) {}
-
- static constexpr size_t size() { return 0; }
- static constexpr bool empty() { return true; }
- T* data() const { return nullptr; }
-
- protected:
- static constexpr bool fixed_size() { return true; }
-};
-
-// Specialized base class for ArrayViews of variable size.
-template <typename T>
-class ArrayViewBase<T, impl::kArrayViewVarSize> {
- public:
- ArrayViewBase(T* data, size_t size)
- : data_(size == 0 ? nullptr : data), size_(size) {}
-
- size_t size() const { return size_; }
- bool empty() const { return size_ == 0; }
- T* data() const { return data_; }
-
- protected:
- static constexpr bool fixed_size() { return false; }
-
- private:
- T* data_;
- size_t size_;
-};
-
-} // namespace impl
-
-template <typename T, std::ptrdiff_t Size = impl::kArrayViewVarSize>
-class ArrayView final : public impl::ArrayViewBase<T, Size> {
- public:
- using value_type = T;
- using const_iterator = const T*;
-
- // Construct an ArrayView from a pointer and a length.
- template <typename U>
- ArrayView(U* data, size_t size)
- : impl::ArrayViewBase<T, Size>::ArrayViewBase(data, size) {
- RTC_DCHECK_EQ(size == 0 ? nullptr : data, this->data());
- RTC_DCHECK_EQ(size, this->size());
- RTC_DCHECK_EQ(!this->data(),
- this->size() == 0); // data is null iff size == 0.
- }
-
- // Construct an empty ArrayView. Note that fixed-size ArrayViews of size > 0
- // cannot be empty.
- ArrayView() : ArrayView(nullptr, 0) {}
- ArrayView(std::nullptr_t) : ArrayView() {}
- ArrayView(std::nullptr_t, size_t size)
- : ArrayView(static_cast<T*>(nullptr), size) {
- static_assert(Size == 0 || Size == impl::kArrayViewVarSize, "");
- RTC_DCHECK_EQ(0, size);
- }
-
- // Construct an ArrayView from an array.
- template <typename U, size_t N>
- ArrayView(U (&array)[N]) : ArrayView(array, N) {
- static_assert(Size == N || Size == impl::kArrayViewVarSize,
- "Array size must match ArrayView size");
- }
-
- // (Only if size is fixed.) Construct an ArrayView from any type U that has a
- // static constexpr size() method whose return value is equal to Size, and a
- // data() method whose return value converts implicitly to T*. In particular,
- // this means we allow conversion from ArrayView<T, N> to ArrayView<const T,
- // N>, but not the other way around. We also don't allow conversion from
- // ArrayView<T> to ArrayView<T, N>, or from ArrayView<T, M> to ArrayView<T,
- // N> when M != N.
- template <typename U,
- typename std::enable_if<
- Size != impl::kArrayViewVarSize &&
- HasDataAndSize<U, T>::value>::type* = nullptr>
- ArrayView(U& u) : ArrayView(u.data(), u.size()) {
- static_assert(U::size() == Size, "Sizes must match exactly");
- }
-
- // (Only if size is variable.) Construct an ArrayView from any type U that
- // has a size() method whose return value converts implicitly to size_t, and
- // a data() method whose return value converts implicitly to T*. In
- // particular, this means we allow conversion from ArrayView<T> to
- // ArrayView<const T>, but not the other way around. Other allowed
- // conversions include
- // ArrayView<T, N> to ArrayView<T> or ArrayView<const T>,
- // std::vector<T> to ArrayView<T> or ArrayView<const T>,
- // const std::vector<T> to ArrayView<const T>,
- // rtc::Buffer to ArrayView<uint8_t> or ArrayView<const uint8_t>, and
- // const rtc::Buffer to ArrayView<const uint8_t>.
- template <
- typename U,
- typename std::enable_if<Size == impl::kArrayViewVarSize &&
- HasDataAndSize<U, T>::value>::type* = nullptr>
- ArrayView(U& u) : ArrayView(u.data(), u.size()) {}
-
- // Indexing and iteration. These allow mutation even if the ArrayView is
- // const, because the ArrayView doesn't own the array. (To prevent mutation,
- // use a const element type.)
- T& operator[](size_t idx) const {
- RTC_DCHECK_LT(idx, this->size());
- RTC_DCHECK(this->data());
- return this->data()[idx];
- }
- T* begin() const { return this->data(); }
- T* end() const { return this->data() + this->size(); }
- const T* cbegin() const { return this->data(); }
- const T* cend() const { return this->data() + this->size(); }
-
- ArrayView<T> subview(size_t offset, size_t size) const {
- return offset < this->size()
- ? ArrayView<T>(this->data() + offset,
- std::min(size, this->size() - offset))
- : ArrayView<T>();
- }
- ArrayView<T> subview(size_t offset) const {
- return subview(offset, this->size());
- }
-};
-
-// Comparing two ArrayViews compares their (pointer,size) pairs; it does *not*
-// dereference the pointers.
-template <typename T, std::ptrdiff_t Size1, std::ptrdiff_t Size2>
-bool operator==(const ArrayView<T, Size1>& a, const ArrayView<T, Size2>& b) {
- return a.data() == b.data() && a.size() == b.size();
-}
-template <typename T, std::ptrdiff_t Size1, std::ptrdiff_t Size2>
-bool operator!=(const ArrayView<T, Size1>& a, const ArrayView<T, Size2>& b) {
- return !(a == b);
-}
-
-// Variable-size ArrayViews are the size of two pointers; fixed-size ArrayViews
-// are the size of one pointer. (And as a special case, fixed-size ArrayViews
-// of size 0 require no storage.)
-static_assert(sizeof(ArrayView<int>) == 2 * sizeof(int*), "");
-static_assert(sizeof(ArrayView<int, 17>) == sizeof(int*), "");
-static_assert(std::is_empty<ArrayView<int, 0>>::value, "");
-
-template <typename T>
-inline ArrayView<T> MakeArrayView(T* data, size_t size) {
- return ArrayView<T>(data, size);
-}
-
-} // namespace rtc
+#include "webrtc/api/array_view.h"
#endif // WEBRTC_RTC_BASE_ARRAY_VIEW_H_
diff --git a/webrtc/rtc_base/buffer.h b/webrtc/rtc_base/buffer.h
index 25d55e0..b8fe98c 100644
--- a/webrtc/rtc_base/buffer.h
+++ b/webrtc/rtc_base/buffer.h
@@ -17,7 +17,7 @@
#include <type_traits>
#include <utility>
-#include "webrtc/rtc_base/array_view.h"
+#include "webrtc/api/array_view.h"
#include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/type_traits.h"
diff --git a/webrtc/rtc_base/buffer_unittest.cc b/webrtc/rtc_base/buffer_unittest.cc
index bd4306e..7bf1b5b 100644
--- a/webrtc/rtc_base/buffer_unittest.cc
+++ b/webrtc/rtc_base/buffer_unittest.cc
@@ -10,7 +10,7 @@
#include "webrtc/rtc_base/buffer.h"
-#include "webrtc/rtc_base/array_view.h"
+#include "webrtc/api/array_view.h"
#include "webrtc/rtc_base/gunit.h"
#include <type_traits>
diff --git a/webrtc/rtc_base/optional.h b/webrtc/rtc_base/optional.h
index 6871f3d..ca3208e 100644
--- a/webrtc/rtc_base/optional.h
+++ b/webrtc/rtc_base/optional.h
@@ -20,7 +20,7 @@
#include <ostream>
#endif // UNIT_TEST
-#include "webrtc/rtc_base/array_view.h"
+#include "webrtc/api/array_view.h"
#include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/sanitizer.h"
diff --git a/webrtc/test/BUILD.gn b/webrtc/test/BUILD.gn
index 2a49019..4faff71 100644
--- a/webrtc/test/BUILD.gn
+++ b/webrtc/test/BUILD.gn
@@ -89,6 +89,7 @@
deps = [
"..:webrtc_common",
+ "../api:array_view",
"../modules/rtp_rtcp",
"../rtc_base:rtc_base_approved",
"//testing/gtest",
@@ -488,6 +489,7 @@
}
deps = [
"..:webrtc_common",
+ "../api:array_view",
"../common_audio:common_audio",
"../modules/audio_device:audio_device",
"../rtc_base:rtc_base_approved",
@@ -695,6 +697,7 @@
deps = [
":test_support",
+ "../api:array_view",
"../api/audio_codecs:audio_codecs_api",
"../api/audio_codecs:builtin_audio_decoder_factory",
"../rtc_base:rtc_base_approved",
diff --git a/webrtc/test/fake_audio_device.h b/webrtc/test/fake_audio_device.h
index 8b15cd7..db56c74 100644
--- a/webrtc/test/fake_audio_device.h
+++ b/webrtc/test/fake_audio_device.h
@@ -14,8 +14,8 @@
#include <string>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_device/include/fake_audio_device.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/buffer.h"
#include "webrtc/rtc_base/criticalsection.h"
#include "webrtc/rtc_base/event.h"
diff --git a/webrtc/test/fuzzers/BUILD.gn b/webrtc/test/fuzzers/BUILD.gn
index 9453ce4..e9d771c 100644
--- a/webrtc/test/fuzzers/BUILD.gn
+++ b/webrtc/test/fuzzers/BUILD.gn
@@ -287,6 +287,7 @@
"neteq_rtp_fuzzer.cc",
]
deps = [
+ "../../api:array_view",
"../../modules/audio_coding:neteq",
"../../modules/audio_coding:neteq_test_tools",
"../../modules/audio_coding:neteq_tools_minimal",
@@ -354,6 +355,7 @@
"transport_feedback_packet_loss_tracker_fuzzer.cc",
]
deps = [
+ "../../api:array_view",
"../../modules/rtp_rtcp",
"../../rtc_base:rtc_base_approved",
"../../voice_engine",
diff --git a/webrtc/test/fuzzers/neteq_rtp_fuzzer.cc b/webrtc/test/fuzzers/neteq_rtp_fuzzer.cc
index 1a2bfc4..5eba72c 100644
--- a/webrtc/test/fuzzers/neteq_rtp_fuzzer.cc
+++ b/webrtc/test/fuzzers/neteq_rtp_fuzzer.cc
@@ -12,12 +12,12 @@
#include <memory>
#include <vector>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/audio_coding/codecs/pcm16b/audio_encoder_pcm16b.h"
#include "webrtc/modules/audio_coding/neteq/tools/audio_checksum.h"
#include "webrtc/modules/audio_coding/neteq/tools/encode_neteq_input.h"
#include "webrtc/modules/audio_coding/neteq/tools/neteq_test.h"
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
-#include "webrtc/rtc_base/array_view.h"
namespace webrtc {
namespace test {
diff --git a/webrtc/test/fuzzers/transport_feedback_packet_loss_tracker_fuzzer.cc b/webrtc/test/fuzzers/transport_feedback_packet_loss_tracker_fuzzer.cc
index 2e532d1..bfd03fa 100644
--- a/webrtc/test/fuzzers/transport_feedback_packet_loss_tracker_fuzzer.cc
+++ b/webrtc/test/fuzzers/transport_feedback_packet_loss_tracker_fuzzer.cc
@@ -10,10 +10,10 @@
#include <algorithm>
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/voice_engine/transport_feedback_packet_loss_tracker.h"
namespace webrtc {
diff --git a/webrtc/test/mock_audio_encoder.h b/webrtc/test/mock_audio_encoder.h
index 90e2b9d..c30b35e 100644
--- a/webrtc/test/mock_audio_encoder.h
+++ b/webrtc/test/mock_audio_encoder.h
@@ -13,8 +13,8 @@
#include <string>
+#include "webrtc/api/array_view.h"
#include "webrtc/api/audio_codecs/audio_encoder.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/test/gmock.h"
namespace webrtc {
diff --git a/webrtc/test/rtcp_packet_parser.h b/webrtc/test/rtcp_packet_parser.h
index 4bc5477..997c343 100644
--- a/webrtc/test/rtcp_packet_parser.h
+++ b/webrtc/test/rtcp_packet_parser.h
@@ -12,6 +12,7 @@
#ifndef WEBRTC_TEST_RTCP_PACKET_PARSER_H_
#define WEBRTC_TEST_RTCP_PACKET_PARSER_H_
+#include "webrtc/api/array_view.h"
#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h"
#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h"
#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h"
@@ -28,7 +29,6 @@
#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h"
#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h"
#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/checks.h"
namespace webrtc {
diff --git a/webrtc/voice_engine/BUILD.gn b/webrtc/voice_engine/BUILD.gn
index 984d149..9862579 100644
--- a/webrtc/voice_engine/BUILD.gn
+++ b/webrtc/voice_engine/BUILD.gn
@@ -135,6 +135,7 @@
":file_player",
":file_recorder",
"..:webrtc_common",
+ "../api:array_view",
"../api:audio_mixer_api",
"../api:call_api",
"../api:libjingle_peerconnection_api",
diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc
index 039d935..1a56e81 100644
--- a/webrtc/voice_engine/channel.cc
+++ b/webrtc/voice_engine/channel.cc
@@ -13,6 +13,7 @@
#include <algorithm>
#include <utility>
+#include "webrtc/api/array_view.h"
#include "webrtc/audio/utility/audio_frame_operations.h"
#include "webrtc/call/rtp_transport_controller_send_interface.h"
#include "webrtc/logging/rtc_event_log/rtc_event_log.h"
@@ -27,7 +28,6 @@
#include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h"
#include "webrtc/modules/utility/include/process_thread.h"
-#include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/criticalsection.h"
#include "webrtc/rtc_base/format_macros.h"