Commit graph

63 commits

Author SHA1 Message Date
Alessio Bazzica
4f26c25b62 APM input volume controller tests
- Test behavior with no input volume controller
- Test behavior with startup volume higher than the minimum
  input volume

Bug: webrtc:7494
Change-Id: I36d48e2bd277b8a71eb6fbb0272c26c7176b3d5e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/286380
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Hanna Silen <silen@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38932}
2022-12-20 15:03:35 +00:00
Alessio Bazzica
3b51cd328e Unify AGC2 experiment field trials into one
In order to experiment with AGC2 and TS at the same time, 3 field
trials are removed and merged into `WebRTC-Audio-GainController2`,
which is existing.

New parameters for the `WebRTC-Audio-GainController2` field trial:
- `switch_to_agc2`: true by default; when true, the gain control
  switches to AGC2 (both for the input volume and for the adaptive
  digital gain);
- `min_input_volume`: minimum input volume enforced by the input
  volume controller when the applied input volume is not zero;
- `disallow_transient_suppressor_usage`: when true, TS is never
  created.

Removed field trials:
- `WebRTC-Audio-Agc2-MinInputVolume`: now a parameter of
  `WebRTC-Audio-GainController2`;
- `WebRTC-ApmTransientSuppressorKillSwitch`: now a parameter of
  `WebRTC-Audio-GainController2`;
- `WebRTC-Audio-TransientSuppressorVadMode`: automatically inferred
  from `WebRTC-Audio-GainController2`.

Bug: webrtc:7494
Change-Id: I452798c0862d71f9adae6d163fe841df05ca44d6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/287861
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Hanna Silen <silen@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38890}
2022-12-14 16:40:41 +00:00
Alessio Bazzica
2bfa767245 Fix APM AGC2 initialization: pass the correct number of channels
Pass the correct number of channels needed by the AGC2 input volume
controller. This change doesn't affect the adaptive digital
controller which reads the number of channel from the passed audio
buffer instance for each processed frame.

Note that the `AdaptiveDigitalGainController::Initialize()` impl
was removed in [1], but that CL didn't remove the declaration (done
in this CL).

[1] https://webrtc-review.googlesource.com/c/src/+/287222/5/modules/audio_processing/agc2/adaptive_digital_gain_controller.cc#105

Bug: webrtc:7494
Change-Id: I07369ab4025a251b25c716cf618e4222fdb60fc8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/287320
Reviewed-by: Hanna Silen <silen@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38863}
2022-12-09 15:02:20 +00:00
Alessio Bazzica
dfba28e30e AGC2 adaptive digital controller config clean-up
- Remove dry-run option
- Hard-code `adjacent_speech_frames_threshold` and
  `vad_reset_period_ms`
- Expose `initial_gain_db` via field trial

Tested: adaptive digital controller bit-exactness verified

Bug: webrtc:7494
Change-Id: I6166611f91320b6c37de3f8e553c06c2ed95b772
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/287222
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Hanna Silen <silen@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38862}
2022-12-09 13:07:34 +00:00
Hanna Silen
ca6535593f APM: Add field trial parameters and rename
Add AGC2 digital adaptive config parameters in the field trial
"WebRTC-Audio-InputVolumeControllerExperiment". Rename it as
"WebRTC-Audio-GainController2" to reflect that the override now adjusts
the parameters for both input volume controller and adaptive digital
controller.

Bug: webrtc:7494
Change-Id: Ifbc1b8be76cf23b0b6b74b22b5167a45972cab38
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/286880
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Hanna Silen <silen@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38855}
2022-12-08 18:26:05 +00:00
Alessio Bazzica
17e14fdf34 APM AGC2: consolidate GainController2
Now that `InputVolumeController` is finalized, it's time to
consolidate AGC2.

Main changes:
- Remove `AdaptiveDigitalGainController`: it's too simple to justify
  a dedicated class and some components of it are also used by
  `InputVolumeController`
