I'll be rewriting AcmReceiver soon and am trying to reduce the amount of
old stuff that needs to be supported.
I've manually checked the outputs of the AcmReceiver bitexactness
tests with this change. A large part of the tests are still bitexact,
with one section only differing slightly in timings. Nothing audible
unless playing the old and new versions back simultaneously.
The output of NetEqDecoderTest were also changed due to this CL, although only on android. I built and ran the test locally and compared the audio output manually - the changes were the same as for the other tests; i.e. very slight timing changes for a part of the output.
I updated the network stats checksum for android without analyzing it further. I expect it goes hand-in-hand with the changes to the output; i.e. the changes in it are fine because the audio output is fine. Likely, the stats will show changes in the usage of CNG, since that is what the code changes.
BUG=webrtc:1361
Review-Url: https://codereview.webrtc.org/2117763002
Cr-Commit-Position: refs/heads/master@{#13415}
There was a fast path in PreprocessToAddData that would just use the
input timestamps if the input format was equal to the required format of
the encoder. This works well as long as the codec never changes. If we
are first doing resampling (specifically upsampling) and then change to
a codec that does not require resampling, we'll need to stick to
whatever input timestamp we left off at, rather than silently accepting
whatever we're sent.
BUG=622435
Review-Url: https://codereview.webrtc.org/2119393002
Cr-Commit-Position: refs/heads/master@{#13398}
If the specification for the speech encoder hasn't changed, we should
reuse it instead of recreating it. Otherwise, we lose its state. (This
problem was originally discovered because AudioEncoderOpus instances
would forget that they were supposed to be using DTX.)
BUG=webrtc:6020, chromium:622647
Review-Url: https://codereview.webrtc.org/2089183002
Cr-Commit-Position: refs/heads/master@{#13273}
In some situation, typically when incoming packets were reordered, the
DelayPeakDetector::Update method may be called twice (or more) with
non-zero inter_arrival_time argument, but without the TickTimer object
being updated in between (i.e., packets coming in more or less at the
same time). In these situations, a delay peak may be registered with
zero peak period. This could eventually trigger the DCHECK in
DelayPeakDetector::MaxPeakPeriod().
With this fix, the problem is solved by not registering peaks for which
the TickTimer object has not moved since the last peak.
The problem was originally introduced with
https://codereview.webrtc.org/1921163003.
BUG=webrtc:6021
Review-Url: https://codereview.webrtc.org/2085233002
Cr-Commit-Position: refs/heads/master@{#13257}
This change is a major refactoring of the neteq_rtpplay tool. It
consists of the following parts:
- NetEqTest class: Breaks out the main simulation loop from
neteq_rtpplay into a separate class with well defined inputs and
outputs.
- NetEqInput: Interface class for the input to NetEqTest.
- NetEqPacketSourceInput: Implementation of NetEqInput that provides a
PacketSource objects with a NetEqInput interface. This has two
subclasses; one for RtpFileSource and one for RtcEventLogSource.
- NetEqReplacementInput: An object that modifies the packets provided by
another NetEqInput object, and replaces the packet payloads with meta
data readable by a FakeDecodeFromFile decoder.
- FakeDecodeFromFile: An AudioDecoder implementation that produces
"decoded" data by reading from an audio file.
BUG=webrtc:2692, webrtc:5447
Review-Url: https://codereview.webrtc.org/2020363003
Cr-Commit-Position: refs/heads/master@{#13252}
We didn't really want it; it was only necessary because we wanted to
use rtc::Optional<SdpAudioFormat>, and Optional used to require the
contained type to be default constructable. But as of May 9th
(https://codereview.webrtc.org/1896833004), it no longer does.
Review-Url: https://codereview.webrtc.org/2066233002
Cr-Commit-Position: refs/heads/master@{#13211}
AudioCodingModuleImpl is the only implementation of the
AudioCodingModule interface (except for test mocks). So it's a good
fit to put it in an anonymous namespace in the interface's .cc file,
to ensure that no one except AudioCodingModule::Create ever references
it.
Except for moving code, this CL introduces two other small changes:
* It cleans up the set of #includes in audio_coding_module.cc.
Specifically, I removed #includes that were already present in
audio_coding_module.h, and did not bring along any #includes from
audio_coding_module_impl.h and .cc except those that were
necessary to get it to compile.
* It moves AudioCodingModuleImpl from the webrtc::acm2 to the
webrtc::<anonymous> namespace. This means I had to qualify a few
things it references with acm2::.
Review-Url: https://codereview.webrtc.org/2069723003
Cr-Commit-Position: refs/heads/master@{#13191}
And implement SampleRateHz in a bunch of mocks.
BUG=webrtc:5801
NOTRY=true
Review-Url: https://codereview.webrtc.org/2029543002
Cr-Commit-Position: refs/heads/master@{#13161}
Changes:
* Enabled protobuf for iOS globally.
* Set WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE on a global
scope similar to GYP since tests depend on it.
* Added missing rtc_libvpx_build_vp9 variable.
* Moved out audio_coding defines into .gni file to avoid code duplication
* Renamed files to avoid object naming conflicts that GN disallows:
* webrtc/modules/audio_processing/{echo_cancellation_unittest.cc->echo_cancellation_bit_exact_unittest.cc}
* webrtc/modules/video_coding/codecs/vp9/{screenshare_layers_unittest.cc->vp9_screenshare_layers_unittest.cc}
BUG=webrtc:5949
TESTED=Built and ran the tests on Mac. Also ran:
gn gen out/Default --args="rtc_enable_bwe_test_logging=true"
and verified that more objects are being built (1885 vs 1883)
when compiling modules_unittests.
NOTRY=True
NOPRESUBMIT=True
Review-Url: https://codereview.webrtc.org/2041233006
Cr-Commit-Position: refs/heads/master@{#13108}
WebRtcSpl_CrossCorrelation and WebRtcSpl_DotProductWithScale compute
the int32 sum of pairwise products from two int16 arrays. So as to
avoid overflow (which could otherwise happen when as little as two
products were summed), the products are right-shifted by an amount
specified by the caller.
This CL changes WebRtcIlbcfix_MyCorr and WebRtcIlbcfix_Smooth to give
sufficient right-shift amounts, instead of ones that may be too small
and cause overflow.
BUG=chromium:601787
Review-Url: https://codereview.webrtc.org/2014033002
Cr-Commit-Position: refs/heads/master@{#13066}
This gets rid of the complex & icky state where the sample rate is not
yet determined.
BUG=webrtc:5801
Review-Url: https://codereview.webrtc.org/2020353003
Cr-Commit-Position: refs/heads/master@{#13011}
This allows us to get rid of the function that computes it, which gets
us one step closer to getting rid of the NetEqDecoder type.
BUG=webrtc:5801
Review-Url: https://codereview.webrtc.org/2021063002
Cr-Commit-Position: refs/heads/master@{#12974}
This will let NetEq (and the factory, and every layer in between) keep
track of just the decoder, instead of decoder and sample rate.
BUG=webrtc:5801
Review-Url: https://codereview.webrtc.org/2024633002
Cr-Commit-Position: refs/heads/master@{#12968}
Adding a some checks and switching out a few assert for RTC_[D]CHECK.
These changes are around use of AudioFrame.data_ to help us catch issues earlier since assert() is left out in release builds, including builds with DCHECK enabled. I've also added a few full-on CHECKs to avoid reading past buffer boundaries or continuing on in a failed state.
TBR=kjellander@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Committed: https://crrev.com/60c4e0ae8f124f08372645a95042f4a1246d7aa3
Cr-Commit-Position: refs/heads/master@{#12925}
Review URL: https://codereview.webrtc.org/2014973002 .
Cr-Commit-Position: refs/heads/master@{#12926}
A regression happened in https://codereview.webrtc.org/2006723002,
causing neteq_rtpplay not to work. The problem was that when the main
code was moved inside of the webrtc::test namespace, it was no longer
visible to the linker. Meanwhile, the dependency on test_support_main
rather than test_support caused the executable to be a gtest.
In this fix, the gyp dependencies are corrected, and a main method is
added outside of the namespaces.
NOTRY=True
Review-Url: https://codereview.webrtc.org/2018473002
Cr-Commit-Position: refs/heads/master@{#12918}
Original issue's description:
> Adding a some checks and switching out a few assert for RTC_[D]CHECK.
> These changes are around use of AudioFrame.data_ to help us catch issues earlier since assert() is left out in release builds, including builds with DCHECK enabled. I've also added a few full-on CHECKs to avoid reading past buffer boundaries or continuing on in a failed state.
>
> BUG=chromium:613482
> NOTRY=true
> (using notry due to offline android_arm64_rel bot)
>
> Committed: https://crrev.com/d36df89d40bde3c62ee5cbff841933e50b3c007b
> Cr-Commit-Position: refs/heads/master@{#12870}
TBR=henrik.lundin@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=chromium:613482
Review-Url: https://codereview.webrtc.org/2009253004
Cr-Commit-Position: refs/heads/master@{#12907}
The NetEqNetworkStatistics::expand_rate was not incremented during muted
state, which caused under-reporting of that metric. This change fixes
that.
BUG=chromium:613321, webrtc:5608
Review-Url: https://codereview.webrtc.org/2003203004
Cr-Commit-Position: refs/heads/master@{#12894}
Channel's API remains unchanged, but the creation of a BuiltinAudioDecoderFactory is now in Channel. The next step would be to amend Channel's API (through CreateChannel, I believe) to allow an AudioDecoderFactory to be sent along.
BUG=webrtc:5805
Review-Url: https://codereview.webrtc.org/1992763002
Cr-Commit-Position: refs/heads/master@{#12893}
The return type of PacketSource::NextPacket() is changed from a naked
pointer to an std::uniqe_ptr. The interface contract was and still is
that the ownership is passed from the callee to the caller, but a
unique_ptr makes this explicit.
BUG=webrtc:2692
Review-Url: https://codereview.webrtc.org/2005873002
Cr-Commit-Position: refs/heads/master@{#12884}
Reason for revert:
Reverting temporarily. Need to fix tests downstream that pass invalid arguments.
Original issue's description:
> Adding a some checks and switching out a few assert for RTC_[D]CHECK.
> These changes are around use of AudioFrame.data_ to help us catch issues earlier since assert() is left out in release builds, including builds with DCHECK enabled. I've also added a few full-on CHECKs to avoid reading past buffer boundaries or continuing on in a failed state.
>
> BUG=chromium:613482
> NOTRY=true
> (using notry due to offline android_arm64_rel bot)
>
> Committed: https://crrev.com/d36df89d40bde3c62ee5cbff841933e50b3c007b
> Cr-Commit-Position: refs/heads/master@{#12870}
TBR=henrik.lundin@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:613482
Review-Url: https://codereview.webrtc.org/2006243002
Cr-Commit-Position: refs/heads/master@{#12874}
These changes are around use of AudioFrame.data_ to help us catch issues earlier since assert() is left out in release builds, including builds with DCHECK enabled. I've also added a few full-on CHECKs to avoid reading past buffer boundaries or continuing on in a failed state.
BUG=chromium:613482
NOTRY=true
(using notry due to offline android_arm64_rel bot)
Review-Url: https://codereview.webrtc.org/2007563002
Cr-Commit-Position: refs/heads/master@{#12870}
I've settled on replacing x << n with x * (1 << n); this gets rid of
the "left shift of negative value" warning, but will still trigger
undefined behavior if the multiplication overflows. It also still
looks like a left shift, which is good for the readability of the
fixed-point code.
(The compiler is smart enough to recognize that the
multiplication+shift is just a shift, for both variable and constant
shift amounts, so the generated code should not change.)
BUG=chromium:603491
Review-Url: https://codereview.webrtc.org/1989803002
Cr-Commit-Position: refs/heads/master@{#12845}
When this class was created, we inadvertently set the default to 64
kbit/s for both cases, failing to preserve the previous behavior. This
patch restores the old behavior.
From what I've been able to dig up, this problem did not affect Opus
encoders created internally in the Audio Coding Module. Those have
always used the bitrate from the supplied CodecInst.
Review-Url: https://codereview.webrtc.org/1942193002
Cr-Commit-Position: refs/heads/master@{#12827}
First step of AudioDecoderFactory injection CLs. AudioDecoderFactories will be shared, and shared_ptr is currently off the table, so this CL changes the current uses of AudioDecoderFactory from std::unique_ptr to rtc::scoped_refptr.
BUG=webrtc:5805
Review-Url: https://codereview.webrtc.org/1990803004
Cr-Commit-Position: refs/heads/master@{#12815}
Deleted the temporary ACM method without the muted parameter, and had
to modify several tests for this. The muted parameter is not yet propagated to the AudioConferenceMixer; this is the next step.
BUG=webrtc:5609
TBR=perkj@webrtc.org
Review-Url: https://codereview.webrtc.org/1985743002
Cr-Commit-Position: refs/heads/master@{#12779}
Chrome does not detect NEON instruction set at runtime in WebRTC code starting
with M50, which is now in Stable. Remove support for runtime detection for
simplicity.
The only remaining piece of Chrome that will continue to depend on runtime
detection is /net, where devices with _broken_ neon support are also detected,
and it is not configurable via GYP/GN.
BUG=522035
NOPRESUBMIT=true
Review-Url: https://codereview.webrtc.org/1955413003
Cr-Commit-Position: refs/heads/master@{#12778}
The new parameter indicates if the output in the AudioFrame is muted. If
so, the output samples are not written, but should be interpreted as all
zero.
A version of AudioCodingModule::PlayoutData10Ms() without the new
parameter is maintained while waiting for downstream dependencies to
conform.
BUG=webrtc:5609
Review-Url: https://codereview.webrtc.org/1976913002
Cr-Commit-Position: refs/heads/master@{#12719}
Changed rtpdump converter and neteq tool to use new parser, but still aborting if the file is corrupt.
Review-Url: https://codereview.webrtc.org/1768773002
Cr-Commit-Position: refs/heads/master@{#12714}
This CL implements the muted output functionality in NetEq. Tests are
added. The feature is currently off by default, and AcmReceiver makes
sure that the muted state is not engaged.
BUG=webrtc:5608
Review-Url: https://codereview.webrtc.org/1965733002
Cr-Commit-Position: refs/heads/master@{#12711}
This is the last step in changing the signature of AudioEncoder::Encode
to taking an rtc::Buffer as its output parameter, rather than a pointer
to and a size parameter.
The notry parameter has been added specifically to work around android_compile_x86_dbg bot failing.
NOTRY=True
BUG=webrtc:5591
Review-Url: https://codereview.webrtc.org/1962013003
Cr-Commit-Position: refs/heads/master@{#12685}
AudioVector used NetEq was based on a shift buffer, which has a high complexity, and the complexity is very much dependent on the capacity of the buffer.
This CL changes the shift buffer to a ring buffer.
Reduction in the CPU usages of NetEq is expected.
BUG=608644
R=henrik.lundin@webrtc.org
Review URL: https://codereview.webrtc.org/1948483002 .
Cr-Commit-Position: refs/heads/master@{#12676}