Fixes to support building in -std=c++20 mode.

This is a cherry-pick of
https://webrtc-review.googlesource.com/c/src/+/261221

Original commit message:

> Fixes to support building in -std=c++20 mode.
>
> * Structs with user-declared constructors are no longer considered
>   aggregates, so remove the declarations when possible
> * Types of both arguments to "==" must match to avoid "ambiguous
>   function call" warning
> * Various types of math involving enums are deprecated, so replace with
>   constexprs where necessary
> * ABSL_CONST_INIT must be used on definition as well as declaration
> * volatile memory may no longer be read from and written to by the same
>   operator, so replace e.g. "n++" with "n = n + 1"
> * Replace an outdated check for no_unique_address support with
>   __has_cpp_attribute
> * std::result_of(f(x)) has been removed, replace with
>   std::invoke_result(f, x)
>
> Bug: chromium:1284275
> Change-Id: I77b366ab1da7eb2c1e4c825b2714417c31ee5903
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/261221
> Auto-Submit: Peter Kasting <pkasting@chromium.org>
> Reviewed-by: Tomas Gunnarsson <tommi@google.com>
> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#36786}

BUG=b:217226507
TEST=CQ

Cq-Depend: chromium:4653715
Change-Id: Ia1c56ced5dd6c1f280917adacd4a4046fc9e72f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/webrtc-apm/+/4660950
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Commit-Queue: Li-Yu Yu <aaronyu@google.com>
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Tested-by: Li-Yu Yu <aaronyu@google.com>
10 files changed
tree: 213fc69863c741b2943f3c336045810a56e88463
  1. api/
  2. audio/
  3. common_audio/
  4. cras-config/
  5. modules/
  6. repositories/
  7. rtc_base/
  8. script/
  9. system_wrappers/
  10. third_party/
  11. .bazelrc
  12. .gitignore
  13. bak.h
  14. BUILD.bazel
  15. BUILD.iniparser.bazel
  16. common.mk
  17. common_types.h
  18. defs.bzl
  19. DIR_METADATA
  20. libwebrtc_apm.pc.template
  21. Makefile
  22. OWNERS
  23. pc_utils.mk
  24. PRESUBMIT.cfg
  25. README.md
  26. typedefs.h
  27. webrtc_apm.cc
  28. webrtc_apm.h
  29. webrtc_apm_test.cc
  30. WORKSPACE.bazel
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-${BOARD} adhd 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 BUILD.bazel files if upstream build files has changed.
    • Update the adhd ebuild file if dependencies changed.
  • Create a new commit

Build

There are three ways to build/test this package:

  1. Build webrtc-apm alone
  2. Build webrtc-apm with cras
  3. Build webrtc-apm inside a ChromiumOS SDK

The first one is the easiest to iterate with, and the last one is closest to the way ChromiumOS infra actually use to build OS images. The second one is somewhere in-between.

Build webrtc-apm alone

In the directory same as this README file, run:

bazel test //:tests

If you see pkg-config errors you are missing some system dependencies. (Googlers: follow go/cras-dev#prerequisites to install dependencies on gLinux)

Build webrtc-apm with cras

  1. Clone https://chromium.googlesource.com/chromiumos/third_party/adhd/ to the directory adjacent to this directory, so that adhd and webrtc-apm (this repository) are in the same directory.

    NOTE: If you use repo to set up a ChromiumOS checkout, the directory tree is already set up this way.

  2. In the adhd directory, run:

    bazel test //... @webrtc_apm//:tests
    

    There are some configs you can use, such as --config=local-clang and --config=asan. Refer to adhd's bazelrc for details.

    If you see pkg-config errors you are missing some system dependencies. (Googlers: follow go/cras-dev#prerequisites to install dependencies on gLinux)

Build webrtc-apm inside a ChromiumOS SDK

Example:

FEATURES=test USE=asan emerge-${BOARD} adhd