- Remove unwanted temporal dependency: make `InputVolumeController`
  adapt the volume based on the current speech level estimation and
  not on the estimation from the previous frame

Tested: AGC2 adaptive digital bit-exactness verified

Bug: webrtc:7494
Change-Id: I175c2741cafc52be81794219c996a3824c3bbf5e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/280560
Reviewed-by: Hanna Silen <silen@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38841}
2022-12-07 21:47:45 +00:00
Alessio Bazzica
352f38c7a8 APM: add field trial to disable TransientSuppressor
Regardless of the APM config, the transient suppressor (TS) submodule
won't be created if the `WebRTC-ApmTransientSuppressorKillSwitch`
field trial, disabled by default, is enabled.

Bug: webrtc:13663
Change-Id: Ic1ef9aa57c728296d671d4ef253630c581a86610
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/286382
Reviewed-by: Hanna Silen <silen@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38839}
2022-12-07 16:30:47 +00:00
Hanna Silen
a6574909e9 APM: Add a field trial for input volume controller
Add a field trial WebRTC-Audio-InputVolumeControllerExperiment and
a mechanism to adjust the config accordingly. Pass the additional
input volume controller config to GainController2.

Bug: webrtc:7494
Change-Id: I3dd624df1f4774cb533417747627995e1f60aa68
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/284101
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Hanna Silen <silen@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38780}
2022-11-30 17:26:45 +00:00
Hanna Silen
d4dbe4527d AudioProcessingImpl: Add the use of AGC2 InputVolumeController
The integration relies on GainController2 methods Process() and
GetRecommendedInputVolume() to internally take into account whether
the input volume controller is enabled in the ctor or not. These
methods are called for every frame processed if GainController2 is
enabled. Analyze() is called if the input volume controller is
enabled.

The functionality can be enabled from the APM config and is not
enabled by default. If multiple input volume controllers are enabled,
an error is logged.

Tested: Bitexact on a large number of aecdumps if not enabled
Bug: webrtc:7494
Change-Id: I9105483be34eb95fab3c46afbbd368802e956fad
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/282720
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Hanna Silen <silen@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38776}
2022-11-30 15:32:23 +00:00
Alessio Bazzica
79beaa7f38 APM tests: check that the applied input volume is recommended
when volume emulation is used or when neither an input volume
controller nor volume emulation are used.

This CL adds 3 tests, 2 of which currently fail because APM
behaves in an undesired way. In [1] the behavior is fixed and
the tests are enabled.

A DCHECK in `AudioProcessingImpl::set_stream_analog_level` has
been removed since a more robust behavior can be obtained - namely,
that expected in the disabled unit tests added in this CL.

[1] https://webrtc-review.googlesource.com/c/src/+/281185

Bug: webrtc:14581
Change-Id: I29d2c000cd1baf90606487afd9a4042e6f487834
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/281184
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38696}
2022-11-21 10:35:23 +00:00
Sam Zackrisson
5dd548261f APM: Signal error on unsupported sample rates
This CL adds more explicit tests for unsupported sample rates in the WebRTC audio processing module (APM). Rates are restricted to the range [8000, 384000] Hz. Rates outside this range are handled as best as possible, depending on the format.

Tested: bitexact on a large number of aecdumps
Bug: chromium:1332484, chromium:1334991
Change-Id: I9639d03dc837e1fdff64d1f9d1fff0edc0fb299f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/276920
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38663}
2022-11-17 12:12:04 +00:00
Alessio Bazzica
9ea538185a APM: remove min startup volume parameter usage in the APM tests
The parameter is unused and it will be removed in [1]. This CL
isolates the necessary unit test changes from [1].

[1] https://webrtc-review.googlesource.com/c/src/+/278787

