Commit graph

29 commits

Author SHA1 Message Date
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
Per Åhgren
ae40e19805 AEC3: Adding a configurable render signal gain
Bug: webrtc:8671
Change-Id: I405d669517382ce195065caa3147eabace5ec18a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158669
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29647}
2019-10-29 23:26:38 +00:00
Sam Zackrisson
528a03441e Fix fuzzer-found inconsistency in AEC3 config json parsing
Type mismatches will silently fail and skip reading a parameter
in the JSON parsing, except when parsing a size_t from a negative int.

This CL updates the parsing to silently ignore negative values provided
for size_t config parameters, instead of explicitly DCHECKing.

Tested: Ran the fuzzer on the crash test case with + without this fix.

Bug: chromium:1016139
Change-Id: I3899e81e1183aa54b708030efeb6e0006b8cd881
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/157894
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29568}
2019-10-22 10:21:53 +00:00
Sam Zackrisson
ffc8452730 AEC3: Add support for logging warnings on delay buffer changes
This reintroduces the WARNING log level of a previous CL [1],
via a default-off config flag.

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

Bug: None
Change-Id: Ica8583cbb24a1611cfc684ae02d5a0f582004024
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/156566
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29489}
2019-10-15 12:16:51 +00:00
Per Åhgren
8be669fd96 AEC3: Add support for multiple channels to the reverb modelling
This CL adds support for multiple channels in the reverb
modelling. As a side effect, it also partly adds multi-channel
supports for the sections of the code.

Beyond adding the multi-channel support, a bug is fixed as part of
this CL. Since the bug fix affects the bitexactness, as a safety
precaution the CL includes the ability to override the bugfix.

Apart from the contributions from the bugfix, the changes have
been verified to be bitexact for a large set of mono recordings.

Bug: webrtc:10913
Change-Id: I1f307b532be85ef4182f8db41384f44d40a25219
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/156382
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29456}
2019-10-11 21:49:58 +00:00
Gustaf Ullberg
ee84d39fce AEC3: Downmix multichannel signals before delay estimation
Multichannel signals are downmixed to mono before decimation and
delay estimation. This is useful when not all channels play
audio content. The feature can be toggled in the AEC3 configuration.

Bug: webrtc:10913
Change-Id: I7d40edf7732bb51fec69e7f3ca063d821c5069c4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/151762
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29126}
2019-09-10 08:16:07 +00:00
Per Åhgren
eac47f7fae Removing unused fallback variant for the reverb computation
This CL removes a long unused fallback behavior for the reverb
computation.

Bug: webrtc:8671
Change-Id: I4b57795a9bb33769237858f40392881ee235653e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/148520
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28802}
2019-08-08 08:00:38 +00:00
Jonas Olsson
a4d873786f Format almost everything.
This CL was generated by running

git ls-files | grep -P "(\.h|\.cc)$" | grep -v 'sdk/' | grep -v 'rtc_base/ssl_' | \
grep -v 'fake_rtc_certificate_generator.h' | grep -v 'modules/audio_device/win/' | \
grep -v 'system_wrappers/source/clock.cc' | grep -v 'rtc_base/trace_event.h' | \
grep -v 'modules/audio_coding/codecs/ilbc/' | grep -v 'screen_capturer_mac.h' | \
grep -v 'spl_inl_mips.h' | grep -v 'data_size_unittest.cc' | grep -v 'timestamp_unittest.cc' \
| xargs clang-format -i ; git cl format

Most of these changes are clang-format grouping and reordering includes
differently.

Bug: webrtc:9340
Change-Id: Ic83ddbc169bfacd21883e381b5181c3dd4fe8a63
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/144051
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28505}
2019-07-08 13:45:15 +00:00
Jesús de Vicente Peña
70a596386d AEC3: Stationary init: fixing a typo when reading the json configuration
Bug: webrtc:10554
Change-Id: I8c05b7c654117359ff294c7ae4604d7913505650
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/133181
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Jesus de Vicente Pena <devicentepena@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27726}
2019-04-24 07:42:37 +00:00
Per Åhgren
c1d209258a AEC3: Corrected the reading/creation of the json parameter file
Bug: webrtc:8671
Change-Id: Ide8693b3be023e56d3acca38e703c95ba0e9b69b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/133623
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27714}
2019-04-23 13:29:53 +00:00
Gustaf Ullberg
52caa0ef58 AEC3: Configuration parameter for disabling linear filter
The configuration parameter filter.use_linear_filter can be used to
disable the linear filtering. Disabling the linear filter is equivalent
to runing in non-linear mode.

