This helps with making AudioBuffer compatible with current and upcoming
code that uses audio_views.h (a simpler abstraction).
Bug: chromium:335805780
Change-Id: Ib59bba274c7abfb441e3c4d606f804b365df236d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/355844
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42590}
This switches from accepting a sample rate and convert to channel
size over to accepting the channel size.
Instead of InitializeIfNeeded:
* Offer a way to explicitly initialize PushResampler via the ctor
(needed for VoiceActivityDetectorWrapper)
* Implicitly check for the right configuration from within Resample().
(All calls to Resample() were preceded by a call to Initialize)
As part of this, refactor VoiceActivityDetectorWrapper (VADW):
* VADW is now initialized in the constructor and more const.
* Remove VADW::Initialize() and instead reconstruct VADW if needed.
Add constants for max sample rate and num channels to audio_util.h
In many cases the numbers for these values are embedded in the code
which has led to some inconsistency.
Bug: chromium:335805780
Change-Id: Iead0d52eb1b261a8d64e93f51401147c8fba32f0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/353360
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42587}
* FrameCombiner is simpler. No additional channel pointers for buffers.
* Improve consistency in using views in downstream classes.
* Deprecate older methods (some have upstream dependencies).
* Use samples per channel instead of sample rate where the former is
really what's needed.
Bug: chromium:335805780
Change-Id: I0dde8ed7a5a187bbddd18d3b6c649aa0865e6d4a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/352582
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42575}
Using DeinterleavedView<> simplifies these two classes, so now the
classes are arguably thin wrappers on top of DeinterleavedView<> and
AudioFrameView<> can be replaced with DeinterleavedView<>.
The changes are:
* Make VectorFloatFrame not use a vector of vectors but rather
just hold a one dimensional vector of samples and leaves the mapping
into the buffer up to DeinterleavedView<>.
* Remove the `channel_ptrs_` vector which was required due to an
issue with AudioFrameView.
* AudioFrameView is now a wrapper over DeinterleavedView<>. The most
important change is to remove the `audio_samples_` pointer, which
pointed into an externally owned pointer array (in addition to
the array that holds the samples themselves). Now AudioFrameView
can be initialized without requiring such a long-lived array.
Bug: chromium:335805780
Change-Id: I8f3c23c0ac4b5a337f68e9161fc3a97271f4e87d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/352504
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42498}
This simplifies the following steps:
* FrameCombiner infers the sample rate from channel size
* Sends the inferred sample rate to FixedDigitalLevelEstimator
and Limiter.
* Those classes then convert the sample rate to channel size.
Along the way perform checks that the derived channel size value
is a legal value (which has already been done by FrameCombiner).
To:
* FrameCombiner sends channel size to FixedDigitalLevelEstimator and
Limiter.
Bug: chromium:335805780
Change-Id: I6d2953ba5ee99771f3ff5bf4f4a049a8a29b5577
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/352581
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42480}
Along the way slightly simplify the class interface since views
carry audio properties. Also, now allocating FrameCombiner allocates
the mixing buffer in the same allocation.
Bug: chromium:335805780
Change-Id: Id7a76b040c11064e1e4daf01a371328769162554
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/352502
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42465}
Allow skipping the deinterleaving steps in PushResampler
before resampling when deinterleaved buffers already exist.
Bug: chromium:335805780
Change-Id: I2080ce2624636cb743beef78f6f08887db01120f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/352202
Reviewed-by: Per Åhgren <peah@webrtc.org>
Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42438}
Interleave and Deinterleave now accept two parameters, one for the
interleaved buffer and another for the deinterleaved one.
The previous versions of the functions still need to exist for test
code that uses ChannelBuffer.
Bug: chromium:335805780
Change-Id: I20371ab6408766d21e6901e6a04000afa05b3553
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/351664
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42412}
From the new header file:
* MonoView<>: A single channel contiguous buffer of samples.
* InterleavedView<>: Channel samples are interleaved (side-by-side) in
the buffer. A single channel InterleavedView<> is the same thing as a
MonoView<>
* DeinterleavedView<>: Each channel's samples are contiguous within the
buffer. Channels can be enumerated and accessing the
individual channel data is done via MonoView<>.
There are also a few utility functions that offer a unified way to check
the properties regardless of what view type is in use.
Bug: chromium:335805780
Change-Id: I28196f8f4ded4fadc72ee32b62af304c62f4fc47
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/349300
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42377}
- Assume a non-zero probability of starting in transparent state
(transparent mode can be reached sooner).
- Relax the requirements for when the filter is considered converged
(reduces the risk of incorrectly entering transparent mode in the
presence of near-end noise).
Bug: b/340578713
Change-Id: I6be9b5b74457066f9900c8020c0ebf19623a70df
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/350602
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42318}
The 'apmtest' folder contains code that is not part of any build graph
and has not been updated since 2017 since the code migrated locations.
At a glance, it does not seem to be testing anything specific to the
audio-processing module either.
This implicitly resolves the usage of the deprecated ALooper_pollAll API
by removing the code entirely.
Bug: webrtc:42225691
Change-Id: I79e14140ee40c567e1d07431f874d5f48e39d384
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/350270
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42299}
Start introducing ArrayView to AudioFrame and code that flows down
from there. In this first step:
* Add `data_view()` that returns a read-only ArrayView for the
audio buffer. When AudioFrame is not initialized however, data_view()
will return a nullptr whereas the current data() method never returns
nullptr.
* Add `mutable_data()` that requires two arguments for properly setting
the samples per channel and number of channels that's required for
accurately reserving the returned mutable ArrayView.
A notable behavior change is that if the requested number of channels
is larger than supported or the calculated buffer size is too large,
the function will trigger a check.
* Add TODOs for following work.
Bug: chromium:335805780
Change-Id: I2937de800422589ebe6a3840b3caadf3d9ff8b00
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/347982
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42202}
This hard-codes the behavior to mode 3 with a threshold of 0.5 like was
already done by FetchPreEchoConfiguration.
Bug: webrtc:14205
Change-Id: I48d47a77c9df0001460788b504524203417f9647
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/345483
Commit-Queue: Emil Lundmark <lndmrk@webrtc.org>
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42015}
Replace num_proc_channels() with num_output_channels() in
GainController2. The number of channels is only used in
InputVolumeController.
Bug: webrtc:7494
Change-Id: I6b3f66980a518401fefab304e18c9910eee28d4e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/338922
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Hanna Silen <silen@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41717}
rtc::TaskQueue is a wrapper of TaskQueueBase providing no extra functionality in this case
Bug: webrtc:14169
Change-Id: I5eb27a5dbb16f6097a9c71c2633c807808e50c05
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/333800
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41501}
Reasons:
- the code is no longer used in Chrome
- it is conceptually weird for WebRTC to have JSON parsing in its API
- there are concerns around the reliability of the underlying JSON library
Additionally, this CL removes the rtc_json "poisonous" attribute: the scheme is incompatible and redundant with testonly.
Bug: webrtc:1493351
Change-Id: I0b621b0e3f183df7315919d9c89242fbe387928f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/325062
Reviewed-by: Per Åhgren <peah@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41014}
rtc::strcpyn second param should be the size of the destination buffer,
not the size of the source string. The result is that the final character
(usually a trailing directory path separator) is lost during the copy.
This has been masked because FormFileName helpfully adds a trailing path
separator if one is missing.
BUG=webrtc:15441
Change-Id: I992e69cad86a7e8bc2057ec629063f34c75fe75f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/317502
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40736}