Bug: webrtc:7494
Change-Id: Ic1179d335926fba8ff1b65b494b538cf849724bb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/279100
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38416}
2022-10-17 13:33:28 +00:00
Hanna Silen
c69188d15a AudioProcessingImpl: Add input volume unit tests
Bug: webrtc:7494
Change-Id: I5a32359cacfb7cd6b610ae13b95f92283c761362
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/275500
Commit-Queue: Hanna Silen <silen@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38132}
2022-09-20 15:29:59 +00:00
Alessio Bazzica
a5aaedb327 Fix AudioProcessingImplTest tests on analog gain changes
`EchoControllerObservesAnalogAgc1EchoPathGainChange` is incorrect
since it does not call `set_stream_analog_level()`,
`ProcessCapture()` and `recommended_stream_analog_level()`
according to the contract.

`EchoControllerObservesNoDigitalAgc2EchoPathGainChange` is
useless since AGC2 doesn't have any analog controller at the
moment and the test is not written to explictly trigger digital
gain adaptations.

Bug: webrtc:7494, b/241923537
Change-Id: I56203c736448ec060077b00b57e98cd4c29fa737
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/271541
Reviewed-by: Hanna Silen <silen@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38052}
2022-09-09 15:31:35 +00:00
Hanna Silen
0c1ad2992b AudioProcessingImpl: Add a VAD submodule
Add a VoiceActivityDetectorWrapper submodule in AudioProcessingImpl
and enable injecting speech probability into GainController2.

Bug: webrtc:13663
Change-Id: I05e13b737d085b45ac8ce76660191867c56834c2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265166
Commit-Queue: Hanna Silen <silen@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37275}
2022-06-20 10:44:41 +00:00
Niels Möller
105711e9ad Move rtc::make_ref_counted to api/
Bug: webrtc:12701
Change-Id: If49095b101c1a1763c2a44a0284c0d670cce953f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265390
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37219}
2022-06-15 09:47:38 +00:00
Henrik Lundin
8a9aa55561 Remove AudioProcessing::ChannelLayout
This enum is no longer needed. Also moving the last piece of code from
common.h to audio_processing_impl.h, allowing to delete common.h.

Bug: chromium:1271981, b/217349489
Change-Id: If115336c36d6d7b5845a903e421c18aebfe434ee
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251242
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35946}
2022-02-08 10:07:36 +00:00
Henrik Lundin
64253a93dc Remove more traces of keyboard mic support from APM
The 6-parameter Initialize method is removed. The has_keyboard parameter
in the StreamConfig constructor is removed together with the underlying
member and helper functions.

Bug: chromium:1271981, b/217349489
Change-Id: I7259a114a395f74f735a9c06510c0fc0f0f008e3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250221
Reviewed-by: Sam Zackrisson <saza@google.com>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Auto-Submit: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35908}
2022-02-04 14:27:51 +00:00
Sam Zackrisson
03cb7e5a61 APM: Make echo detector an optionally compilable and injectable component
Important: This change does not in any way affect echo cancellation or standardized stats. The user audio experience is unchanged. Only non-standard stats are affected. Echo return loss metrics are unchanged. Residual echo likelihood {recent max} will no longer be computed by default.

Important: The echo detector is no longer enabled by default.

API change, PSA: https://groups.google.com/g/discuss-webrtc/c/mJV5cDysBDI/m/7PTPBjVHCgAJ

This CL removes the default usage of the residual echo detector in APM.
It can now only be used via injection and the helper function webrtc::CreateEchoDetector. See how the function audio_processing_unittest.cc:CreateApm() changed, for an example.

The echo detector implementation is marked poisonous, to avoid accidental dependencies.

Some cleanup is done:
- EchoDetector::PackRenderAudioBuffer is declared in one target but is defined in another target. It is not necessary to keep in the API. It is made an implementation detail, and the echo detector input is documented in the API.
- The internal state of APM is large and difficult to track. Submodule pointers that are set permanently on construction are now appropriately marked const.

Tested:
- existing + new unit tests
- audioproc_f is bitexact on a large number of aecdumps

