webrtc-apm: new webrtc-apm factory with features

This CL changes the WebRTC APM factory so that APM experiments are
handled via the "featured" library (see [1]).
`webrtc_apm_create_with_enforced_effects()` reads the flags for the
relevant experiments to configure APM.
`webrtc_apm_create_for_testing()` is added to test different
behaviors of the factory by simulating different feature flags
encoded as a `WebRtcApmFeatures` object.

The new API was chosen to fully decouple cras_stream_apm.c (see [2])
and from the APM features - i.e., features can be added/removed in
webrtc_apm.h/.cc without breaking cras_stream_apm.c.

[1] https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/platform2/featured/
[2] https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/third_party/adhd/cras/src/server/cras_stream_apm.c

BUG=chromium:1318461
TEST=Local test with `cras_bench`

Cq-Depend: chromium:3707102
Change-Id: I4111c5b7119cc33eae5ed5e7de04bdf09aa84bbd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/webrtc-apm/+/3706917
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Per Åhgren <peah@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Tested-by: Per Åhgren <peah@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
2 files changed
tree: 5809111ef056ef06d411ca18f992a152741d4214
  1. absl/
  2. api/
  3. audio/
  4. common_audio/
  5. cras-config/
  6. modules/
  7. rtc_base/
  8. script/
  9. system_wrappers/
  10. third_party/
  11. bak.h
  12. common.mk
  13. common_types.h
  14. libwebrtc_apm.pc.template
  15. Makefile
  16. OWNERS
  17. pc_utils.mk
  18. README.md
  19. typedefs.h
  20. webrtc_apm.cc
  21. webrtc_apm.h
README.md

WebRTC APM

APM is the audio processing module of WebRTC project in charge of effects like echo cancellation, noise suppression, etc. The purpose of this project is to build a standalone library for Chrome OS system side audio processing.

Files content

  • scripts to copy over folders and files from upstream WebRTC project for APM and its dependencies.
  • Copied files from upstream WebRTC project. For example: common_audio, modules, rtc_base and system_wrappers.
  • webrtc_apm.cc/h C wrappers to access APM functions.
  • common-mk based makefiles to build shared library libwebrtc_apm.so

Update

To update this package to latest upstream WebRC:

  • Run ./script/sync-apm.sh path/to/webrtc-checkout/src .
  • emerge webrtc-apm to see if anything breaks.
  • If emerge success, then we're good.
  • Otherwise look into the emerge failure, and then possibly:
    • Update sync-apm.sh to copy more files if upstream directory structure changes.
    • Update makefiles if upstream build files has changed.
    • Update webrtc-apm ebuild file if dependencies changed.
  • Create a new commit