diff --git a/api/BUILD.gn b/api/BUILD.gn index b7ff32ba4c..7b0dc09b9c 100644 --- a/api/BUILD.gn +++ b/api/BUILD.gn @@ -293,7 +293,7 @@ rtc_source_set("video_frame_api_i420") { ":video_frame_api", "../rtc_base:checks", "../rtc_base:rtc_base", - "../system_wrappers", + "../rtc_base/memory:aligned_malloc", "//third_party/libyuv", ] } diff --git a/api/DEPS b/api/DEPS index ba5d62356a..d7f00eb51f 100644 --- a/api/DEPS +++ b/api/DEPS @@ -24,8 +24,4 @@ specific_include_rules = { "+modules/audio_coding", "+modules/audio_processing", ], - - ".*i420_buffer\.h": [ - "+system_wrappers/include/aligned_malloc.h", - ], } diff --git a/api/video/i420_buffer.h b/api/video/i420_buffer.h index bdac80bbc1..2bd37bd422 100644 --- a/api/video/i420_buffer.h +++ b/api/video/i420_buffer.h @@ -13,9 +13,9 @@ #include -#include "api/video/video_rotation.h" #include "api/video/video_frame_buffer.h" -#include "system_wrappers/include/aligned_malloc.h" +#include "api/video/video_rotation.h" +#include "rtc_base/memory/aligned_malloc.h" namespace webrtc { diff --git a/common_audio/BUILD.gn b/common_audio/BUILD.gn index 1a3615b944..6aee9d05d7 100644 --- a/common_audio/BUILD.gn +++ b/common_audio/BUILD.gn @@ -68,6 +68,8 @@ rtc_static_library("common_audio") { "../rtc_base:checks", "../rtc_base:gtest_prod", "../rtc_base:rtc_base_approved", + "../rtc_base/memory:aligned_array", + "../rtc_base/memory:aligned_malloc", "../system_wrappers", "../system_wrappers:cpu_features_api", ] @@ -259,6 +261,7 @@ rtc_source_set("sinc_resampler") { "../:typedefs", "../rtc_base:gtest_prod", "../rtc_base:rtc_base_approved", + "../rtc_base/memory:aligned_malloc", "../system_wrappers", ] } @@ -313,7 +316,7 @@ if (current_cpu == "x86" || current_cpu == "x64") { ":sinc_resampler", "../rtc_base:checks", "../rtc_base:rtc_base_approved", - "../system_wrappers", + "../rtc_base/memory:aligned_malloc", ] } } @@ -354,7 +357,7 @@ if (rtc_build_with_neon) { ":sinc_resampler", "../rtc_base:checks", "../rtc_base:rtc_base_approved", - "../system_wrappers", + "../rtc_base/memory:aligned_malloc", ] } diff --git a/common_audio/fir_filter_neon.cc b/common_audio/fir_filter_neon.cc index d9f91b7600..e27f21b28c 100644 --- a/common_audio/fir_filter_neon.cc +++ b/common_audio/fir_filter_neon.cc @@ -14,7 +14,7 @@ #include #include "rtc_base/checks.h" -#include "system_wrappers/include/aligned_malloc.h" +#include "rtc_base/memory/aligned_malloc.h" namespace webrtc { diff --git a/common_audio/fir_filter_neon.h b/common_audio/fir_filter_neon.h index 5696df8f0e..1ffefd80dc 100644 --- a/common_audio/fir_filter_neon.h +++ b/common_audio/fir_filter_neon.h @@ -14,7 +14,7 @@ #include #include "common_audio/fir_filter.h" -#include "system_wrappers/include/aligned_malloc.h" +#include "rtc_base/memory/aligned_malloc.h" namespace webrtc { diff --git a/common_audio/fir_filter_sse.cc b/common_audio/fir_filter_sse.cc index 3302d56491..0da23fcbb3 100644 --- a/common_audio/fir_filter_sse.cc +++ b/common_audio/fir_filter_sse.cc @@ -15,7 +15,7 @@ #include #include "rtc_base/checks.h" -#include "system_wrappers/include/aligned_malloc.h" +#include "rtc_base/memory/aligned_malloc.h" namespace webrtc { diff --git a/common_audio/fir_filter_sse.h b/common_audio/fir_filter_sse.h index 6506024aff..7707f933d9 100644 --- a/common_audio/fir_filter_sse.h +++ b/common_audio/fir_filter_sse.h @@ -14,7 +14,7 @@ #include #include "common_audio/fir_filter.h" -#include "system_wrappers/include/aligned_malloc.h" +#include "rtc_base/memory/aligned_malloc.h" namespace webrtc { diff --git a/common_audio/lapped_transform.h b/common_audio/lapped_transform.h index fe3a8cd8c8..c97cd1684c 100644 --- a/common_audio/lapped_transform.h +++ b/common_audio/lapped_transform.h @@ -16,7 +16,7 @@ #include "common_audio/blocker.h" #include "common_audio/real_fourier.h" -#include "system_wrappers/include/aligned_array.h" +#include "rtc_base/memory/aligned_array.h" namespace webrtc { diff --git a/common_audio/real_fourier.h b/common_audio/real_fourier.h index 4c69c3c768..d16149b365 100644 --- a/common_audio/real_fourier.h +++ b/common_audio/real_fourier.h @@ -14,7 +14,7 @@ #include #include -#include "system_wrappers/include/aligned_malloc.h" +#include "rtc_base/memory/aligned_malloc.h" // Uniform interface class for the real DFT and its inverse, for power-of-2 // input lengths. Also contains helper functions for buffer allocation, taking diff --git a/common_audio/resampler/sinc_resampler.h b/common_audio/resampler/sinc_resampler.h index d011224055..774a9b74f0 100644 --- a/common_audio/resampler/sinc_resampler.h +++ b/common_audio/resampler/sinc_resampler.h @@ -18,7 +18,7 @@ #include "rtc_base/constructormagic.h" #include "rtc_base/gtest_prod_util.h" -#include "system_wrappers/include/aligned_malloc.h" +#include "rtc_base/memory/aligned_malloc.h" #include "typedefs.h" // NOLINT(build/include) namespace webrtc { diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn index 11dacabcb8..eb02ffb97a 100644 --- a/rtc_base/BUILD.gn +++ b/rtc_base/BUILD.gn @@ -1228,6 +1228,7 @@ if (rtc_include_tests) { "../system_wrappers:system_wrappers", "../test:fileutils", "../test:test_support", + "memory:unittests", ] } diff --git a/rtc_base/memory/BUILD.gn b/rtc_base/memory/BUILD.gn new file mode 100644 index 0000000000..e24b8cee61 --- /dev/null +++ b/rtc_base/memory/BUILD.gn @@ -0,0 +1,47 @@ +# Copyright (c) 2018 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. + +import("../../webrtc.gni") +if (is_android) { + import("//build/config/android/config.gni") + import("//build/config/android/rules.gni") +} + +rtc_source_set("aligned_array") { + sources = [ + "aligned_array.h", + ] + deps = [ + ":aligned_malloc", + "..:checks", + ] +} + +rtc_source_set("aligned_malloc") { + sources = [ + "aligned_malloc.cc", + "aligned_malloc.h", + ] + deps = [ + "../..:typedefs", + ] +} + +rtc_source_set("unittests") { + testonly = true + sources = [ + "aligned_array_unittest.cc", + "aligned_malloc_unittest.cc", + ] + deps = [ + ":aligned_array", + ":aligned_malloc", + "../..:typedefs", + "../../test:test_support", + ] +} diff --git a/system_wrappers/include/aligned_array.h b/rtc_base/memory/aligned_array.h similarity index 89% rename from system_wrappers/include/aligned_array.h rename to rtc_base/memory/aligned_array.h index 793c785820..dcdef1267e 100644 --- a/system_wrappers/include/aligned_array.h +++ b/rtc_base/memory/aligned_array.h @@ -8,11 +8,11 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ALIGNED_ARRAY_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ALIGNED_ARRAY_ +#ifndef RTC_BASE_MEMORY_ALIGNED_ARRAY_H_ +#define RTC_BASE_MEMORY_ALIGNED_ARRAY_H_ #include "rtc_base/checks.h" -#include "system_wrappers/include/aligned_malloc.h" +#include "rtc_base/memory/aligned_malloc.h" namespace webrtc { @@ -75,4 +75,4 @@ class AlignedArray { } // namespace webrtc -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ALIGNED_ARRAY_ +#endif // RTC_BASE_MEMORY_ALIGNED_ARRAY_H_ diff --git a/system_wrappers/source/aligned_array_unittest.cc b/rtc_base/memory/aligned_array_unittest.cc similarity index 96% rename from system_wrappers/source/aligned_array_unittest.cc rename to rtc_base/memory/aligned_array_unittest.cc index e5a3c18fcc..81fd468a92 100644 --- a/system_wrappers/source/aligned_array_unittest.cc +++ b/rtc_base/memory/aligned_array_unittest.cc @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "system_wrappers/include/aligned_array.h" +#include "rtc_base/memory/aligned_array.h" #include diff --git a/system_wrappers/source/aligned_malloc.cc b/rtc_base/memory/aligned_malloc.cc similarity index 98% rename from system_wrappers/source/aligned_malloc.cc rename to rtc_base/memory/aligned_malloc.cc index 43ece9e681..4e1e85c51f 100644 --- a/system_wrappers/source/aligned_malloc.cc +++ b/rtc_base/memory/aligned_malloc.cc @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "system_wrappers/include/aligned_malloc.h" +#include "rtc_base/memory/aligned_malloc.h" #include #include diff --git a/system_wrappers/include/aligned_malloc.h b/rtc_base/memory/aligned_malloc.h similarity index 92% rename from system_wrappers/include/aligned_malloc.h rename to rtc_base/memory/aligned_malloc.h index 33b23d2aec..42a6daaef6 100644 --- a/system_wrappers/include/aligned_malloc.h +++ b/rtc_base/memory/aligned_malloc.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef SYSTEM_WRAPPERS_INCLUDE_ALIGNED_MALLOC_H_ -#define SYSTEM_WRAPPERS_INCLUDE_ALIGNED_MALLOC_H_ +#ifndef RTC_BASE_MEMORY_ALIGNED_MALLOC_H_ +#define RTC_BASE_MEMORY_ALIGNED_MALLOC_H_ // The functions declared here // 1) Allocates block of aligned memory. @@ -54,4 +54,4 @@ struct AlignedFreeDeleter { } // namespace webrtc -#endif // SYSTEM_WRAPPERS_INCLUDE_ALIGNED_MALLOC_H_ +#endif // RTC_BASE_MEMORY_ALIGNED_MALLOC_H_ diff --git a/system_wrappers/source/aligned_malloc_unittest.cc b/rtc_base/memory/aligned_malloc_unittest.cc similarity index 97% rename from system_wrappers/source/aligned_malloc_unittest.cc rename to rtc_base/memory/aligned_malloc_unittest.cc index 7afbf6d1bb..742a77266f 100644 --- a/system_wrappers/source/aligned_malloc_unittest.cc +++ b/rtc_base/memory/aligned_malloc_unittest.cc @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "system_wrappers/include/aligned_malloc.h" +#include "rtc_base/memory/aligned_malloc.h" #include diff --git a/sdk/android/BUILD.gn b/sdk/android/BUILD.gn index a76e6b3e69..f004fa4f87 100644 --- a/sdk/android/BUILD.gn +++ b/sdk/android/BUILD.gn @@ -373,7 +373,7 @@ rtc_static_library("video_jni") { "../../rtc_base:rtc_task_queue", "../../rtc_base:sequenced_task_checker", "../../rtc_base:weak_ptr", - "../../system_wrappers", + "../../rtc_base/memory:aligned_malloc", "../../system_wrappers:field_trial_api", "//third_party/libyuv", ] diff --git a/sdk/android/src/jni/videoframe.cc b/sdk/android/src/jni/videoframe.cc index 22867e47c6..92e4a661f2 100644 --- a/sdk/android/src/jni/videoframe.cc +++ b/sdk/android/src/jni/videoframe.cc @@ -17,13 +17,13 @@ #include "rtc_base/checks.h" #include "rtc_base/keep_ref_until_done.h" #include "rtc_base/logging.h" +#include "rtc_base/memory/aligned_malloc.h" #include "rtc_base/scoped_ref_ptr.h" #include "rtc_base/timeutils.h" #include "sdk/android/generated_video_jni/jni/VideoFrame_jni.h" #include "sdk/android/src/jni/jni_helpers.h" #include "sdk/android/src/jni/surfacetexturehelper.h" #include "sdk/android/src/jni/wrapped_native_i420_buffer.h" -#include "system_wrappers/include/aligned_malloc.h" #include "third_party/libyuv/include/libyuv/scale.h" namespace webrtc { diff --git a/system_wrappers/BUILD.gn b/system_wrappers/BUILD.gn index 271cc2c8aa..9d339bec8c 100644 --- a/system_wrappers/BUILD.gn +++ b/system_wrappers/BUILD.gn @@ -15,8 +15,6 @@ import("../webrtc.gni") rtc_static_library("system_wrappers") { visibility = [ "*" ] sources = [ - "include/aligned_array.h", - "include/aligned_malloc.h", "include/clock.h", "include/cpu_info.h", "include/event_wrapper.h", @@ -26,7 +24,6 @@ rtc_static_library("system_wrappers") { "include/rw_lock_wrapper.h", "include/sleep.h", "include/timestamp_extrapolator.h", - "source/aligned_malloc.cc", "source/clock.cc", "source/cpu_features.cc", "source/cpu_info.cc", @@ -219,8 +216,6 @@ if (rtc_include_tests) { rtc_test("system_wrappers_unittests") { testonly = true sources = [ - "source/aligned_array_unittest.cc", - "source/aligned_malloc_unittest.cc", "source/clock_unittest.cc", "source/event_timer_posix_unittest.cc", "source/metrics_default_unittest.cc",