Bug: webrtc:11539
Change-Id: I00cc2ee112fedb06451a533409311605220064d0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/239652
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35550}
2021-12-16 17:39:11 +00:00
Alessio Bazzica
be1b8989d1 ExperimentalNs removed + APM not depending anymore on webrtc::Config
Thanks to the elimination of `ExperimentalNs`, there is no need anymore
to pass `webrtc::Config` to build APM.
Hence, `AudioProcessingBuilder::Create(const webrtc::Config&)` is also
removed.

Bug: webrtc:5298
Change-Id: I0a3482376a7753434486fe564681f7b9f83939c5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/232128
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35025}
2021-09-17 10:53:43 +00:00
Niels Möller
4f776ac7de Use make_ref_counted in AudioProcessingBuilder
Bug: webrtc:12701
Change-Id: I51ca5a54f812a1620ee2e6605c9ff67b92e2a5f8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/224547
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34725}
2021-08-11 15:40:28 +00:00
Niels Möller
5b747233a3 Add method Mutex::AssertHeld
Acts as a compile time annotation, with corresponding run-time check
only when DCHECKs are enabled, and built using absl or pthreads mutexes.

Bug: None
Change-Id: Ie044c1ea1e576df71d634301f7df9d75cdf10b1b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226328
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34555}
2021-07-27 07:46:32 +00:00
Tommi
87f7090fd9 Replace more instances of rtc::RefCountedObject with make_ref_counted.
This is essentially replacing `new rtc::RefCountedObject` with
`rtc::make_ref_counted` in many files. In a couple of places I
made minor tweaks to make things compile such as adding parenthesis
when they were missing.

Bug: webrtc:12701
Change-Id: I3828dbf3ee0eb0232f3a47067474484ac2f4aed2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215973
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33852}
2021-04-27 17:01:59 +00:00
Per Åhgren
db5d728878 Add refined handling of the internal scaling of the audio in APM
This CL adds functionality that allows adjusting the audio levels
internally in APM. The main purpose of the functionality is to allow
APM to optionally be moved to an integration that does not provide an
analog gain to control, and the implementation of this has been
tailored specifically to meet the requirements for that.

More specifically, this CL does
-Add a new variant of the pre-amplifier gain that is intended to replace
 the pre-amplifier gain (but at the moment can coexist with that). The
 main differences with the pre-amplifier gain is that an attenuating
 gain is allowed, the gain is applied jointly with any emulated analog
 gain, and that its packaging fits better with the post gain.
-Add an emulation of an analog microphone gain. The emulation is
 designed to match the analog mic gain functionality in Chrome OS (which
 is digital) but should be usable also on other platforms.
-Add a post-gain which is applied after all processing has been applied.
 The purpose of this gain is for it to work well with the integration
 in ChromeOS, and be used to compensate for the offset that there is
 applied on some USB audio devices.


Bug: b/177830918
Change-Id: I0f312996e4088c9bd242a713a703eaaeb17f188a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/209707
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33466}
2021-03-15 19:12:02 +00:00
Per Åhgren
652ada5029 Enabling a safe fall-back functionality for overruns in the runtime settings
Bug: b/177830919
Change-Id: I9369f6fc004ceb2b626d33b36262bc8aeabdb1a0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206988
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33371}
2021-03-03 12:06:54 +00:00
Per Åhgren
0ade98316c Cleanup of the APM creation
This CL removes the possibility that APM cannot be created, i.e., that
the create method can return nullptr. That was already the case
implicitly but this CL makes that behavior explicit.


Bug: webrtc:5298
Change-Id: I2706ea538c9d1b4bcd65faecab637640a209a4dc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/183101
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32029}
2020-09-02 20:28:49 +00:00
Danil Chapovalov
704fb55255 In common_audio/ and modules/audio_* replace mock macros with unified MOCK_METHOD macro
Bug: webrtc:11564
Change-Id: Ib0ffce4de50a13b018926f6ea2865a2ec2fb2ec7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/175621
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31333}
2020-05-20 13:17:31 +00:00
Sam Zackrisson
b37e59d198 Add unittests for APM with submodule creation disabled
This introduces a function AudioProcessingImpl::SetCreateOptionalSubmodulesForTesting to simulate the exclusion of build-optional submodules, and tests of the currently only excludable submodule.