Bug: b/130016532
Change-Id: I8ffdf474822888b9915444bba6cc1c25ec1efe5a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132552
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27566}
2019-04-11 13:19:42 +00:00
Gustaf Ullberg
ec51ce0ce1 AEC3: Remove unused config parameters
This change removes the following unused parameters from the AEC3
configuration:
- render_pre_window_size_init
- render_post_window_size_init
- nonlinear_hold
- nonlinear_release

Bug: webrtc:8671
Change-Id: I8f7a3d350387cd8ada4d507c3a9fab43b7813f5c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/131321
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27450}
2019-04-04 12:36:48 +00:00
Per Åhgren
e8efbbd61b AEC3: Removing unused parameters
This CL removes parameters for AEC3 which are no longer used. To reflect
that change, one of the parameters also is renamed

Bug: chromium:941949,webrtc:8671
Change-Id: I26609b396fa14ecb7523eebfe531a1338718103b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/127780
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27128}
2019-03-14 12:06:40 +00:00
Gustaf Ullberg
9249fbf3a6 AEC3: Redesign delay headroom
This change reduces the risk of echo due to noise in the headroom
of the linear filter.

Changes:
- Use shorter delay headroom
- Delay headroom is specified in samples (not blocks)
- No hysteresis limit when delay is reduced

Bug: chromium:119942,webrtc:10341
Change-Id: I708e80e26d541dff8ca04b6da2d346a1d59cbfcb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/126420
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27126}
2019-03-14 11:04:47 +00:00
Gustaf Ullberg
68d6d44197 AEC3: Remove remaining kill-switches
This CL concludes the post-launch removal of kill-switches is AEC3.

Kill-switches removed:
WebRTC-Aec3AdaptErleOnLowRenderKillSwitch
WebRTC-Aec3AgcGainChangeResponseKillSwitch
WebRTC-Aec3BoundedNearendKillSwitch
WebRTC-Aec3EarlyShadowFilterJumpstartKillSwitch
WebRTC-Aec3EnableAdaptiveEchoReverbEstimation
WebRTC-Aec3EnforceSkewHysteresis1
WebRTC-Aec3EnforceSkewHysteresis2
WebRTC-Aec3FilterAnalyzerPreprocessorKillSwitch
WebRTC-Aec3MisadjustmentEstimatorKillSwitch
WebRTC-Aec3OverrideEchoPathGainKillSwitch
WebRTC-Aec3RapidAgcGainRecoveryKillSwitch
WebRTC-Aec3ResetErleAtGainChangesKillSwitch
WebRTC-Aec3ShadowFilterBoostedJumpstartKillSwitch
WebRTC-Aec3ShadowFilterJumpstartKillSwitch
WebRTC-Aec3SmoothSignalTransitionsKillSwitch
WebRTC-Aec3SmoothUpdatesTailFreqRespKillSwitch
WebRTC-Aec3SoftTransparentModeKillSwitch
WebRTC-Aec3StandardNonlinearReverbModelKillSwitch
WebRTC-Aec3StrictDivergenceCheckKillSwitch
WebRTC-Aec3UseOffsetBlocks
WebRTC-Aec3UseStationarityPropertiesKillSwitch
WebRTC-Aec3UtilizeShadowFilterOutputKillSwitch
WebRTC-Aec3ZeroExternalDelayHeadroomKillSwitch
WebRTC-Aec3FilterQualityStateKillSwitch
WebRTC-Aec3NewSaturationBehaviorKillSwitch
WebRTC-Aec3GainLimiterDeactivationKillSwitch
WebRTC-Aec3EnableErleUpdatesDuringReverbKillSwitch

The change has been tested for bit-exactness.

Bug: webrtc:8671
Change-Id: I42816b9d1c875cec0347034c6e2ed4ff5db6ec0f
Reviewed-on: https://webrtc-review.googlesource.com/c/119942
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26443}
2019-01-29 10:31:45 +00:00
Gustaf Ullberg
e47433f017 AEC3: Remove legacy render buffering
This CL removes the legacy, no longer used, render buffering code. It
also removes four unused parameters from the AEC3 config. The change
is tested for bit-exactness.

