1061 Commits

Author SHA1 Message Date
Alex Loiko
dc5fc82c62 Remove older AEC-dump interface.
This CL completely removes the methods
AudioProcessing::{Start,Stop}DebugDumpRecording. These methods have
been replaced with AudioProcessing::{Attach,Detach}AecDump. Their
implementation was removed in the parent CL
https://chromium-review.googlesource.com/c/589147

Bug: webrtc:7404
Change-Id: Ia3d5314985af9c74f79c94c514ded1f8afc78fb5
Reviewed-on: https://chromium-review.googlesource.com/589152
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19334}
2017-08-14 10:35:40 +00:00
Alex Loiko
7731bc829c Remove older AEC-dump implementation.
AudioProcessingModule has a feature to make a recording of its
configuration, inputs and outputs over a period of time. In the past
CLs, this feature has been rewritten to move file IO away from
real-time audio threads. The interface has changed from
{Start,Stop}DebugDumpRecording to {Attach,Detach}AecDump.

This CL removes the previous implementation of the old interface
StartDebugRecording. The public interface is left to not cause
problems to downstream projects. It will be removed in the dependent
CL https://chromium-review.googlesource.com/c/589152/

With this CL, usage of WEBRTC_AUDIOPROC_DEBUG_DUMP and ~300 LOC of
logging code is removed from AudioProcessingImpl.

Bug: webrtc:7404
Change-Id: I16e7b557774e4bc997e1f5de4f97ed2c31d63879
Reviewed-on: https://chromium-review.googlesource.com/589147
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19332}
2017-08-14 08:46:30 +00:00
kwiberg
ee89e7870c Replace CHECK(x && y) with two separate CHECK() calls
That way, the debug printout will tell us which of x and y that was false.

BUG=none