Bug: webrtc:11292
Change-Id: If492606205c9fdc669a6dce3a8989a434aeeed1f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/173746
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31138}
2020-04-27 11:47:15 +00:00
Per Åhgren
cc73ed3e70 APM: Add build flag to allow building WebRTC without APM
This CL adds a build flag to allow building the non-test parts
of WebRTC without the audio processing module.
The CL also ensures that the WebRTC code correctly handles
the case when no APM is available.

Bug: webrtc:5298
Change-Id: I5c8b5d1f7115e5cce2af4c2b5ff701fa1c54e49e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/171509
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31133}
2020-04-26 23:06:44 +00:00
Per Åhgren
dc5522b4bf APM: Removing the redundant VAD output from the integer API
This CL removes the redundant VAD output from the newly introduced
integer API in AudioProcessing.

Bug: webrtc:5298
Change-Id: Iad2b1b97ada7f4863139655526c110e326c6788a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/170824
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30832}
2020-03-19 13:59:00 +00:00
Per Åhgren
2507f8cdc9 APM: Replace all remaining usage of AudioFrame outside interfaces
This CL replaces all remaining usage of AudioFrame within APM,
with the exception of the AudioProcessing interface.

The main changes are within the unittests.

Bug: webrtc:5298
Change-Id: I219cdd08f81a8679b28d9dd1359a56837945f3d4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/170362
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30831}
2020-03-19 12:40:18 +00:00
Sam Zackrisson
12e319aafe Merge the preambles of the ProcessStream implementations
The two functions have a lot of shared logic and locking. This CL consolidates that into a single function.

Bug: webrtc:111235
Change-Id: Ib1c32165dbf0e212c7d4b0753bcbb5ffd05eb6fe
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/163022
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30144}
2020-01-03 14:37:41 +00:00
Per Åhgren
c20a19cc4b Allow extracting the linear AEC output
This CL enables extracting the linear AEC output,
allowing for more straightforward
testing/development.

Bug: b/140823178
Change-Id: I14f7934008d87066b35500466cb6e6d96f811688
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153672
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29789}
2019-11-13 11:33:53 +00:00
Gustaf Ullberg
2c6f373a27 Remove legacy EchoControlFactory::Create
Bug: webrtc:10913
Change-Id: I34af9abe76f5b08d7dc5c3e0281fafc14a71eed8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/159031
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29741}
2019-11-08 09:58:27 +00:00
Per Åhgren
4e5c709ed4 Reland "Correct AEC3 multichannel functionality activation"
This is a reland of 9dda1b3a48

Original change's description:
> Correct AEC3 multichannel functionality activation
> 
> This CL corrects the AEC3 multichannel activation
> to also work for the case when a factory is used
> for the activation.
> 
> Bug: webrtc:10913
> Change-Id: Ic2807d8bcef759261fde14447cff30633ba248dc
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158794
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#29676}

Bug: webrtc:10913
Change-Id: I1cb3d0de61ea0b299158ca85433f2442c65c196f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158886
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29690}
2019-11-05 14:38:49 +00:00
Per Åhgren
1983458981 Revert "Reland "Correct AEC3 multichannel functionality activation""
This reverts commit d5a7838926.

Reason for revert: Causing errors in downstream tests.

Original change's description:
> Reland "Correct AEC3 multichannel functionality activation"
> 
> This is a reland of 9dda1b3a48
> 
> Original change's description:
> > Correct AEC3 multichannel functionality activation
> > 
> > This CL corrects the AEC3 multichannel activation
> > to also work for the case when a factory is used
> > for the activation.
> > 
> > Bug: webrtc:10913
> > Change-Id: Ic2807d8bcef759261fde14447cff30633ba248dc
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158794
> > Commit-Queue: Per Åhgren <peah@webrtc.org>
> > Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#29676}
> 
> Bug: webrtc:10913
> Change-Id: Ibfe4e8a51183390a4054514bb294c89c2ea201e9
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158880
> Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#29685}