Bug: webrtc:8671
Change-Id: I2bb6cb7a1097863f228767d757d551c00593bb00
Reviewed-on: https://webrtc-review.googlesource.com/c/119701
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26399}
2019-01-25 08:31:12 +00:00
Yves Gerey
3e70781361 [Cleanup] Add missing #include. Remove useless ones. IWYU part 2.
This is a follow-up to
https://webrtc-review.googlesource.com/c/src/+/106280.
This time the whole code base is covered.
Some files may have not been fixed though, whenever the IWYU tool
was breaking the build.

Bug: webrtc:8311
Change-Id: I2c31f552a87e887d33931d46e87b6208b1e483ef
Reviewed-on: https://webrtc-review.googlesource.com/c/111965
Commit-Queue: Yves Gerey <yvesg@google.com>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25830}
2018-11-28 18:25:07 +00:00
Jesús de Vicente Peña
44974e143c AEC3: Adding a correction factor for the Erle estimation that depends on the portion of the filter that is currently in use.
In this CL a more precise estimation of the Erle is introduced. This is done by creating different estimators that are specialized in different regions of the linear filter. An estimation of which regions were used for generating the current echo estimate is performed and used for selecting the right Erle estimator.

Bug: webrtc:9961
Change-Id: Iba6eb24596c067c3c66d40df590be379d3e1bb7b
Reviewed-on: https://webrtc-review.googlesource.com/c/109400
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Jesus de Vicente Pena <devicentepena@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25707}
2018-11-20 12:28:05 +00:00
Per Åhgren
370bae466c APM: Adding more explicit handling of failures in the json config data
This CL creates a new API for the parser of APM json config that
that provides an explicit way for the user to know when there has
been an issue in the parsing of the json config data.

Bug: webrtc:9921
Change-Id: Idd8f40529f40ab6871efb5b356c0fd2cea21b7d9
Reviewed-on: https://webrtc-review.googlesource.com/c/107841
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25355}
2018-10-25 10:31:54 +00:00
Per Åhgren
fb5c1eca30 AEC3: Included missing parsing of config parameter
Bug: webrtc:9912,chromium:898462
Change-Id: I8efb60367964d3880ba15ffd18349abd288d7307
Reviewed-on: https://webrtc-review.googlesource.com/c/107654
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25332}
2018-10-24 11:38:40 +00:00
Sam Zackrisson
877dc89f92 Fix errors in AEC3 JSON parsing
Some issues were surfaced during testing:
 - Config validation clamping silently passed NaNs
 - Config validation only fixed the first out-of-bounds parameter, and
   not any subsequent ones
 - Config validation did not check all values in the config
 - use_stationarity_properties_at_init is misspelled in JSON parsing

These changes are identical to those in this CL:
https://webrtc-review.googlesource.com/c/src/+/107120

Bug: webrtc:9535
Change-Id: I36c5e7c69ffdc2c0c24a9be86ccb1df59683c0fe
Reviewed-on: https://webrtc-review.googlesource.com/c/107640
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25318}
2018-10-23 13:29:07 +00:00
Sam Zackrisson
848273aa6a Revert "Increase coverage of AEC3 JSON config unit tests, fix bugs"
This reverts commit 8ee06a7b0c.

Reason for revert: ubsan triggers on config randomization

Original change's description:
> Increase coverage of AEC3 JSON config unit tests, fix bugs
> 
> The new test checks that json strings are unchanged when parsing to a
> config and back to a string. This ensures that everything in the json
> representations is parsed when created a config from the json.
> 
> This CL also adds the render_levels config substruct to the JSON parser.
> 
> Some issues were surfaced by the new test:
>  - Config validation clamping silently passed NaNs
>  - Config validation only fixed the first out-of-bounds parameter, and
>    not any subsequent ones
>  - Config validation did not check all values in the config
> 
> Bug: webrtc:9535
> Change-Id: Ie7b588731dc1fe26ba71d1eb2f177f3b3b8139e3
> Reviewed-on: https://webrtc-review.googlesource.com/c/107120
> Commit-Queue: Sam Zackrisson <saza@webrtc.org>
> Reviewed-by: Per Åhgren <peah@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#25310}

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

Change-Id: I12d4a6e35110241c51c13eff547ee5a640d141bc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:9535
Reviewed-on: https://webrtc-review.googlesource.com/c/107624
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25313}
2018-10-23 12:14:08 +00:00
Sam Zackrisson
8ee06a7b0c Increase coverage of AEC3 JSON config unit tests, fix bugs
The new test checks that json strings are unchanged when parsing to a
config and back to a string. This ensures that everything in the json
representations is parsed when created a config from the json.

