1# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2# 3# Use of this source code is governed by a BSD-style license 4# that can be found in the LICENSE file in the root of the source 5# tree. An additional intellectual property rights grant can be found 6# in the file PATENTS. All contributing project authors may 7# be found in the AUTHORS file in the root of the source tree. 8 9import("../../webrtc.gni") 10if (rtc_enable_protobuf) { 11 import("//third_party/protobuf/proto_library.gni") 12} 13 14config("apm_debug_dump") { 15 if (apm_debug_dump) { 16 defines = [ "WEBRTC_APM_DEBUG_DUMP=1" ] 17 } else { 18 defines = [ "WEBRTC_APM_DEBUG_DUMP=0" ] 19 } 20} 21 22rtc_library("config") { 23 visibility = [ ":*" ] 24 sources = [ 25 "include/config.cc", 26 "include/config.h", 27 ] 28 deps = [ 29 "../../rtc_base:macromagic", 30 "../../rtc_base/system:rtc_export", 31 ] 32} 33 34rtc_library("api") { 35 visibility = [ "*" ] 36 sources = [ 37 "include/audio_processing.cc", 38 "include/audio_processing.h", 39 ] 40 deps = [ 41 ":audio_frame_view", 42 ":audio_processing_statistics", 43 ":config", 44 "../../api:array_view", 45 "../../api:scoped_refptr", 46 "../../api/audio:aec3_config", 47 "../../api/audio:audio_frame_api", 48 "../../api/audio:echo_control", 49 "../../rtc_base:deprecation", 50 "../../rtc_base:macromagic", 51 "../../rtc_base:rtc_base_approved", 52 "../../rtc_base/system:arch", 53 "../../rtc_base/system:file_wrapper", 54 "../../rtc_base/system:rtc_export", 55 "agc:gain_control_interface", 56 ] 57 absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] 58} 59 60rtc_library("audio_frame_proxies") { 61 visibility = [ "*" ] 62 sources = [ 63 "include/audio_frame_proxies.cc", 64 "include/audio_frame_proxies.h", 65 ] 66 deps = [ 67 ":api", 68 ":audio_frame_view", 69 "../../api/audio:audio_frame_api", 70 ] 71} 72 73rtc_library("audio_buffer") { 74 visibility = [ "*" ] 75 76 configs += [ ":apm_debug_dump" ] 77 78 sources = [ 79 "audio_buffer.cc", 80 "audio_buffer.h", 81 "splitting_filter.cc", 82 "splitting_filter.h", 83 "three_band_filter_bank.cc", 84 "three_band_filter_bank.h", 85 ] 86 87 defines = [] 88 89 deps = [ 90 ":api", 91 "../../api:array_view", 92 "../../common_audio", 93 "../../common_audio:common_audio_c", 94 "../../rtc_base:checks", 95 ] 96} 97 98rtc_library("high_pass_filter") { 99 visibility = [ "*" ] 100 101 sources = [ 102 "high_pass_filter.cc", 103 "high_pass_filter.h", 104 ] 105 106 defines = [] 107 108 deps = [ 109 ":audio_buffer", 110 "../../api:array_view", 111 "../../rtc_base:checks", 112 "utility:cascaded_biquad_filter", 113 ] 114} 115 116rtc_source_set("aec_dump_interface") { 117 visibility = [ "*" ] 118 sources = [ 119 "include/aec_dump.cc", 120 "include/aec_dump.h", 121 ] 122 123 deps = [ 124 ":api", 125 ":audio_frame_view", 126 "../../rtc_base:deprecation", 127 ] 128} 129 130rtc_library("audio_processing") { 131 visibility = [ "*" ] 132 configs += [ ":apm_debug_dump" ] 133 sources = [ 134 "audio_processing_builder_impl.cc", 135 "audio_processing_impl.cc", 136 "audio_processing_impl.h", 137 "common.h", 138 "echo_control_mobile_impl.cc", 139 "echo_control_mobile_impl.h", 140 "echo_detector/circular_buffer.cc", 141 "echo_detector/circular_buffer.h", 142 "echo_detector/mean_variance_estimator.cc", 143 "echo_detector/mean_variance_estimator.h", 144 "echo_detector/moving_max.cc", 145 "echo_detector/moving_max.h", 146 "echo_detector/normalized_covariance_estimator.cc", 147 "echo_detector/normalized_covariance_estimator.h", 148 "gain_control_impl.cc", 149 "gain_control_impl.h", 150 "gain_controller2.cc", 151 "gain_controller2.h", 152 "level_estimator.cc", 153 "level_estimator.h", 154 "render_queue_item_verifier.h", 155 "residual_echo_detector.cc", 156 "residual_echo_detector.h", 157 "typing_detection.cc", 158 "typing_detection.h", 159 ] 160 161 defines = [] 162 deps = [ 163 ":aec_dump_interface", 164 ":api", 165 ":apm_logging", 166 ":audio_buffer", 167 ":audio_frame_proxies", 168 ":audio_frame_view", 169 ":audio_processing_statistics", 170 ":config", 171 ":high_pass_filter", 172 ":optionally_built_submodule_creators", 173 ":rms_level", 174 ":voice_detection", 175 "../../api:array_view", 176 "../../api:function_view", 177 "../../api/audio:aec3_config", 178 "../../api/audio:audio_frame_api", 179 "../../api/audio:echo_control", 180 "../../audio/utility:audio_frame_operations", 181 "../../common_audio:common_audio_c", 182 "../../common_audio/third_party/ooura:fft_size_256", 183 "../../rtc_base:checks", 184 "../../rtc_base:deprecation", 185 "../../rtc_base:gtest_prod", 186 "../../rtc_base:ignore_wundef", 187 "../../rtc_base:refcount", 188 "../../rtc_base:safe_minmax", 189 "../../rtc_base:sanitizer", 190 "../../rtc_base/synchronization:mutex", 191 "../../rtc_base/system:rtc_export", 192 "../../system_wrappers:cpu_features_api", 193 "../../system_wrappers:field_trial", 194 "../../system_wrappers:metrics", 195 "aec3", 196 "aec_dump:aec_dump", 197 "aecm:aecm_core", 198 "agc", 199 "agc:gain_control_interface", 200 "agc:legacy_agc", 201 "agc2:adaptive_digital", 202 "agc2:fixed_digital", 203 "agc2:gain_applier", 204 "ns", 205 "transient:transient_suppressor_api", 206 "vad", 207 ] 208 absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] 209 210 deps += [ 211 "../../common_audio", 212 "../../common_audio:fir_filter", 213 "../../common_audio:fir_filter_factory", 214 "../../rtc_base:rtc_base_approved", 215 "../../system_wrappers", 216 ] 217 218 if (rtc_enable_protobuf) { 219 deps += [ "aec_dump:aec_dump_impl" ] 220 } else { 221 deps += [ "aec_dump:null_aec_dump_factory" ] 222 } 223} 224 225rtc_library("voice_detection") { 226 sources = [ 227 "voice_detection.cc", 228 "voice_detection.h", 229 ] 230 deps = [ 231 ":api", 232 ":audio_buffer", 233 "../../api/audio:audio_frame_api", 234 "../../common_audio:common_audio_c", 235 "../../rtc_base:checks", 236 ] 237} 238 239rtc_library("optionally_built_submodule_creators") { 240 sources = [ 241 "optionally_built_submodule_creators.cc", 242 "optionally_built_submodule_creators.h", 243 ] 244 deps = [ 245 "transient:transient_suppressor_api", 246 "transient:transient_suppressor_impl", 247 ] 248} 249 250rtc_source_set("rms_level") { 251 visibility = [ "*" ] 252 sources = [ 253 "rms_level.cc", 254 "rms_level.h", 255 ] 256 deps = [ 257 "../../api:array_view", 258 "../../rtc_base:checks", 259 ] 260 absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] 261} 262 263rtc_library("audio_processing_statistics") { 264 visibility = [ "*" ] 265 sources = [ 266 "include/audio_processing_statistics.cc", 267 "include/audio_processing_statistics.h", 268 ] 269 deps = [ "../../rtc_base/system:rtc_export" ] 270 absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] 271} 272 273rtc_source_set("audio_frame_view") { 274 sources = [ "include/audio_frame_view.h" ] 275 deps = [ "../../api:array_view" ] 276} 277 278if (rtc_enable_protobuf) { 279 proto_library("audioproc_debug_proto") { 280 sources = [ "debug.proto" ] 281 282 proto_out_dir = "modules/audio_processing" 283 } 284} 285 286rtc_library("apm_logging") { 287 configs += [ ":apm_debug_dump" ] 288 sources = [ 289 "logging/apm_data_dumper.cc", 290 "logging/apm_data_dumper.h", 291 ] 292 deps = [ 293 "../../api:array_view", 294 "../../common_audio", 295 "../../rtc_base:checks", 296 "../../rtc_base:rtc_base_approved", 297 ] 298 defines = [] 299} 300 301if (rtc_include_tests) { 302 rtc_source_set("mocks") { 303 testonly = true 304 sources = [ "include/mock_audio_processing.h" ] 305 deps = [ 306 ":aec_dump_interface", 307 ":api", 308 ":audio_buffer", 309 ":audio_processing", 310 ":audio_processing_statistics", 311 "../../test:test_support", 312 ] 313 } 314 315 group("audio_processing_tests") { 316 testonly = true 317 deps = [ 318 ":audioproc_test_utils", 319 "transient:click_annotate", 320 "transient:transient_suppression_test", 321 ] 322 323 if (rtc_enable_protobuf) { 324 deps += [ 325 ":audioproc_unittest_proto", 326 "aec_dump:aec_dump_unittests", 327 "test/conversational_speech", 328 "test/py_quality_assessment", 329 ] 330 } 331 } 332 333 rtc_library("audio_processing_unittests") { 334 testonly = true 335 336 configs += [ ":apm_debug_dump" ] 337 sources = [ 338 "audio_buffer_unittest.cc", 339 "audio_frame_view_unittest.cc", 340 "config_unittest.cc", 341 "echo_control_mobile_unittest.cc", 342 "gain_controller2_unittest.cc", 343 "splitting_filter_unittest.cc", 344 "test/fake_recording_device_unittest.cc", 345 ] 346 347 deps = [ 348 ":analog_mic_simulation", 349 ":api", 350 ":apm_logging", 351 ":audio_buffer", 352 ":audio_frame_view", 353 ":audio_processing", 354 ":audioproc_test_utils", 355 ":config", 356 ":high_pass_filter", 357 ":mocks", 358 ":voice_detection", 359 "../../api:array_view", 360 "../../api:scoped_refptr", 361 "../../api/audio:aec3_config", 362 "../../api/audio:aec3_factory", 363 "../../common_audio", 364 "../../common_audio:common_audio_c", 365 "../../rtc_base", 366 "../../rtc_base:checks", 367 "../../rtc_base:gtest_prod", 368 "../../rtc_base:ignore_wundef", 369 "../../rtc_base:protobuf_utils", 370 "../../rtc_base:rtc_base_approved", 371 "../../rtc_base:rtc_base_tests_utils", 372 "../../rtc_base:safe_minmax", 373 "../../rtc_base:task_queue_for_test", 374 "../../rtc_base/synchronization:mutex", 375 "../../rtc_base/system:arch", 376 "../../rtc_base/system:file_wrapper", 377 "../../system_wrappers", 378 "../../system_wrappers:cpu_features_api", 379 "../../test:fileutils", 380 "../../test:rtc_expect_death", 381 "../../test:test_support", 382 "../audio_coding:neteq_input_audio_tools", 383 "aec_dump:mock_aec_dump_unittests", 384 "agc:agc_unittests", 385 "agc2:adaptive_digital_unittests", 386 "agc2:biquad_filter_unittests", 387 "agc2:fixed_digital_unittests", 388 "agc2:noise_estimator_unittests", 389 "agc2:rnn_vad_with_level_unittests", 390 "agc2:test_utils", 391 "agc2/rnn_vad:unittests", 392 "test/conversational_speech:unittest", 393 "transient:transient_suppression_unittests", 394 "utility:legacy_delay_estimator_unittest", 395 "utility:pffft_wrapper_unittest", 396 "vad:vad_unittests", 397 "//testing/gtest", 398 ] 399 absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] 400 401 defines = [] 402 403 if (rtc_prefer_fixed_point) { 404 defines += [ "WEBRTC_AUDIOPROC_FIXED_PROFILE" ] 405 } else { 406 defines += [ "WEBRTC_AUDIOPROC_FLOAT_PROFILE" ] 407 } 408 409 if (rtc_enable_protobuf) { 410 defines += [ "WEBRTC_AUDIOPROC_DEBUG_DUMP" ] 411 deps += [ 412 ":audioproc_debug_proto", 413 ":audioproc_protobuf_utils", 414 ":audioproc_test_utils", 415 ":audioproc_unittest_proto", 416 ":optionally_built_submodule_creators", 417 ":rms_level", 418 ":runtime_settings_protobuf_utils", 419 "../../api/audio:audio_frame_api", 420 "../../api/audio:echo_control", 421 "../../rtc_base:rtc_base_tests_utils", 422 "../../rtc_base:rtc_task_queue", 423 "aec_dump", 424 "aec_dump:aec_dump_unittests", 425 ] 426 absl_deps += [ "//third_party/abseil-cpp/absl/flags:flag" ] 427 sources += [ 428 "audio_processing_impl_locking_unittest.cc", 429 "audio_processing_impl_unittest.cc", 430 "audio_processing_unittest.cc", 431 "echo_control_mobile_bit_exact_unittest.cc", 432 "echo_detector/circular_buffer_unittest.cc", 433 "echo_detector/mean_variance_estimator_unittest.cc", 434 "echo_detector/moving_max_unittest.cc", 435 "echo_detector/normalized_covariance_estimator_unittest.cc", 436 "gain_control_unittest.cc", 437 "high_pass_filter_unittest.cc", 438 "level_estimator_unittest.cc", 439 "residual_echo_detector_unittest.cc", 440 "rms_level_unittest.cc", 441 "test/debug_dump_replayer.cc", 442 "test/debug_dump_replayer.h", 443 "test/debug_dump_test.cc", 444 "test/echo_canceller_test_tools.cc", 445 "test/echo_canceller_test_tools.h", 446 "test/echo_canceller_test_tools_unittest.cc", 447 "test/echo_control_mock.h", 448 "test/test_utils.h", 449 "voice_detection_unittest.cc", 450 ] 451 } 452 } 453 454 rtc_library("audio_processing_perf_tests") { 455 testonly = true 456 configs += [ ":apm_debug_dump" ] 457 458 sources = [ "audio_processing_performance_unittest.cc" ] 459 deps = [ 460 ":audio_processing", 461 ":audioproc_test_utils", 462 "../../api:array_view", 463 "../../rtc_base:protobuf_utils", 464 "../../rtc_base:rtc_base_approved", 465 "../../system_wrappers", 466 "../../test:perf_test", 467 "../../test:test_support", 468 ] 469 } 470 471 rtc_library("analog_mic_simulation") { 472 sources = [ 473 "test/fake_recording_device.cc", 474 "test/fake_recording_device.h", 475 ] 476 deps = [ 477 "../../api:array_view", 478 "../../api/audio:audio_frame_api", 479 "../../common_audio", 480 "../../rtc_base:checks", 481 "../../rtc_base:rtc_base_approved", 482 "../../rtc_base:safe_minmax", 483 "agc:gain_map", 484 ] 485 absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] 486 } 487 488 if (rtc_enable_protobuf) { 489 rtc_library("audioproc_f_impl") { 490 testonly = true 491 configs += [ ":apm_debug_dump" ] 492 sources = [ 493 "test/aec_dump_based_simulator.cc", 494 "test/aec_dump_based_simulator.h", 495 "test/api_call_statistics.cc", 496 "test/api_call_statistics.h", 497 "test/audio_processing_simulator.cc", 498 "test/audio_processing_simulator.h", 499 "test/audioproc_float_impl.cc", 500 "test/audioproc_float_impl.h", 501 "test/wav_based_simulator.cc", 502 "test/wav_based_simulator.h", 503 ] 504 505 deps = [ 506 ":analog_mic_simulation", 507 ":api", 508 ":apm_logging", 509 ":audio_processing", 510 ":audioproc_debug_proto", 511 ":audioproc_protobuf_utils", 512 ":audioproc_test_utils", 513 ":runtime_settings_protobuf_utils", 514 "../../api/audio:aec3_config_json", 515 "../../api/audio:aec3_factory", 516 "../../common_audio", 517 "../../rtc_base:checks", 518 "../../rtc_base:ignore_wundef", 519 "../../rtc_base:protobuf_utils", 520 "../../rtc_base:rtc_base_approved", 521 "../../rtc_base:rtc_json", 522 "../../rtc_base:task_queue_for_test", 523 "../../rtc_base/system:file_wrapper", 524 "../../system_wrappers", 525 "../../system_wrappers:field_trial", 526 "../../test:test_support", 527 "aec_dump", 528 "aec_dump:aec_dump_impl", 529 "//testing/gtest", 530 ] 531 absl_deps = [ 532 "//third_party/abseil-cpp/absl/flags:flag", 533 "//third_party/abseil-cpp/absl/flags:parse", 534 "//third_party/abseil-cpp/absl/strings", 535 "//third_party/abseil-cpp/absl/types:optional", 536 ] 537 } # audioproc_f_impl 538 } 539 540 if (rtc_enable_protobuf) { 541 proto_library("audioproc_unittest_proto") { 542 sources = [ "test/unittest.proto" ] 543 proto_out_dir = "modules/audio_processing/test" 544 } 545 546 rtc_library("audioproc_protobuf_utils") { 547 sources = [ 548 "test/protobuf_utils.cc", 549 "test/protobuf_utils.h", 550 ] 551 552 deps = [ 553 ":audioproc_debug_proto", 554 "../../rtc_base:checks", 555 "../../rtc_base:ignore_wundef", 556 "../../rtc_base:protobuf_utils", 557 "../../rtc_base:rtc_base_approved", 558 "../../rtc_base/system:arch", 559 ] 560 } 561 562 rtc_library("runtime_settings_protobuf_utils") { 563 testonly = true 564 sources = [ 565 "test/runtime_setting_util.cc", 566 "test/runtime_setting_util.h", 567 ] 568 569 deps = [ 570 ":api", 571 ":audioproc_debug_proto", 572 ":audioproc_protobuf_utils", 573 "../../rtc_base:checks", 574 ] 575 } 576 } 577} 578 579rtc_library("audioproc_test_utils") { 580 visibility = [ "*" ] 581 testonly = true 582 sources = [ 583 "test/audio_buffer_tools.cc", 584 "test/audio_buffer_tools.h", 585 "test/audio_processing_builder_for_testing.cc", 586 "test/audio_processing_builder_for_testing.h", 587 "test/bitexactness_tools.cc", 588 "test/bitexactness_tools.h", 589 "test/performance_timer.cc", 590 "test/performance_timer.h", 591 "test/simulator_buffers.cc", 592 "test/simulator_buffers.h", 593 "test/test_utils.cc", 594 "test/test_utils.h", 595 ] 596 597 configs += [ ":apm_debug_dump" ] 598 599 deps = [ 600 ":api", 601 ":audio_buffer", 602 ":audio_processing", 603 "../../api:array_view", 604 "../../api/audio:audio_frame_api", 605 "../../common_audio", 606 "../../rtc_base:checks", 607 "../../rtc_base:rtc_base_approved", 608 "../../rtc_base/system:arch", 609 "../../system_wrappers", 610 "../../test:fileutils", 611 "../../test:test_support", 612 "../audio_coding:neteq_input_audio_tools", 613 "//testing/gtest", 614 ] 615 absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] 616} 617