TBR=saza@webrtc.org,peah@webrtc.org

Change-Id: I6e27bc7fd1c9d4d5550fdc6ae14c39ca84fb03f8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:10913
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158883
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29687}
2019-11-05 09:54:06 +00:00
Per Åhgren
d5a7838926 Reland "Correct AEC3 multichannel functionality activation"
This is a reland of 9dda1b3a48

Original change's description:
> Correct AEC3 multichannel functionality activation
> 
> This CL corrects the AEC3 multichannel activation
> to also work for the case when a factory is used
> for the activation.
> 
> Bug: webrtc:10913
> Change-Id: Ic2807d8bcef759261fde14447cff30633ba248dc
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158794
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#29676}

Bug: webrtc:10913
Change-Id: Ibfe4e8a51183390a4054514bb294c89c2ea201e9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158880
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29685}
2019-11-05 09:11:23 +00:00
Per Åhgren
cc9bf6398c Revert "Correct AEC3 multichannel functionality activation"
This reverts commit 9dda1b3a48.

Reason for revert: The CL is causing downstream issues

Original change's description:
> Correct AEC3 multichannel functionality activation
> 
> This CL corrects the AEC3 multichannel activation
> to also work for the case when a factory is used
> for the activation.
> 
> Bug: webrtc:10913
> Change-Id: Ic2807d8bcef759261fde14447cff30633ba248dc
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158794
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#29676}

TBR=saza@webrtc.org,peah@webrtc.org

Change-Id: Ic487f77f5c11485a0f25a2a1d3797d0ec956f913
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:10913
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158797
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29678}
2019-11-04 08:49:30 +00:00
Per Åhgren
9dda1b3a48 Correct AEC3 multichannel functionality activation
This CL corrects the AEC3 multichannel activation
to also work for the case when a factory is used
for the activation.

Bug: webrtc:10913
Change-Id: Ic2807d8bcef759261fde14447cff30633ba248dc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158794
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29676}
2019-11-04 08:23:27 +00:00
Sam Zackrisson
41478c7c1b Remove AudioProcessing::gain_control() getter
This change also resolves a bug in audioproc_f:
The implicit ApplyConfig calls to enable gain control settings in
aec_dump_simulator.cc:377-406 [1] are overwritten by the ApplyConfig
call on line 500 using a config from line 292.

Compared to a ToT build including a fix for that bug, these changes
are bitexact on a large number of aecdumps.

[1] https://cs.chromium.org/chromium/src/third_party/webrtc/modules/audio_processing/test/aec_dump_based_simulator.cc?l=377&rcl=8bbf9e2c6e40feb8efcbf276b43945a14d651e9b

Bug: webrtc:9878
Change-Id: Id427d34e838c999d996d58193977ac2a9198edd6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/156463
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29481}
2019-10-15 09:23:16 +00:00
Mirko Bonadei
317a1f09ed Use std::make_unique instead of absl::make_unique.
WebRTC is now using C++14 so there is no need to use the Abseil version
of std::make_unique.

This CL has been created with the following steps:

git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt
git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt
git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt

diff --new-line-format="" --unchanged-line-format="" \
  /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \
  uniq > /tmp/only_make_unique.txt
diff --new-line-format="" --unchanged-line-format="" \
  /tmp/only_make_unique.txt /tmp/memory.txt | \
  xargs grep -l "absl/memory" > /tmp/add-memory.txt

git grep -l "\babsl::make_unique\b" | \
  xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g"

git checkout PRESUBMIT.py abseil-in-webrtc.md

cat /tmp/add-memory.txt | \
  xargs sed -i \
  's/#include "absl\/memory\/memory.h"/#include <memory>/g'