This CL also adds the render_levels config substruct to the JSON parser.

Some issues were surfaced by the new test:
 - Config validation clamping silently passed NaNs
 - Config validation only fixed the first out-of-bounds parameter, and
   not any subsequent ones
 - Config validation did not check all values in the config

Bug: webrtc:9535
Change-Id: Ie7b588731dc1fe26ba71d1eb2f177f3b3b8139e3
Reviewed-on: https://webrtc-review.googlesource.com/c/107120
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25310}
2018-10-23 11:08:54 +00:00
Per Åhgren
01cf44d397 AEC3: Adding missing elements to the json parser
Bug: webrtc:9894
Change-Id: I10c23c5df5b262cfb07fc89715e12bc99fc7be3f
Reviewed-on: https://webrtc-review.googlesource.com/c/107201
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25305}
2018-10-23 09:23:11 +00:00
Gustaf Ullberg
c9f9b8711f AEC3: Improve dominant nearend detection
This change makes the dominant nearend detection more accurate.
- The hangover is increased not leave nearend state between words.
- The SNR requirement is increased to not enter nearend state without
  speech activity.
- An early exit mechanism has been added to leave nearend state quickly
  when the echo is strong.

Bug: chromium:897701,webrtc:9897
Change-Id: I9e0f3e6ecb80eee1c0c917d4835f110555f74acf
Reviewed-on: https://webrtc-review.googlesource.com/c/107347
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25299}
2018-10-23 07:05:46 +00:00
Gustaf Ullberg
11539f0b29 AEC3: Simplify render buffering
This CL simplifies the buffering of render data. Instead of making assumptions
about the worst possible platform, it leverages recent improvements in
the delay estimator to quickly adapt when the conditions change.

Pros:
- No capture delay, delay is found ~200 ms faster.
- Cleaner code that makes the concept of delay more clear.
- Allows for removal of one matched filter because of the jitter headroom
removal.

Cons:
- Delay estimator needs to re-adapt when the call jitter increases.

The code can be deactivated by a kill switch. When the kill switch is
pulled the CL is bit exact.

Bug: webrtc:9726,chromium:895338
Change-Id: Ie2f9c8c5ce5b5a4510b4bdb95db2b970b57cd5d0
Reviewed-on: https://webrtc-review.googlesource.com/c/96920
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25169}
2018-10-15 13:31:50 +00:00
Gustaf Ullberg
53e22113fd AEC3: Kill kill-switches
"Perfection is achieved, not when there is nothing more to add,
but when there is nothing left to take away."

This CL removes the following kill-switches from AEC3
- WebRTC-Aec3DownSamplingFactor8KillSwitch
- WebRTC-Aec3NewSuppressionKillSwitch
- WebRTC-Aec3ShadowFilterJumpstartKillSwitch
- WebRTC-Aec3SlowFilterAdaptationKillSwitch
- WebRTC-Aec3SuppressorNearendAveragingKillSwitch

It also removes code paths and configuration parameters that are no
longer in use. The list of kill-switches in the audio processing
fuzzer test is updated.

The change has been tested for bit-exactness.

Bug: webrtc:8671
Change-Id: Ie0af86a14baf853548bf9c00b2b9b3bbc32c1aaa
Reviewed-on: https://webrtc-review.googlesource.com/c/105324
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25120}
2018-10-11 16:11:07 +00:00
Sam Zackrisson
703259c6e9 Don't CHECK when parsing AEC3 parameters from json
This CL replaces CHECKs and crashes with DCHECKs and default values.

Bug: webrtc:9535
Change-Id: Ib4b16421699c633d0e9ef140189861c8179450f4
Reviewed-on: https://webrtc-review.googlesource.com/c/105003
Reviewed-by: Alex Loiko <aleloi@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25111}
2018-10-11 10:37:41 +00:00
Sam Zackrisson
a4c8514258 Add JSON parsing and corresponding ToString to EchoCanceller3Config
Bug: webrtc:9535
Change-Id: I51eaaac4009a30536444292a32938b21e69386bf
Reviewed-on: https://webrtc-review.googlesource.com/c/102980
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Alex Loiko <aleloi@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25083}
2018-10-10 09:17:09 +00:00