diff --git a/common_audio/BUILD.gn b/common_audio/BUILD.gn index 8f5ce83c68..a03e9ab659 100644 --- a/common_audio/BUILD.gn +++ b/common_audio/BUILD.gn @@ -54,7 +54,6 @@ rtc_library("common_audio") { "../rtc_base/system:arch", "../rtc_base/system:file_wrapper", "../system_wrappers", - "../system_wrappers:cpu_features_api", "third_party/ooura:fft_size_256", ] absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] @@ -185,7 +184,6 @@ rtc_library("common_audio_c") { "../rtc_base:sanitizer", "../rtc_base/system:arch", "../system_wrappers", - "../system_wrappers:cpu_features_api", "third_party/ooura:fft_size_256", "third_party/spl_sqrt_floor", ] @@ -232,7 +230,7 @@ rtc_library("fir_filter_factory") { "../rtc_base:checks", "../rtc_base:rtc_base_approved", "../rtc_base/system:arch", - "../system_wrappers:cpu_features_api", + "../system_wrappers", ] if (current_cpu == "x86" || current_cpu == "x64") { deps += [ ":common_audio_sse2" ] @@ -383,7 +381,7 @@ if (rtc_include_tests) { "../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_tests_utils", "../rtc_base/system:arch", - "../system_wrappers:cpu_features_api", + "../system_wrappers", "../test:fileutils", "../test:rtc_expect_death", "../test:test_main", diff --git a/common_audio/third_party/ooura/BUILD.gn b/common_audio/third_party/ooura/BUILD.gn index 742f620044..0cdf98e591 100644 --- a/common_audio/third_party/ooura/BUILD.gn +++ b/common_audio/third_party/ooura/BUILD.gn @@ -16,7 +16,7 @@ rtc_library("fft_size_128") { ] deps = [ "../../../rtc_base/system:arch", - "../../../system_wrappers:cpu_features_api", + "../../../system_wrappers", ] cflags = [] diff --git a/modules/audio_coding/BUILD.gn b/modules/audio_coding/BUILD.gn index be9705138a..55795397fe 100644 --- a/modules/audio_coding/BUILD.gn +++ b/modules/audio_coding/BUILD.gn @@ -609,7 +609,7 @@ rtc_library("isac_fix_c") { "../../rtc_base:compile_assert_c", "../../rtc_base:rtc_base_approved", "../../rtc_base:sanitizer", - "../../system_wrappers:cpu_features_api", + "../../system_wrappers", "../third_party/fft", ] @@ -2067,7 +2067,6 @@ if (rtc_include_tests) { "../../rtc_base/synchronization:mutex", "../../rtc_base/system:arch", "../../system_wrappers", - "../../system_wrappers:cpu_features_api", "../../test:audio_codec_mocks", "../../test:field_trial", "../../test:fileutils", diff --git a/modules/audio_processing/BUILD.gn b/modules/audio_processing/BUILD.gn index 1510930640..83fdcef960 100644 --- a/modules/audio_processing/BUILD.gn +++ b/modules/audio_processing/BUILD.gn @@ -189,7 +189,7 @@ rtc_library("audio_processing") { "../../rtc_base:sanitizer", "../../rtc_base/synchronization:mutex", "../../rtc_base/system:rtc_export", - "../../system_wrappers:cpu_features_api", + "../../system_wrappers", "../../system_wrappers:field_trial", "../../system_wrappers:metrics", "aec3", @@ -375,7 +375,6 @@ if (rtc_include_tests) { "../../rtc_base/system:arch", "../../rtc_base/system:file_wrapper", "../../system_wrappers", - "../../system_wrappers:cpu_features_api", "../../test:fileutils", "../../test:rtc_expect_death", "../../test:test_support", diff --git a/modules/audio_processing/aec3/BUILD.gn b/modules/audio_processing/aec3/BUILD.gn index c312b0ebd2..6816d739e8 100644 --- a/modules/audio_processing/aec3/BUILD.gn +++ b/modules/audio_processing/aec3/BUILD.gn @@ -142,7 +142,7 @@ rtc_library("aec3") { "../../../rtc_base:safe_minmax", "../../../rtc_base/experiments:field_trial_parser", "../../../rtc_base/system:arch", - "../../../system_wrappers:cpu_features_api", + "../../../system_wrappers", "../../../system_wrappers:field_trial", "../../../system_wrappers:metrics", "../utility:cascaded_biquad_filter", @@ -308,7 +308,7 @@ if (rtc_include_tests) { "../../../rtc_base:rtc_base_approved", "../../../rtc_base:safe_minmax", "../../../rtc_base/system:arch", - "../../../system_wrappers:cpu_features_api", + "../../../system_wrappers", "../../../test:field_trial", "../../../test:test_support", "../utility:cascaded_biquad_filter", diff --git a/modules/audio_processing/aecm/BUILD.gn b/modules/audio_processing/aecm/BUILD.gn index 6f1c33169a..61e9affdea 100644 --- a/modules/audio_processing/aecm/BUILD.gn +++ b/modules/audio_processing/aecm/BUILD.gn @@ -21,7 +21,7 @@ rtc_library("aecm_core") { "../../../rtc_base:checks", "../../../rtc_base:rtc_base_approved", "../../../rtc_base:sanitizer", - "../../../system_wrappers:cpu_features_api", + "../../../system_wrappers", "../utility:legacy_delay_estimator", ] cflags = [] diff --git a/modules/audio_processing/agc/BUILD.gn b/modules/audio_processing/agc/BUILD.gn index 9ed6399cbf..e5b3980abe 100644 --- a/modules/audio_processing/agc/BUILD.gn +++ b/modules/audio_processing/agc/BUILD.gn @@ -78,7 +78,7 @@ rtc_library("legacy_agc") { "../../../common_audio/third_party/ooura:fft_size_256", "../../../rtc_base:checks", "../../../rtc_base:rtc_base_approved", - "../../../system_wrappers:cpu_features_api", + "../../../system_wrappers", ] if (rtc_build_with_neon) { diff --git a/modules/audio_processing/agc2/BUILD.gn b/modules/audio_processing/agc2/BUILD.gn index bfef2252c3..ca2db9771d 100644 --- a/modules/audio_processing/agc2/BUILD.gn +++ b/modules/audio_processing/agc2/BUILD.gn @@ -153,7 +153,7 @@ rtc_library("noise_level_estimator") { "../../../common_audio/third_party/ooura:fft_size_128", "../../../rtc_base:checks", "../../../rtc_base:macromagic", - "../../../system_wrappers:cpu_features_api", + "../../../system_wrappers", ] configs += [ "..:apm_debug_dump" ] diff --git a/modules/audio_processing/agc2/rnn_vad/BUILD.gn b/modules/audio_processing/agc2/rnn_vad/BUILD.gn index 99b4e82488..3bdfdbcb39 100644 --- a/modules/audio_processing/agc2/rnn_vad/BUILD.gn +++ b/modules/audio_processing/agc2/rnn_vad/BUILD.gn @@ -48,7 +48,7 @@ rtc_library("rnn_vad") { "../../../../rtc_base:checks", "../../../../rtc_base:rtc_base_approved", "../../../../rtc_base/system:arch", - "../../../../system_wrappers:cpu_features_api", + "../../../../system_wrappers", "../../utility:pffft_wrapper", "//third_party/rnnoise:rnn_vad", ] @@ -67,7 +67,7 @@ if (rtc_include_tests) { "../../../../api:scoped_refptr", "../../../../rtc_base:checks", "../../../../rtc_base/system:arch", - "../../../../system_wrappers:cpu_features_api", + "../../../../system_wrappers", "../../../../test:fileutils", "../../../../test:test_support", ] diff --git a/modules/audio_processing/ns/BUILD.gn b/modules/audio_processing/ns/BUILD.gn index 7197705c3d..f0842c505b 100644 --- a/modules/audio_processing/ns/BUILD.gn +++ b/modules/audio_processing/ns/BUILD.gn @@ -60,7 +60,7 @@ rtc_static_library("ns") { "../../../rtc_base:rtc_base_approved", "../../../rtc_base:safe_minmax", "../../../rtc_base/system:arch", - "../../../system_wrappers:cpu_features_api", + "../../../system_wrappers", "../../../system_wrappers:field_trial", "../../../system_wrappers:metrics", "../utility:cascaded_biquad_filter", @@ -87,7 +87,7 @@ if (rtc_include_tests) { "../../../rtc_base:rtc_base_approved", "../../../rtc_base:safe_minmax", "../../../rtc_base/system:arch", - "../../../system_wrappers:cpu_features_api", + "../../../system_wrappers", "../../../test:test_support", "../utility:cascaded_biquad_filter", ] diff --git a/modules/desktop_capture/BUILD.gn b/modules/desktop_capture/BUILD.gn index b40b7430f6..1cba946601 100644 --- a/modules/desktop_capture/BUILD.gn +++ b/modules/desktop_capture/BUILD.gn @@ -115,7 +115,7 @@ if (rtc_include_tests) { ":primitives", "../../rtc_base:checks", "../../rtc_base:rtc_base_approved", - "../../system_wrappers:cpu_features_api", + "../../system_wrappers", "../../test:test_support", ] if (rtc_desktop_capture_supported) { @@ -486,7 +486,6 @@ rtc_library("desktop_capture_generic") { "../../rtc_base/system:arch", "../../rtc_base/system:rtc_export", "../../system_wrappers", - "../../system_wrappers:cpu_features_api", "../../system_wrappers:metrics", ] absl_deps = [ diff --git a/modules/video_processing/BUILD.gn b/modules/video_processing/BUILD.gn index 4354454111..abc9f039ce 100644 --- a/modules/video_processing/BUILD.gn +++ b/modules/video_processing/BUILD.gn @@ -37,7 +37,7 @@ rtc_library("video_processing") { "../../rtc_base:checks", "../../rtc_base:rtc_base_approved", "../../rtc_base/system:arch", - "../../system_wrappers:cpu_features_api", + "../../system_wrappers", "//third_party/libyuv", ] if (build_video_processing_sse2) { diff --git a/system_wrappers/BUILD.gn b/system_wrappers/BUILD.gn index 2d50111be8..97c09f5850 100644 --- a/system_wrappers/BUILD.gn +++ b/system_wrappers/BUILD.gn @@ -16,6 +16,7 @@ rtc_library("system_wrappers") { visibility = [ "*" ] sources = [ "include/clock.h", + "include/cpu_features_wrapper.h", "include/cpu_info.h", "include/ntp_time.h", "include/rtp_to_ntp_estimator.h", @@ -30,7 +31,6 @@ rtc_library("system_wrappers") { defines = [] libs = [] deps = [ - ":cpu_features_api", "../api:array_view", "../api/units:timestamp", "../modules:module_api_public", @@ -50,7 +50,8 @@ rtc_library("system_wrappers") { "/nsprpub/pr/include", ] } else { - deps += [ ":cpu_features_android" ] + sources += [ "source/cpu_features_android.cc" ] + deps += [ "//third_party/android_sdk:cpu_features" ] } libs += [ "log" ] @@ -58,7 +59,7 @@ rtc_library("system_wrappers") { if (is_linux) { if (!build_with_chromium) { - deps += [ ":cpu_features_linux" ] + sources += [ "source/cpu_features_linux.cc" ] } libs += [ "rt" ] @@ -78,10 +79,6 @@ rtc_library("system_wrappers") { ] } -rtc_source_set("cpu_features_api") { - sources = [ "include/cpu_features_wrapper.h" ] -} - rtc_library("field_trial") { visibility = [ "*" ] public = [ "include/field_trial.h" ] @@ -111,24 +108,6 @@ rtc_library("metrics") { ] } -if (is_android && !build_with_mozilla) { - rtc_library("cpu_features_android") { - sources = [ "source/cpu_features_android.c" ] - - deps = [ "//third_party/android_sdk:cpu_features" ] - } -} - -if (is_linux) { - rtc_library("cpu_features_linux") { - sources = [ "source/cpu_features_linux.c" ] - deps = [ - ":cpu_features_api", - "../rtc_base/system:arch", - ] - } -} - if (rtc_include_tests) { rtc_test("system_wrappers_unittests") { testonly = true diff --git a/system_wrappers/include/cpu_features_wrapper.h b/system_wrappers/include/cpu_features_wrapper.h index 02d54b4516..f4b3fed2d3 100644 --- a/system_wrappers/include/cpu_features_wrapper.h +++ b/system_wrappers/include/cpu_features_wrapper.h @@ -13,10 +13,6 @@ #include -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - // List of features in x86. typedef enum { kSSE2, kSSE3, kAVX2 } CPUFeature; @@ -41,8 +37,4 @@ extern WebRtc_CPUInfo WebRtc_GetCPUInfoNoASM; // values in the above enum definition as a bitmask. extern uint64_t WebRtc_GetCPUFeaturesARM(void); -#if defined(__cplusplus) || defined(c_plusplus) -} // extern "C" -#endif - #endif // SYSTEM_WRAPPERS_INCLUDE_CPU_FEATURES_WRAPPER_H_ diff --git a/system_wrappers/source/cpu_features_android.c b/system_wrappers/source/cpu_features_android.cc similarity index 100% rename from system_wrappers/source/cpu_features_android.c rename to system_wrappers/source/cpu_features_android.cc diff --git a/system_wrappers/source/cpu_features_linux.c b/system_wrappers/source/cpu_features_linux.cc similarity index 98% rename from system_wrappers/source/cpu_features_linux.c rename to system_wrappers/source/cpu_features_linux.cc index 37739c12f6..05ff9b31b7 100644 --- a/system_wrappers/source/cpu_features_linux.c +++ b/system_wrappers/source/cpu_features_linux.cc @@ -8,9 +8,9 @@ * be found in the AUTHORS file in the root of the source tree. */ +#include #include #include -#include #ifdef __GLIBC_PREREQ #define WEBRTC_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b) @@ -21,10 +21,10 @@ #if WEBRTC_GLIBC_PREREQ(2, 16) #include #else -#include -#include #include +#include #include +#include #endif #include "rtc_base/system/arch.h" @@ -36,7 +36,7 @@ uint64_t WebRtc_GetCPUFeaturesARM(void) { uint64_t result = 0; int architecture = 0; - unsigned long hwcap = 0; + uint64_t hwcap = 0; const char* platform = NULL; #if WEBRTC_GLIBC_PREREQ(2, 16) hwcap = getauxval(AT_HWCAP);