git cl format
# Manual fix order of the new inserted #include <memory>

cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \
  xargs sed -i '/#include "absl\/memory\/memory.h"/d'

git ls-files | grep BUILD.gn | \
  xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d'

python tools_webrtc/gn_check_autofix.py \
  -m tryserver.webrtc -b linux_rel

# Repead the gn_check_autofix step for other platforms

git ls-files | grep BUILD.gn | \
  xargs sed -i 's/absl\/memory:memory/absl\/memory/g'
git cl format

Bug: webrtc:10945
Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 15:47:29 +00:00
Per Åhgren
d112c75801 Revert "Reland "Add core multi-channel pipeline in AEC3 This CL adds basic the basic pipeline to support multi-channel processing in AEC3.""
This reverts commit a66395e72f.

Reason for revert: Breaking downstream tests

Original change's description:
> Reland "Add core multi-channel pipeline in AEC3 This CL adds basic the basic pipeline to support multi-channel processing in AEC3."
> 
> This is a reland of f3a197e553
> 
> Original change's description:
> > Add core multi-channel pipeline in AEC3
> > This CL adds basic the basic pipeline to support multi-channel
> > processing in AEC3.
> > 
> > Apart from that, it removes the 8 kHz processing support in several
> > places of the AEC3 code.
> > 
> > Bug: webrtc:10913
> > Change-Id: If5b75fa325ed0071deea94a7546cb4a7adf22137
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150332
> > Commit-Queue: Per Åhgren <peah@webrtc.org>
> > Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#29017}
> 
> Bug: webrtc:10913
> Change-Id: Ifc4b13bd994cfd22dca8f8755fa5700617cc379d
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/151124
> Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#29034}

TBR=saza@webrtc.org,peah@webrtc.org

Change-Id: I0e9fd154da5910d73b7a4c82e4e588f3220fd39d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:10913
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/151126
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29038}
2019-09-02 13:57:07 +00:00
Per Åhgren
a66395e72f Reland "Add core multi-channel pipeline in AEC3 This CL adds basic the basic pipeline to support multi-channel processing in AEC3."
This is a reland of f3a197e553

Original change's description:
> Add core multi-channel pipeline in AEC3
> This CL adds basic the basic pipeline to support multi-channel
> processing in AEC3.
> 
> Apart from that, it removes the 8 kHz processing support in several
> places of the AEC3 code.
> 
> Bug: webrtc:10913
> Change-Id: If5b75fa325ed0071deea94a7546cb4a7adf22137
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150332
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#29017}

Bug: webrtc:10913
Change-Id: Ifc4b13bd994cfd22dca8f8755fa5700617cc379d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/151124
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29034}
2019-09-02 12:08:27 +00:00
Ilya Nikolaevskiy
e3e30ae5c5 Revert "Add core multi-channel pipeline in AEC3"
This reverts commit f3a197e553.

Reason for revert: Speculative revert, as this may'be broken some build bots

Original change's description:
> Add core multi-channel pipeline in AEC3
> This CL adds basic the basic pipeline to support multi-channel
> processing in AEC3.
> 
> Apart from that, it removes the 8 kHz processing support in several
> places of the AEC3 code.
> 
> Bug: webrtc:10913
> Change-Id: If5b75fa325ed0071deea94a7546cb4a7adf22137
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150332
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#29017}

TBR=saza@webrtc.org,peah@webrtc.org

Change-Id: I877d2993b9ccf024bd1d57bca1513c3e24d0bed3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:10913
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150940
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29022}
2019-08-30 10:19:29 +00:00
Per Åhgren
f3a197e553 Add core multi-channel pipeline in AEC3
This CL adds basic the basic pipeline to support multi-channel
processing in AEC3.

Apart from that, it removes the 8 kHz processing support in several
places of the AEC3 code.