Review-Url: https://codereview.webrtc.org/2988153003
Cr-Commit-Position: refs/heads/master@{#19297}
2017-08-10 00:22:01 +00:00
agrieve
26622d3ff8 Audit of kConstants missing the const qualifier
Found via supersize query:
size_info.symbols.WhereFullNameMatches(r'\bk[A-Z]').WhereInSection('d')

This moves 90 symbols from .data -> .data.rel.ro (5.50kb)

BUG=chromium:747064

Review-Url: https://codereview.webrtc.org/2986163002
Cr-Commit-Position: refs/heads/master@{#19274}
2017-08-08 17:48:15 +00:00
alessiob
ddfa252b50 TestDataGenerators attempts to create missing input signal files.
If the input file name matches the "<name>-<params>.wav" pattern and <name> is a valid signal creator name, then <params> is parsed and used to create a new signal which is written in place of the missing file.

This CL only adds a pure tone creator. For instance, 'pure_tone-440_1000.wav' creates a pure tone at 440 Hz, 1000 ms long, mono, sampled at 48kHz.

This feature can be used to simplify the creation of common probe signals - no need to add external .wav files. Also, it will be exploited by a coming CL that adds a new evaluation score requiring the input signal to be a pure tone.

Additional minor fixes:
- apm_quality_assessment_unittest.py: command line arguments replaced to avoid that those for the unit test framework are passed
- simulation_unittest.py: invalid evaluation score name replaced

BUG=webrtc:7218

Review-Url: https://codereview.webrtc.org/2989823002
Cr-Commit-Position: refs/heads/master@{#19200}
2017-08-01 12:44:18 +00:00
alessiob
fdd568eb25 This CL is a refactoring of the APM QA tool; it includes the following changes:
- render stream support, required to assess AEC;
- echo path simulation and input mixer, to generate echo and add it to the
speech signal;
- export engine: improved UI, switch to Pandas DataFrames;
- minor design improvements and needed adaptions.

BUG=webrtc:7218

Review-Url: https://codereview.webrtc.org/2813883002
Cr-Commit-Position: refs/heads/master@{#19198}
2017-08-01 11:37:21 +00:00
Alex Loiko
e029d99f19 Integer overflow bug in low_cut_filter.
A multiplication result doesn't fit in an int32_t type. This change
rewrites the code to avoid the overflowing multiplication.

Here y[0], y[1] are int16 numbers containing the (truncated) topmost
18 and (scaled Q2 to use the full int16) the least significant 13
bits of a 32-bit value. The change makes y[1] to be calculated 
directly instead of using y[0] as an intermediate value. 

TESTED=this change passes the bit exactness tests, and has also been 
running on the audio_processing fuzzer with a CHECK comparing the
old and new value.

Bug: chromium:747202
Change-Id: Iafc69eb7391d494afdadf65f5b7f399a57bbe9a8
Reviewed-on: https://chromium-review.googlesource.com/580907
Reviewed-by: Minyue Li <minyue@webrtc.org>
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19120}
2017-07-24 11:03:46 +00:00
ehmaldonado
f6a861ab6c Remove remains of webrtc/base
All downstream code have been updated to the new location.

In PRESUBMIT.py:
* Remove webrtc/rtc_base from CPP_BLACKLIST
* Add webrtc/rtc_base to LEGACY_API_DIRS

Fix some duplicated paths in
webrtc/modules/audio_processing/test/conversational_speech/BUILD.gn

BUG=webrtc:7634
TBR=kwiberg@webrtc.org

Review-Url: https://codereview.webrtc.org/2976293002
Cr-Commit-Position: refs/heads/master@{#19094}
2017-07-19 17:40:47 +00:00
Alex Loiko
b5c1607e92 UBSan fuzzer bug in LowCutFilter::BiqueadFilter::Process
The variable 'tmp_int32' in LowCutFilter::BiqueadFilter::Process can
be negative. This replaces a left shift with multiplication.

Bug: chromium:735593, chromium:743330
Change-Id: Idec7fbcc17495f7241eb4bea44920585740e3695
Reviewed-on: https://chromium-review.googlesource.com/575136
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19074}
2017-07-18 12:23:08 +00:00
saza
f91b0b49f9 Set memory to all-zero floats in ExtractExtendedBlock in AEC2 if buffer is empty.
This avoids a memcopy call which may corrupt audio handling and, in rare cases, crash WebRTC with a buffer over-read.

BUG=webrtc:7845

Review-Url: https://codereview.webrtc.org/2980723002
Cr-Commit-Position: refs/heads/master@{#18984}
2017-07-12 08:43:14 +00:00
saza
10b0d03673 Removes internal buffer memory check in AEC module.
The check triggered in 30 / 1000 cases of running PeerConnectionIntegrationTest.CallTransferredForCaller locally, far more often than expected.

It will soon be replaced by more graceful handling.

BUG=webrtc:7845

Review-Url: https://codereview.webrtc.org/2975043002
Cr-Commit-Position: refs/heads/master@{#18983}
2017-07-12 07:29:36 +00:00
jianjun.zhu
c024740b5e Use relative paths in GN files.
BUG=webrtc:7952
TBR=kjellander@webrtc.org
NOTRY=True

Review-Url: https://codereview.webrtc.org/2974863003
Cr-Commit-Position: refs/heads/master@{#18970}
2017-07-11 13:20:45 +00:00
peah
14c11a4712 Add adaptive notch filter to remove narrowband echo components in AEC3
This CL adds detection of components in the render signal that are of
strong narrowband nature and therefore may cause problems for the AEC.
This CL also adds functionality in the echo suppressor to suppress
these signals

BUG=webrtc:7967

Review-Url: https://codereview.webrtc.org/2980493002
Cr-Commit-Position: refs/heads/master@{#18968}
2017-07-11 13:13:43 +00:00
peah
5e6685ff35 Robustification of the AEC3 echo removal in the first part of the call
This CL robustifies the echo removal in AEC3 during the initial parts
of a call in two ways:
-By extending the period until which a headset is deemed to be used.
-By increasing the assumed echo path gain for unknown echo paths at
higher frequencies.

BUG=webrtc:7971

Review-Url: https://codereview.webrtc.org/2974883002
Cr-Commit-Position: refs/heads/master@{#18967}
2017-07-11 11:19:58 +00:00
peah
2910357621 Transparency improvements in the echo canceller 3
This CL adds two changes:
-Adaptive adjustment of the echo suppression to both cover the cases
when the echo path well covers the room, and when when it does not.
-Identification of the case when the echo is too low to be audible
and adaptive handling of this case in the echo suppression.

BUG=webrtc:7519, webrtc:7956,webrtc:7957

Review-Url: https://codereview.webrtc.org/2974583004
Cr-Commit-Position: refs/heads/master@{#18962}
2017-07-11 09:54:02 +00:00
ehmaldonado
370dd47973 Revert of Remove remains of webrtc/base (patchset #7 id:120001 of https://codereview.webrtc.org/2973183002/ )
Reason for revert:
Breaks lots of downstream projects.

Original issue's description:
> Remove remains of webrtc/base
>
> All downstream code have been updated to the new location.
>
> In PRESUBMIT.py:
> * Remove webrtc/rtc_base from CPP_BLACKLIST
> * Add webrtc/rtc_base to LEGACY_API_DIRS
>
> Fix some duplicated paths in
> webrtc/modules/audio_processing/test/conversational_speech/BUILD.gn
>
> BUG=webrtc:7634
> TBR=kwiberg@webrtc.org
>
> Review-Url: https://codereview.webrtc.org/2973183002
> Cr-Commit-Position: refs/heads/master@{#18948}
> Committed:
9483b49baf

TBR=kwiberg@webrtc.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:7634

Review-Url: https://codereview.webrtc.org/2976633002
Cr-Commit-Position: refs/heads/master@{#18949}
2017-07-10 12:58:42 +00:00
ehmaldonado
9483b49baf Remove remains of webrtc/base
All downstream code have been updated to the new location.

In PRESUBMIT.py:
* Remove webrtc/rtc_base from CPP_BLACKLIST
* Add webrtc/rtc_base to LEGACY_API_DIRS

Fix some duplicated paths in
webrtc/modules/audio_processing/test/conversational_speech/BUILD.gn

BUG=webrtc:7634
TBR=kwiberg@webrtc.org

Review-Url: https://codereview.webrtc.org/2973183002
Cr-Commit-Position: refs/heads/master@{#18948}
2017-07-10 11:50:54 +00:00
saza
5de068082b Add a check in the BlockBuffer of AEC2 to guard for buffer overflows.
Ensure that the ring buffer does not return a pointer into the buffer if
no data is available to read.

The ring buffer fix is not directly applicable to issue webrtc:7845, but may cause related memory errors.

BUG=webrtc:7845

Review-Url: https://codereview.webrtc.org/2971313002
Cr-Commit-Position: refs/heads/master@{#18940}
2017-07-10 08:01:09 +00:00
peah
fb660ae633 Decreased the adaptation rate for the adaptive filter in the echo canceller 3
BUG=webrtc:7955

Review-Url: https://codereview.webrtc.org/2968223003
Cr-Commit-Position: refs/heads/master@{#18932}
2017-07-07 14:59:24 +00:00
ehmaldonado
eaaae9e91b base->rtc_base: Update .c, .mm and .java files.
TBR=kwiberg@webrtc.org
BUG=webrtc:7634

Review-Url: https://codereview.webrtc.org/2974613003
Cr-Commit-Position: refs/heads/master@{#18926}
2017-07-07 10:09:51 +00:00
Edward Lemur
c20978e581 Rename webrtc/base -> webrtc/rtc_base
NOPRESUBMIT=True # cpplint errors that aren't caused by this CL.
NOTRY=True
NOTREECHECKS=True
TBR=kwiberg@webrtc.org, kjellander@webrtc.org

Bug: webrtc:7634
Change-Id: I3cca0fbaa807b563c95979cccd6d1bec32055f36
Reviewed-on: https://chromium-review.googlesource.com/562156
Commit-Queue: Edward Lemur <ehmaldonado@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#18919}
2017-07-06 19:11:40 +00:00
peah
2c3161c86e Changed default value for the duration of the echo in echocanceller 3
BUG=webrtc:7519

Review-Url: https://codereview.webrtc.org/2971683002
Cr-Commit-Position: refs/heads/master@{#18887}
2017-07-04 11:33:11 +00:00
peah
d3588cfb31 Improved low-level echo handling in echo canceller 3
This CL addresses the issue of echo leakage of low level
echoes by making the echo canceller more restrictive for
that scenario.

BUG=webrtc:7930

Review-Url: https://codereview.webrtc.org/2969943002
Cr-Commit-Position: refs/heads/master@{#18884}
2017-07-04 08:54:37 +00:00
peah
4235d78b57 Disabling flaky complexity tests for the audio processing module.
The complexity test for the audio processing module have long proven
to give false alarms of complexity regressions for which no related
changes can be identified. Attempts to address that has improved the
that, but the tests do still give false alarms.

This CL deactivates the complexity tests until a better way of
testing this is available.

BUG=chromium:713507, webrtc:5846,webrtc:6685,webrtc:7712

Review-Url: https://codereview.webrtc.org/2897403006
Cr-Commit-Position: refs/heads/master@{#18879}
2017-07-03 16:11:22 +00:00
Henrik Kjellander
dca1e09db7 Revert "Update includes for webrtc/{base => rtc_base} rename (1/3)"
This reverts commit c8fa692ec44fd6ba4fa3d085ac3161a262fc18c5.

BUG=webrtc:7634
NOTRY=True
NOPRESUBMIT=True

Review-Url: https://codereview.webrtc.org/2964773002 .
Cr-Commit-Position: refs/heads/master@{#18872}
2017-07-01 14:42:25 +00:00
kjellander
c8fa692ec4 Update includes for webrtc/{base => rtc_base} rename (1/3)
I used a command like this to update the paths:
perl -pi -e "s/webrtc\/base/webrtc\/rtc_base/g" `find webrtc/rtc_base -name "*.cc" -o -name "*.h"`

The only manual edit is to add an include of webrtc/rtc_base/checks.h in
webrtc/modules/audio_device/android/opensles_common.h, which likely
was needed due to changed include paths due to 'git cl format'.

BUG=webrtc:7634
NOTRY=True
NOPRESUBMIT=True

Review-Url: https://codereview.webrtc.org/2969653002
Cr-Commit-Position: refs/heads/master@{#18871}
2017-06-30 21:02:00 +00:00
peah
697a590314 Added the ability to adjust the AEC3 performance for large rooms
This CL exposes the parameter for adjusting the AEC3 performance
for large rooms.

Bug: webrtc:7519
Review-Url: https://codereview.webrtc.org/2967603002
Cr-Commit-Position: refs/heads/master@{#18862}
2017-06-30 14:06:10 +00:00
Per Åhgren
9aed31c24e Temporarily removed the analog gain change detection in AEC3
Due to the implementation of the analog AGC in the audio
processing module, the detection for the analog gain done in AEC3
fails on some platforms where there is no analog gain to control.

This CL removes that functionality until the AGC behavior has
been corrected.


Bug: webrtc:7910, chromium:738322
Change-Id: Ibdbe1e02252387dfd94b36ba7471f5c56ae27f48
Reviewed-on: https://chromium-review.googlesource.com/556040
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#18850}
2017-06-30 10:27:56 +00:00
peah
8f9ce1d991 Corrected the limit on the allowed API jitter in AEC3
This CL loosens the requirement on the API jitter in APM
that can be tolerated without affecting the AEC3 performance.

BUG=webrtc:7911,chromium:738323

Review-Url: https://codereview.webrtc.org/2967493004
Cr-Commit-Position: refs/heads/master@{#18849}
2017-06-30 10:13:21 +00:00
kjellander
d2b63cf131 Move webrtc/{tools => rtc_tools}
Leaving compatibility script in webrtc/tools/compare_videos.py to
avoid breaking our video quality tests in Chromium.
Forwarding GN targets are left in webrtc/tools/BUILD.gn.

BUG=webrtc:7855
NOTRY=True
NOPRESUBMIT=True

Review-Url: https://codereview.webrtc.org/2965593002
Cr-Commit-Position: refs/heads/master@{#18848}
2017-06-30 10:04:59 +00:00
peah
a9cc40b7d2 Allow an external audio processing module to be used in WebRTC
[This CL is a rebase of an original CL by solenberg@:
https://codereview.webrtc.org/2948763002/ which in turn was a
rebase of an original CL by peah@:
https://chromium-review.googlesource.com/c/527032/]

Allow an external audio processing module to be used in WebRTC

This CL adds support for optionally using an externally created audio
processing module in a peerconnection. The ownership is shared
between the peerconnection and the external creator of the module.

As part of this the internal ownership of the audio processing module
is moved from VoiceEngine to WebRtcVoiceEngine.

BUG=webrtc:7775

Review-Url: https://codereview.webrtc.org/2961723004
Cr-Commit-Position: refs/heads/master@{#18837}
2017-06-29 15:32:09 +00:00
Alex Loiko
9f789a4500 LowCutFilter::BiqueadFilter::Process: Fix UBSan fuzzer bug
(left shift of negative value)


Bug: chromium:735593
Change-Id: I9f1165370d850456480fbb22ce2434bf933a420b
Reviewed-on: https://chromium-review.googlesource.com/552136
Commit-Queue: Alex Loiko <aleloi@google.com>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#18812}
2017-06-28 14:55:20 +00:00
Per Åhgren
4bdced5d93 Corrected the initialization of the AEC3
This CL corrects the initialization of the AEC3, as well 
as for the other submodules in the whole audio processing module
in the sense that it properly update the submodule states also
for the case when reinitialization is trigger from the render
side of the audio processing module.

Bug: chromium:736889,webrtc:7879
Change-Id: I423e963835d0c3227caa8e186b29031bcb912515
Reviewed-on: https://chromium-review.googlesource.com/549315
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#18784}
2017-06-27 14:43:03 +00:00
Per Åhgren
f0a6fb19c6 Corrected the computation of the headroom in the AEC3 buffer alignment
This CL corrects the computation of the delay headroom so that
it is only updated when the delay is updated. This is important
as otherwise a too large headroom will be reported, which then
could cause buffer access issues.

Bug: webrtc:7878, chromium:736893
Change-Id: Ib37cb608b064dd5d4df3f8fc423448ee80ed0106
Reviewed-on: https://chromium-review.googlesource.com/549335
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#18781}
2017-06-27 11:42:37 +00:00
Alex Loiko
57ff3f4ec8 Remove aec_dump_unittests from audio_processing_tests.
It was included twice. In both of these targets:
webrtc/modules/audio_processing:{audio_processing_tests,
     audio_processing_unittests}

In audio_processing_tests, the new unit tests were added to 
public_deps, which (we think) somehow caused webrtc:webrtc_tests
to list the AecDump tests, to much confusion. 

Bug: webrtc:7404
Change-Id: I5788d93fef00d30a523312f317dde90eb64db8de
Reviewed-on: https://chromium-review.googlesource.com/543120
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#18715}
2017-06-22 12:18:51 +00:00
brucedawson
fde2116288 Use constexpr to avoid a static initializer
Floating-point calculations are not guaranteed to happen at compile time
unless you force the issue with constexpr. This initializer was found
by running tools\win\static_initializers on a canary build
chrome_child.dll. constexpr was added to kSilenceRms for consistency.

BUG=chromium:341941

Review-Url: https://codereview.webrtc.org/2943833002
Cr-Commit-Position: refs/heads/master@{#18684}
2017-06-20 17:57:09 +00:00
alessiob
19e087fc91 This CL finalizes the Conversational Speech tool.
The following changes have been made:
- command line args wired,
- user output added,
- final polishing.

BUG=webrtc:7218

Review-Url: https://codereview.webrtc.org/2808053002
Cr-Commit-Position: refs/heads/master@{#18609}
2017-06-15 10:49:57 +00:00
alessiob
f9784f23d7 Reland of Conversational speech tool, simualtor + unit tests (patchset #1 id:1 of https://codereview.webrtc.org/2925123003/ )
Reason for revert:
Build file causing google3 compilation error fixed

Original issue's description:
> Revert of Conversational speech tool, simualtor + unit tests (patchset #12 id:220001 of https://codereview.webrtc.org/2790933002/ )
>
> Reason for revert:
> Compile Error.
>
> Original issue's description:
> > The simulator puts into action the schedule of speech turns encoded in a MultiEndCall instance. The output is a set of audio track pairs. There is one set for each speaker and each set contains one near-end and one far-end audio track. The tracks are directly written into wav files instead of creating them in memory. To speed up the creation of the output wav files, *all* the source audio tracks (i.e., the atomic speech turns) are pre-loaded.
> >
> > The ConversationalSpeechTest.MultiEndCallSimulator unit test defines a conversational speech sequence and creates two wav files (with pure tones at 440 and 880 Hz) that are used as atomic speech turn tracks.
> >
> > This CL also patches MultiEndCall in order to allow input audio tracks with same sample rate and single channel only.
> >
> > BUG=webrtc:7218
> >
> > Review-Url: https://codereview.webrtc.org/2790933002
> > Cr-Commit-Position: refs/heads/master@{#18480}
> > Committed: 6b648c4697
>
> TBR=minyue@webrtc.org,alessiob@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7218
>
> Review-Url: https://codereview.webrtc.org/2925123003
> Cr-Commit-Position: refs/heads/master@{#18481}
> Committed: 4c72cf43df

TBR=minyue@webrtc.org,charujain@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:7218

Review-Url: https://codereview.webrtc.org/2930853002
Cr-Commit-Position: refs/heads/master@{#18606}
2017-06-15 09:24:59 +00:00
aleloi
f4dd191b28 Change existing aec dump tests to use webrtc::AecDump.
Currently the debug dump functionality of WebRTC (a log of all
AudioProcessing operations) was tested by the following tests:

1. ApmTest.VerifyDebugDump* which configures and runs AudioProcessing
   from a debug dump, and verifies that the same debug dump is
   recorded.
2. DebugDumpTest.* which is a comprehensive test of the debug dump
   operations. AudioProcessing configuration is changed, and the dump
   is scanned for the change.
3. ApmTest::{DebugDump, DebugDumpFromFileHandle} that verify that
   debug dumping can be started and files written.

This CL replaces the debug dump mechanism in all these tests to
webrtc::AecDump. Some of the tests are adapted to the chenges of the
new API to AecDump {Start,Stop}DebugRecording: the old functions
signal errors when a file cannot be opened. With AecDump, the
AecDumpFactory instead returns a nullptr.

The CL also changes audioproc_f to use AecDump.

BUG=webrtc:7404

Review-Url: https://codereview.webrtc.org/2864373002
Cr-Commit-Position: refs/heads/master@{#18605}
2017-06-15 08:55:38 +00:00
yujo
36b1a5fcec Add mute state field to AudioFrame and switch some callers to use it. Also make AudioFrame::data_ private and instead provide:
const int16_t* data() const;
int16_t* mutable_data();

- data() returns a zeroed static buffer on muted frames (to avoid unnecessary zeroing of the member buffer) and directly returns AudioFrame::data_ on unmuted frames.
- mutable_data(), lazily zeroes AudioFrame::data_ if the frame is currently muted, sets muted=false, and returns AudioFrame::data_.

These accessors serve to "force" callers to be aware of the mute state field, i.e. lazy zeroing is not the primary motivation.

This change only optimizes handling of muted frames where it is somewhat trivial to do so. Other improvements requiring more significant structural changes will come later.

BUG=webrtc:7343
TBR=henrika

Review-Url: https://codereview.webrtc.org/2750783004
Cr-Commit-Position: refs/heads/master@{#18543}
2017-06-12 19:45:32 +00:00
kwiberg
0703856b53 Add SafeClamp(), which accepts args of different types
Specifically, just like SafeMin() and SafeMax() it handles all
combinations of integer and all
combinations of floating-point arguments by picking a
result type that is guaranteed to be able to hold the result.

This CL also replaces a bunch of std::min + std:max call pairs with
calls to SafeClamp()---the ones that could easily be found by grep
because "min" and "max" were on the same line. :-)

BUG=webrtc:7459

Review-Url: https://codereview.webrtc.org/2808513003
Cr-Commit-Position: refs/heads/master@{#18542}
2017-06-12 18:40:47 +00:00
Alex Loiko
be767e0f7a Remove default impl of Attach/DetachAecDump.
The default implementations of AudioProcessing::{AttachAecDump,
DetachAecDump} are removed and audio_processing.cc is decoupled from
aec_dump.h. After this CL, the two methods are pure virtual. The
default implementations were added because doing otherwise would break
internal projects.

Bug: webrtc:7404
Change-Id: If94f60aeefe4ad1eefed3744f857692cc645bdf4
Reviewed-on: https://chromium-review.googlesource.com/528132
Commit-Queue: Alex Loiko <aleloi@google.com>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#18517}
2017-06-09 17:18:31 +00:00
Per Åhgren
46537a3879 Avoiding cascaded software echo cancellers
This CL ensures that it is not possible to run several echo canceller
solutions in cascade inside the audio processing module.

Bug: webrtc:7776
Change-Id: I1777f97aeacb8cdf5c6c3be4bf13eefcde7d69fb
Reviewed-on: https://chromium-review.googlesource.com/527053
Reviewed-by: Alex Loiko <aleloi@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#18505}
2017-06-08 22:39:03 +00:00
aleloi
20e4a73b9b MockAecDump and integration tests between AecDump and AudioProcessing
This CL adds a MockAecDump and integration tests that inject the mock
into AudioProcessingImpl. The tests check the call pattern between
AudioProcessingImpl and AecDump. The existing tests ApmTest.* and
DebugDumpTest.* (not touched by this CL) check that the data written
by AecDumpImpl is valid.

The tests check that the protobuf-writing methods for the different
protobuf message types in audio_processing/debug.proto are indeed
called for the different modes of AudioProcessingImpl operation.

BUG=webrtc:7404

Review-Url: https://codereview.webrtc.org/2888533005
Cr-Commit-Position: refs/heads/master@{#18501}
2017-06-08 15:12:46 +00:00
Alex Loiko
04ca637be3 Make 'aleloi@' OWNER of webrtc/modules/audio_processing
This reflects currently active developers of the module.

NOTRY=True

Bug: None
Change-Id: Ibc0810b08db753404fcb94038a4bd857d5585ef9
Reviewed-on: https://chromium-review.googlesource.com/528075
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#18492}
2017-06-08 09:36:10 +00:00
charujain
4c72cf43df Revert of Conversational speech tool, simualtor + unit tests (patchset #12 id:220001 of https://codereview.webrtc.org/2790933002/ )
Reason for revert:
Compile Error.

Original issue's description:
> The simulator puts into action the schedule of speech turns encoded in a MultiEndCall instance. The output is a set of audio track pairs. There is one set for each speaker and each set contains one near-end and one far-end audio track. The tracks are directly written into wav files instead of creating them in memory. To speed up the creation of the output wav files, *all* the source audio tracks (i.e., the atomic speech turns) are pre-loaded.
>
> The ConversationalSpeechTest.MultiEndCallSimulator unit test defines a conversational speech sequence and creates two wav files (with pure tones at 440 and 880 Hz) that are used as atomic speech turn tracks.
>
> This CL also patches MultiEndCall in order to allow input audio tracks with same sample rate and single channel only.
>
> BUG=webrtc:7218
>
> Review-Url: https://codereview.webrtc.org/2790933002
> Cr-Commit-Position: refs/heads/master@{#18480}
> Committed: 6b648c4697

TBR=minyue@webrtc.org,alessiob@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:7218

Review-Url: https://codereview.webrtc.org/2925123003
Cr-Commit-Position: refs/heads/master@{#18481}
2017-06-07 18:59:09 +00:00
alessiob
6b648c4697 The simulator puts into action the schedule of speech turns encoded in a MultiEndCall instance. The output is a set of audio track pairs. There is one set for each speaker and each set contains one near-end and one far-end audio track. The tracks are directly written into wav files instead of creating them in memory. To speed up the creation of the output wav files, *all* the source audio tracks (i.e., the atomic speech turns) are pre-loaded.
The ConversationalSpeechTest.MultiEndCallSimulator unit test defines a conversational speech sequence and creates two wav files (with pure tones at 440 and 880 Hz) that are used as atomic speech turn tracks.

This CL also patches MultiEndCall in order to allow input audio tracks with same sample rate and single channel only.

BUG=webrtc:7218

Review-Url: https://codereview.webrtc.org/2790933002
Cr-Commit-Position: refs/heads/master@{#18480}
2017-06-07 18:04:35 +00:00
nisse
7926c12933 Delete unneeded includes of system_wrappers/include/sleep.h
BUG=None

Review-Url: https://codereview.webrtc.org/2915903003
Cr-Commit-Position: refs/heads/master@{#18380}
2017-06-01 12:34:08 +00:00
peah
1b92722ad5 Simplified the ERLE computation code in AEC3
BUG=webrtc:7519

Review-Url: https://codereview.webrtc.org/2901253002
Cr-Commit-Position: refs/heads/master@{#18249}
2017-05-24 06:44:47 +00:00
aleloi
06013e99ac AecDump implementation.
This CL implements webrtc::AecDump, which is an interface defined in
https://codereview.webrtc.org/2778783002.

This AudioProcessing submodule writes audio and APM state to a
file. The file writing is done by posting IO tasks
(write_to_file_task.h) on an rtc::TaskQueue. There is an existing
implementation for this through AudioProcessing::StartDebugRecording()
and AudioProcessing::StopDebugRecording(). This implementation still
works, and is used as the default until this dependent CL:
https://codereview.webrtc.org/2896813002/.

To be able to build webrtc without protobuf support, the interface is
isolated from protobuf types. Audio data from AudioProcessing is
passed to AecDumpImpl through the AecDump interface. There it is
stored in protobuf objects, which are posted on the task queue.

This functionality is verified correct by the CL
https://codereview.webrtc.org/2864373002, which enables this recording
submodule in APM tests.

BUG=webrtc:7404

Review-Url: https://codereview.webrtc.org/2865113002
Cr-Commit-Position: refs/heads/master@{#18241}
2017-05-23 15:52:05 +00:00