diff --git a/BUILD.gn b/BUILD.gn index cc86183c17..7e8325e306 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -806,8 +806,5 @@ group("poison_default_task_queue") { group("poison_default_echo_detector") { } -group("poison_rtc_json") { -} - group("poison_software_video_codecs") { } diff --git a/api/audio/BUILD.gn b/api/audio/BUILD.gn index 4832751b5f..0ecab64086 100644 --- a/api/audio/BUILD.gn +++ b/api/audio/BUILD.gn @@ -55,24 +55,6 @@ rtc_library("aec3_config") { ] } -rtc_library("aec3_config_json") { - visibility = [ "*" ] - allow_poison = [ "rtc_json" ] - sources = [ - "echo_canceller3_config_json.cc", - "echo_canceller3_config_json.h", - ] - deps = [ - ":aec3_config", - "../../rtc_base:checks", - "../../rtc_base:logging", - "../../rtc_base:rtc_json", - "../../rtc_base:stringutils", - "../../rtc_base/system:rtc_export", - ] - absl_deps = [ "//third_party/abseil-cpp/absl/strings" ] -} - rtc_library("aec3_factory") { visibility = [ "*" ] configs += [ "../../modules/audio_processing:apm_debug_dump" ] diff --git a/api/audio/test/BUILD.gn b/api/audio/test/BUILD.gn index dfe8c32f80..8d5822fa54 100644 --- a/api/audio/test/BUILD.gn +++ b/api/audio/test/BUILD.gn @@ -17,13 +17,12 @@ if (rtc_include_tests) { testonly = true sources = [ "audio_frame_unittest.cc", - "echo_canceller3_config_json_unittest.cc", "echo_canceller3_config_unittest.cc", ] deps = [ "..:aec3_config", - "..:aec3_config_json", "..:audio_frame_api", + "../../../modules/audio_processing:aec3_config_json", "../../../test:test_support", ] } diff --git a/api/audio/test/echo_canceller3_config_unittest.cc b/api/audio/test/echo_canceller3_config_unittest.cc index 91312a0f40..da0255806e 100644 --- a/api/audio/test/echo_canceller3_config_unittest.cc +++ b/api/audio/test/echo_canceller3_config_unittest.cc @@ -10,7 +10,7 @@ #include "api/audio/echo_canceller3_config.h" -#include "api/audio/echo_canceller3_config_json.h" +#include "modules/audio_processing/test/echo_canceller3_config_json.h" #include "test/gtest.h" namespace webrtc { diff --git a/modules/audio_processing/BUILD.gn b/modules/audio_processing/BUILD.gn index 64e83a006b..2b81427da9 100644 --- a/modules/audio_processing/BUILD.gn +++ b/modules/audio_processing/BUILD.gn @@ -371,10 +371,12 @@ if (rtc_include_tests) { "echo_control_mobile_unittest.cc", "gain_controller2_unittest.cc", "splitting_filter_unittest.cc", + "test/echo_canceller3_config_json_unittest.cc", "test/fake_recording_device_unittest.cc", ] deps = [ + ":aec3_config_json", ":analog_mic_simulation", ":api", ":apm_logging", @@ -558,6 +560,7 @@ if (rtc_include_tests) { ] deps = [ + ":aec3_config_json", ":analog_mic_simulation", ":api", ":apm_logging", @@ -566,7 +569,6 @@ if (rtc_include_tests) { ":audioproc_protobuf_utils", ":audioproc_test_utils", ":runtime_settings_protobuf_utils", - "../../api/audio:aec3_config_json", "../../api/audio:aec3_factory", "../../api/audio:echo_detector_creator", "../../common_audio", @@ -675,3 +677,21 @@ rtc_library("audioproc_test_utils") { "//third_party/abseil-cpp/absl/types:optional", ] } + +rtc_library("aec3_config_json") { + visibility = [ "*" ] + testonly = true + sources = [ + "test/echo_canceller3_config_json.cc", + "test/echo_canceller3_config_json.h", + ] + deps = [ + "../../api/audio:aec3_config", + "../../rtc_base:checks", + "../../rtc_base:logging", + "../../rtc_base:rtc_json", + "../../rtc_base:stringutils", + "../../rtc_base/system:rtc_export", + ] + absl_deps = [ "//third_party/abseil-cpp/absl/strings" ] +} diff --git a/modules/audio_processing/test/audio_processing_simulator.cc b/modules/audio_processing/test/audio_processing_simulator.cc index 7497d49fde..7bd6da0133 100644 --- a/modules/audio_processing/test/audio_processing_simulator.cc +++ b/modules/audio_processing/test/audio_processing_simulator.cc @@ -19,13 +19,13 @@ #include #include "absl/strings/string_view.h" -#include "api/audio/echo_canceller3_config_json.h" #include "api/audio/echo_canceller3_factory.h" #include "api/audio/echo_detector_creator.h" #include "modules/audio_processing/aec_dump/aec_dump_factory.h" #include "modules/audio_processing/echo_control_mobile_impl.h" #include "modules/audio_processing/include/audio_processing.h" #include "modules/audio_processing/logging/apm_data_dumper.h" +#include "modules/audio_processing/test/echo_canceller3_config_json.h" #include "modules/audio_processing/test/fake_recording_device.h" #include "rtc_base/checks.h" #include "rtc_base/logging.h" diff --git a/api/audio/echo_canceller3_config_json.cc b/modules/audio_processing/test/echo_canceller3_config_json.cc similarity index 99% rename from api/audio/echo_canceller3_config_json.cc rename to modules/audio_processing/test/echo_canceller3_config_json.cc index 96e45ffe6d..d05e2841f0 100644 --- a/api/audio/echo_canceller3_config_json.cc +++ b/modules/audio_processing/test/echo_canceller3_config_json.cc @@ -7,7 +7,7 @@ * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ -#include "api/audio/echo_canceller3_config_json.h" +#include "modules/audio_processing/test/echo_canceller3_config_json.h" #include @@ -429,13 +429,6 @@ void Aec3ConfigFromJsonString(absl::string_view json_string, } } -EchoCanceller3Config Aec3ConfigFromJsonString(absl::string_view json_string) { - EchoCanceller3Config cfg; - bool not_used; - Aec3ConfigFromJsonString(json_string, &cfg, ¬_used); - return cfg; -} - std::string Aec3ConfigToJsonString(const EchoCanceller3Config& config) { rtc::StringBuilder ost; ost << "{"; diff --git a/api/audio/echo_canceller3_config_json.h b/modules/audio_processing/test/echo_canceller3_config_json.h similarity index 64% rename from api/audio/echo_canceller3_config_json.h rename to modules/audio_processing/test/echo_canceller3_config_json.h index ecee9541c7..6637c8fbfb 100644 --- a/api/audio/echo_canceller3_config_json.h +++ b/modules/audio_processing/test/echo_canceller3_config_json.h @@ -8,14 +8,13 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef API_AUDIO_ECHO_CANCELLER3_CONFIG_JSON_H_ -#define API_AUDIO_ECHO_CANCELLER3_CONFIG_JSON_H_ +#ifndef MODULES_AUDIO_PROCESSING_TEST_ECHO_CANCELLER3_CONFIG_JSON_H_ +#define MODULES_AUDIO_PROCESSING_TEST_ECHO_CANCELLER3_CONFIG_JSON_H_ #include #include "absl/strings/string_view.h" #include "api/audio/echo_canceller3_config.h" -#include "rtc_base/system/rtc_export.h" namespace webrtc { // Parses a JSON-encoded string into an Aec3 config. Fields corresponds to @@ -23,23 +22,15 @@ namespace webrtc { // "aec3". Produces default config values for anything that cannot be parsed // from the string. If any error was found in the parsing, parsing_successful is // set to false. -RTC_EXPORT void Aec3ConfigFromJsonString(absl::string_view json_string, +void Aec3ConfigFromJsonString(absl::string_view json_string, EchoCanceller3Config* config, bool* parsing_successful); -// To be deprecated. -// Parses a JSON-encoded string into an Aec3 config. Fields corresponds to -// substruct names, with the addition that there must be a top-level node -// "aec3". Returns default config values for anything that cannot be parsed from -// the string. -RTC_EXPORT EchoCanceller3Config -Aec3ConfigFromJsonString(absl::string_view json_string); - // Encodes an Aec3 config in JSON format. Fields corresponds to substruct names, // with the addition that the top-level node is named "aec3". -RTC_EXPORT std::string Aec3ConfigToJsonString( +std::string Aec3ConfigToJsonString( const EchoCanceller3Config& config); } // namespace webrtc -#endif // API_AUDIO_ECHO_CANCELLER3_CONFIG_JSON_H_ +#endif // MODULES_AUDIO_PROCESSING_TEST_ECHO_CANCELLER3_CONFIG_JSON_H_ diff --git a/api/audio/test/echo_canceller3_config_json_unittest.cc b/modules/audio_processing/test/echo_canceller3_config_json_unittest.cc similarity index 94% rename from api/audio/test/echo_canceller3_config_json_unittest.cc rename to modules/audio_processing/test/echo_canceller3_config_json_unittest.cc index 4146dda9fe..18c7e9f110 100644 --- a/api/audio/test/echo_canceller3_config_json_unittest.cc +++ b/modules/audio_processing/test/echo_canceller3_config_json_unittest.cc @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "api/audio/echo_canceller3_config_json.h" +#include "modules/audio_processing/test/echo_canceller3_config_json.h" #include "api/audio/echo_canceller3_config.h" #include "test/gtest.h" @@ -36,8 +36,12 @@ TEST(EchoCanceller3JsonHelpers, ToStringAndParseJson) { cfg.multi_channel.stereo_detection_threshold += 1.0f; cfg.multi_channel.stereo_detection_timeout_threshold_seconds += 1; cfg.multi_channel.stereo_detection_hysteresis_seconds += 1; + std::string json_string = Aec3ConfigToJsonString(cfg); - EchoCanceller3Config cfg_transformed = Aec3ConfigFromJsonString(json_string); + EchoCanceller3Config cfg_transformed; + bool parsing_successful; + Aec3ConfigFromJsonString(json_string, &cfg_transformed, & parsing_successful); + ASSERT_TRUE(parsing_successful); // Expect unchanged values to remain default. EXPECT_EQ(cfg.ep_strength.default_len, diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn index 6aff8cc823..6abae807fe 100644 --- a/rtc_base/BUILD.gn +++ b/rtc_base/BUILD.gn @@ -855,8 +855,8 @@ config("rtc_json_suppressions") { } rtc_library("rtc_json") { + testonly = true public_configs = [ ":rtc_json_suppressions" ] - poisonous = [ "rtc_json" ] defines = [] sources = [ "strings/json.cc", diff --git a/test/BUILD.gn b/test/BUILD.gn index e7eaa09949..be8ee1684e 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -1337,6 +1337,8 @@ if (!build_with_chromium && is_android) { } rtc_library("call_config_utils") { + testonly = true + # TODO(bugs.webrtc.org/10814): Remove rtc_json_suppressions as soon as it # gets removed upstream. public_configs = [ "../rtc_base:rtc_json_suppressions" ] diff --git a/test/fuzzers/BUILD.gn b/test/fuzzers/BUILD.gn index 114deb03c3..3d2ac7a7e7 100644 --- a/test/fuzzers/BUILD.gn +++ b/test/fuzzers/BUILD.gn @@ -519,7 +519,7 @@ webrtc_fuzzer_test("aec3_config_json_fuzzer") { deps = [ ":fuzz_data_helper", "../../api/audio:aec3_config", - "../../api/audio:aec3_config_json", + "../../modules/audio_processing:aec3_config_json", ] dict = "//testing/libfuzzer/fuzzers/dicts/json.dict" seed_corpus = "corpora/aec3-config-json-corpus" diff --git a/test/fuzzers/aec3_config_json_fuzzer.cc b/test/fuzzers/aec3_config_json_fuzzer.cc index 626350c52c..b2ded1b5b0 100644 --- a/test/fuzzers/aec3_config_json_fuzzer.cc +++ b/test/fuzzers/aec3_config_json_fuzzer.cc @@ -11,7 +11,7 @@ #include #include "api/audio/echo_canceller3_config.h" -#include "api/audio/echo_canceller3_config_json.h" +#include "modules/audio_processing/test/echo_canceller3_config_json.h" #include "test/fuzzers/fuzz_data_helper.h" namespace webrtc { diff --git a/webrtc.gni b/webrtc.gni index 5a1c43c888..173d66c791 100644 --- a/webrtc.gni +++ b/webrtc.gni @@ -480,9 +480,6 @@ all_poison_types = [ # Default echo detector implementation. "default_echo_detector", - # JSON parsing should not be needed in the "slim and modular" WebRTC. - "rtc_json", - # Software video codecs (VP8 and VP9 through libvpx). "software_video_codecs", ]