Bug: webrtc:10913
Change-Id: If5b75fa325ed0071deea94a7546cb4a7adf22137
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150332
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29017}
2019-08-30 08:07:27 +00:00
Per Åhgren
0aefbf0ec4 Use the AEC3 high-pass filter for the whole APM
This CL removes and replaces the legacy fixed-point high-pass filter in
APM with the floating point high-pass filter in AEC3.

Bug: webrtc:10907
Change-Id: I88cf8f622ab139e4ffa97f89a72425aa3becfc58
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150103
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28950}
2019-08-23 20:04:10 +00:00
Per Åhgren
d47941e018 Reland "Simplification and refactoring of the AudioBuffer code"
This is a reland of 81c0cf287c

Original change's description:
> Simplification and refactoring of the AudioBuffer code
> 
> This CL performs a major refactoring and simplification
> of the AudioBuffer code that.
> -Removes 7 of the 9 internal buffers of the AudioBuffer.
> -Avoids the implicit copying required to keep the
>  internal buffers in sync.
> -Removes all code relating to handling of fixed-point
>  sample data in the AudioBuffer.
> -Changes the naming of the class methods to reflect
>  that only floating point is handled.
> -Corrects some bugs in the code.
> -Extends the handling of internal downmixing to be
>  more generic.
> 
> Bug: webrtc:10882
> Change-Id: I12c8af156fbe366b154744a0a1b3d926bf7be572
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/149828
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#28928}

Bug: webrtc:10882
Change-Id: I2ddf327e80a03468c41662ae63c619ff34f2363a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150101
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28938}
2019-08-22 10:34:05 +00:00
Steve Anton
f254e9e9e5 Revert "Simplification and refactoring of the AudioBuffer code"
This reverts commit 81c0cf287c.

Reason for revert: internal test failures

Original change's description:
> Simplification and refactoring of the AudioBuffer code
> 
> This CL performs a major refactoring and simplification
> of the AudioBuffer code that.
> -Removes 7 of the 9 internal buffers of the AudioBuffer.
> -Avoids the implicit copying required to keep the
>  internal buffers in sync.
> -Removes all code relating to handling of fixed-point
>  sample data in the AudioBuffer.
> -Changes the naming of the class methods to reflect
>  that only floating point is handled.
> -Corrects some bugs in the code.
> -Extends the handling of internal downmixing to be
>  more generic.
> 
> Bug: webrtc:10882
> Change-Id: I12c8af156fbe366b154744a0a1b3d926bf7be572
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/149828
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#28928}

TBR=gustaf@webrtc.org,peah@webrtc.org

Change-Id: I2729e3ad24b3a9b40b368b84cb565c859e79b51e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:10882
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150084
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28931}
2019-08-21 18:00:59 +00:00
Per Åhgren
81c0cf287c Simplification and refactoring of the AudioBuffer code
This CL performs a major refactoring and simplification
of the AudioBuffer code that.
-Removes 7 of the 9 internal buffers of the AudioBuffer.
-Avoids the implicit copying required to keep the
 internal buffers in sync.
-Removes all code relating to handling of fixed-point
 sample data in the AudioBuffer.
-Changes the naming of the class methods to reflect
 that only floating point is handled.
-Corrects some bugs in the code.
-Extends the handling of internal downmixing to be
 more generic.

Bug: webrtc:10882
Change-Id: I12c8af156fbe366b154744a0a1b3d926bf7be572
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/149828
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28928}
2019-08-21 13:40:59 +00:00
Fredrik Hernqvist
ca362855e1 Add PlayoutVolumeChange RuntimeSetting.
Add a PlayoutVolumeChange RuntimeSetting. Trigger an echo path change when the playout volume is changed.

Bug: webrtc:10608
Change-Id: I1e736b93c1865d08c7d2582f6fe00216c1e1f72e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/135746
Reviewed-by: Per Åhgren <peah@webrtc.org>
Reviewed-by: Fredrik Hernqvist <fhernqvist@webrtc.org>
Commit-Queue: Fredrik Hernqvist <fhernqvist@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27913}
2019-05-10 14:12:23 +00:00