Commit Graph

432 Commits

Author SHA1 Message Date
ac9f876bc0 Sort #includes that got unsorted when gmock.h and gtest.h moved to webrtc/test/
gmock.h and gtest.h were moved (or rather, got wrappers so that we
could put some icky compatibility hacks in one place instead of 500)
in this CL: https://codereview.webrtc.org/2358993004/

NOPRESUBMIT=true
BUG=webrtc:6398

Review-Url: https://codereview.webrtc.org/2381013002
Cr-Commit-Position: refs/heads/master@{#14464}
2016-10-01 05:29:53 +00:00
77eab70470 Enable the -Wundef warning for clang
NOPRESUBMIT=true
BUG=webrtc:6398

Review-Url: https://codereview.webrtc.org/2358993004
Cr-Commit-Position: refs/heads/master@{#14425}
2016-09-29 00:42:08 +00:00
c8299f9f87 Posting Opus's set-force-channels functionality to WebRTC.
BUG=webrtc:6303

Review-Url: https://codereview.webrtc.org/2352713005
Cr-Commit-Position: refs/heads/master@{#14394}
2016-09-27 09:08:54 +00:00
a70695a3e1 Moved Opus-specific payload splitting into AudioDecoderOpus.
The biggest change to NetEq is the move from a primary flag, to a
Priority with two separate levels: one set by RED splitting and one
set by the codec itself. This allows us to unambigously prioritize
"fallback" packets from these two sources. I've chosen what I believe
is the sensible ordering: packets that the codec prioritizes are
chosen first, regardless of if they are secondary RED packets or
not. So if we were to use Opus w/ FEC in RED, we'd only do Opus FEC
decoding if there was no RED packet that could cover the time slot.

With this change, PayloadSplitter now only deals with RED
packets. Maybe it should be renamed RedPayloadSplitter?

BUG=webrtc:5805

Review-Url: https://codereview.webrtc.org/2342443005
Cr-Commit-Position: refs/heads/master@{#14347}
2016-09-22 09:07:03 +00:00
c4ccd4d61c AcmReceiver: Eliminate AcmReceiver::decoders_
BUG=webrtc:5801

Review-Url: https://codereview.webrtc.org/2351183002
Cr-Commit-Position: refs/heads/master@{#14335}
2016-09-21 17:55:21 +00:00
7f40ba4414 Moved legacy_encoded_audio_frame into audio_decoder_interface.
audio_decoder.cc depends on LegacyEncodedAudioFrame and
LegacyEncodedAudioFrame depends on AudioDecoder::EncodedAudioFrame, so
there's no clear way to separate them as of now. This error is also
hodling up builds downstream. I expect we'll revisit these
dependencies as part of the upcoming larger restructuring effort.

NOTRY=true
BUG=webrtc:5805

Review-Url: https://codereview.webrtc.org/2359763002
Cr-Commit-Position: refs/heads/master@{#14329}
2016-09-21 12:50:45 +00:00
0d526d558b Moved codec-specific audio packet splitting into decoders.
There's still some code run specifically for Opus w/ FEC. It will be
addressed in a separate CL.

BUG=webrtc:5805

Review-Url: https://codereview.webrtc.org/2326003002
Cr-Commit-Position: refs/heads/master@{#14319}
2016-09-21 08:57:36 +00:00
61a208b1b8 Added a ParsePayload method to AudioDecoder.
It allows the decoder to split the input up into usable chunks before
they are put into NetEq's PacketBuffer. Eventually, all packet splitting
will move into ParsePayload.

There's currently a base implementation of ParsePayload. It will
generate a single Frame that calls the underlying AudioDecoder for
getting Duration() and to Decode.

BUG=webrtc:5805
BUG=chromium:428099

Review-Url: https://codereview.webrtc.org/2326953003
Cr-Commit-Position: refs/heads/master@{#14300}
2016-09-20 08:38:09 +00:00
17f008bf33 GYP: Remove targets inside include_tests==1 that are converted to GN.
Remove a large number of targets that are no longer built, to reduce maintenance.
Only targets that have a GN version were removed.

BUG=webrtc:6323
NOTRY=True
NOPRESUBMIT=True

Review-Url: https://codereview.webrtc.org/2340773003
Cr-Commit-Position: refs/heads/master@{#14231}
2016-09-15 11:57:39 +00:00
2b1b7a83ad iSAC fix: Ignore overflow in signed left shift
A left shift by 10 was assumed to never overflow, since "[s]imulation
of the 25 files shows that maximum value in the vector gain_lo_hiQ17[]
is 441344, which means that it is log2((2^31)/441344) = 12.2 shifting
bits from saturation." However, a fuzzer test succeeded in provoking
an overflow, which we ignore in this CL on the theory that only
"abnormal" inputs cause overflow.

Also had to replace a "foo << 1" with "foo * (1 << 1)" in
WEBRTC_SPL_MUL_16_32_RSFT15 because foo could be negative; this
problem showed up as soon as I'd asked UBSan to ignore the overflow
discussed above.

BUG=chromium:615819

Review-Url: https://codereview.webrtc.org/2314413002
Cr-Commit-Position: refs/heads/master@{#14162}
2016-09-09 12:51:38 +00:00
d52bef7d64 iSAC float: Handle errors in upper band decoding
We hit a fuzzer bug that caused numDecodedBytesLB + numDecodedBytesUB
> lenEncodedBytes, which is obviously bogus. Check for that, and for
the case whhere the UB decoder itself realized that something was
wrong. (The code already makes the corresponding check for the LB
decoder.)

BUG=chromium:637899

Review-Url: https://codereview.webrtc.org/2315693002
Cr-Commit-Position: refs/heads/master@{#14091}
2016-09-06 13:16:09 +00:00
ac554eebb9 Add functions to interact with ASan and MSan, and some sample uses
The sample uses are from when I debugged bug 617124. The change in neteq_network_stats_unittest.cc is a fix for a minor unrelated bug found by the try bots when I tried to land this CL (a test was passing uninitialized packet data to NetEq).

BUG=chromium:617124

Review-Url: https://codereview.webrtc.org/2293893002
Cr-Commit-Position: refs/heads/master@{#14034}
2016-09-02 07:39:40 +00:00
affcac4d22 WebRtcIlbcfix_EnhancerInterface: Let input array be const
NOTRY=true
BUG=chromium:617124

Review-Url: https://codereview.webrtc.org/2297873003
Cr-Commit-Position: refs/heads/master@{#14029}
2016-09-01 19:47:22 +00:00
c31446f49e iLBC: Some const annotations
NOTRY=true
BUG=chromium:617124

Review-Url: https://codereview.webrtc.org/2293843002
Cr-Commit-Position: refs/heads/master@{#13972}
2016-08-30 12:37:00 +00:00
cfee215b23 Migrated ILBC and ISAC test targets for GN.
Migrated GN targets ilbc_test, isac_api_test,
isac_switch_samprate_test from webrtc/modules/audio_coding/codecs

NOTRY=True
NOPRESUBMIT=True

BUG=webrtc:6191

Review-Url: https://codereview.webrtc.org/2270403002
Cr-Commit-Position: refs/heads/master@{#13953}
2016-08-29 11:09:28 +00:00
1e8ed4a801 Replace calls to assert() with RTC_DCHECK_*() in .c code
We have RTC_CHECK and RTC_DCHECK for C now, so we should use it. It's
one fewer difference between our C and C++ code.

NOPRESUBMIT=true

Review-Url: https://codereview.webrtc.org/2274083002
Cr-Commit-Position: refs/heads/master@{#13930}
2016-08-26 11:33:41 +00:00
4805231613 Moved format_macros.h from rtc_base to rtc_base_approved.
BUG=webrtc:3806
NOTRY=True

Review-Url: https://codereview.webrtc.org/2272003002
Cr-Commit-Position: refs/heads/master@{#13921}
2016-08-25 11:43:52 +00:00
2c670dbf13 Added GN target for webrtc_opus_fec_test.
BUG=webrtc:6191
NOTRY=True
NOPRESUBMIT=True

Review-Url: https://codereview.webrtc.org/2268213002
Cr-Commit-Position: refs/heads/master@{#13893}
2016-08-24 13:11:27 +00:00
619a211562 iLBC: Handle a case of bad input data
We detect an unreasonable state (caused by a bad encoded stream)
before it can lead to problems, and handle it by resetting the
decoder.

NOPRESUBMIT=true
BUG=chromium:617124

Review-Url: https://codereview.webrtc.org/2255203002
Cr-Commit-Position: refs/heads/master@{#13888}
2016-08-24 09:46:48 +00:00
e51b41ae44 Added GN target for isac_test.
BUG=webrtc:6191
NOTRY=True
NOPRESUBMIT=True

Review-Url: https://codereview.webrtc.org/2267423002
Cr-Commit-Position: refs/heads/master@{#13884}
2016-08-24 09:26:04 +00:00
9a11784a7f Migrated GN target :g722_test
Migrated GN target :g722_test from
webrtc/modules/audio_coding/codecs/g722/g722.gypi

NOTRY=True

BUG=webrtc:6191

Review-Url: https://codereview.webrtc.org/2275463002
Cr-Commit-Position: refs/heads/master@{#13865}
2016-08-23 15:36:15 +00:00
2e486462e0 RTC_CHECK and RTC_DCHECK macros for C
So that we don't have to use assert(). Includes one sample call site.

NOTRY=true
BUG=chromium:617124

Review-Url: https://codereview.webrtc.org/2262173002
Cr-Commit-Position: refs/heads/master@{#13862}
2016-08-23 12:54:31 +00:00
7f82fc988d WebRtcIlbcfix_Smooth: Fix UBSan fuzzer bug (left shift of 1 by 31 overflows)
scale1 == 31 if and only if w10 == 0. So even though 1 << scale1
overflows, we know that the result of the multiplication should be 0.
Handle that case.

BUG=chromium:615818

Review-Url: https://codereview.webrtc.org/2258543002
Cr-Commit-Position: refs/heads/master@{#13847}
2016-08-22 14:43:50 +00:00
d4e9f62ea7 Updated AudioDecoderFactory to list AudioCodecSpecs instead of SdpAudioFormats.
BUG=webrtc:5805

Review-Url: https://codereview.webrtc.org/2123923004
Cr-Commit-Position: refs/heads/master@{#13810}
2016-08-18 09:02:15 +00:00
c54071d8ab WebRtcVoiceEngine: Use AudioDecoderFactory to generate recv codecs.
Reland of https://codereview.webrtc.org/2072753002/ which broke
chromium due to how their build was setup. This issue should now be
resolved.

Changed WebRtcVoiceEngine to present receive codecs from the formats
provided by its decoder factory. Added supported formats to
BuiltinAudioDecoderFactory. Added helper functions for creating some
simple decoder factories for mocking.

Created a PayloadTypeMapper for assigning payload types to formats. I
think we'll eventually want to use this further up, or possibly in
both the audio and video sides. It would be best if the engines didn't
have to talk payload types at all, but it might be more difficult to
get around when payload types depend on each-other, like the RTX
codecs for video.

BUG=webrtc:5805
TBR=ivoc@webrtc.org

Review-Url: https://codereview.webrtc.org/2250683002
Cr-Commit-Position: refs/heads/master@{#13793}
2016-08-17 09:45:47 +00:00
64a7eab891 Update tests and DTX check for Opus 1.1.3.
DTX is now indicated by packets that may have a size of up to 2 bytes.
Ref: https://git.xiph.org/?p=opus.git;a=commit;h=1c311423c86b89eba27a494e17c79fefd7d75ab0

BUG=

Review-Url: https://codereview.webrtc.org/2158293003
Cr-Commit-Position: refs/heads/master@{#13736}
2016-08-12 11:36:14 +00:00
85228d6af6 Regression test for issue where Opus DTX status was being forgotten.
BUG=webrtc:6020

Review-Url: https://codereview.webrtc.org/2177263002
Cr-Commit-Position: refs/heads/master@{#13539}
2016-07-27 11:53:52 +00:00
f93be584f7 Revert of WebRtcVoiceEngine: Use AudioDecoderFactory to generate recv codecs. (patchset #10 id:200001 of https://codereview.webrtc.org/2072753002/ )
Reason for revert:
For some reason, payload_type_mapper.cc is not being picked up in Chrome builds, leading to undefined references. Reverting while investigating.

Original issue's description:
> WebRtcVoiceEngine: Use AudioDecoderFactory to generate recv codecs.
>
> Changed WebRtcVoiceEngine to present receive codecs from the formats
> provided by its decoder factory. Added supported formats to
> BuiltinAudioDecoderFactory. Added helper functions for creating some
> simple decoder factories for mocking.
>
> Created a PayloadTypeMapper for assigning payload types to formats. I
> think we'll eventually want to use this further up, or possibly in
> both the audio and video sides. It would be best if the engines didn't
> have to talk payload types at all, but it might be more difficult to
> get around when payload types depend on each-other, like the RTX
> codecs for video.
>
> This CL also includes some changes to rtc::Optional. I've put them in
> a separate CL that should (or should not) land first, making these
> changes void.
> See: https://codereview.webrtc.org/2072713002/
>
> BUG=webrtc:5805
>
> Committed: https://crrev.com/95eb1ba0db79d8fd134ae61b0a24648598684e8a
> Cr-Commit-Position: refs/heads/master@{#13459}

TBR=ivoc@webrtc.org,tina.legrand@webrtc.org,tommi@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5805

Review-Url: https://codereview.webrtc.org/2151453002
Cr-Commit-Position: refs/heads/master@{#13460}
2016-07-13 13:31:37 +00:00
95eb1ba0db WebRtcVoiceEngine: Use AudioDecoderFactory to generate recv codecs.
Changed WebRtcVoiceEngine to present receive codecs from the formats
provided by its decoder factory. Added supported formats to
BuiltinAudioDecoderFactory. Added helper functions for creating some
simple decoder factories for mocking.

Created a PayloadTypeMapper for assigning payload types to formats. I
think we'll eventually want to use this further up, or possibly in
both the audio and video sides. It would be best if the engines didn't
have to talk payload types at all, but it might be more difficult to
get around when payload types depend on each-other, like the RTX
codecs for video.

This CL also includes some changes to rtc::Optional. I've put them in
a separate CL that should (or should not) land first, making these
changes void.
See: https://codereview.webrtc.org/2072713002/

BUG=webrtc:5805

Review-Url: https://codereview.webrtc.org/2072753002
Cr-Commit-Position: refs/heads/master@{#13459}
2016-07-13 13:05:32 +00:00
3f81fcd2e8 Don't recreate the speech encoder if we don't have to
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}
2016-06-23 10:58:45 +00:00
44bf02fba2 Remove SdpAudioFormat's default constructor
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}
2016-06-20 09:39:53 +00:00
fc3a8ee47b Delete unused code.
* Unused audio_coding and video_coding test code.
* Obsolete voice_engine android test app.
* Left-over placeholder files for remoteaudiotrack and
  portallocatorfactory.

In addition, change modules.gyp dependency from rtc_base to
rtc_base_approved.

BUG=
R=henrik.lundin@webrtc.org, henrika@webrtc.org, pbos@webrtc.org, tina.legrand@webrtc.org

Review URL: https://codereview.webrtc.org/2065353002 .

Cr-Commit-Position: refs/heads/master@{#13166}
2016-06-16 13:51:40 +00:00
347d35129e AudioDecoder: Remove the default implementation of SampleRateHz
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}
2016-06-16 08:59:13 +00:00
ceb9d0cc29 Audio decoder factory test: Ensure that g722's sample rate is 16 kHz, not 8 kHz
Review-Url: https://codereview.webrtc.org/2068133002
Cr-Commit-Position: refs/heads/master@{#13153}
2016-06-15 12:55:22 +00:00
6808419068 iSAC decoder: Remove obsolete TODO
NOTRY=true

Review-Url: https://codereview.webrtc.org/2069993002
Cr-Commit-Position: refs/heads/master@{#13152}
2016-06-15 12:54:20 +00:00
a10740239d Fix UBSan errors (signed integer overflow)
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}
2016-06-08 12:24:47 +00:00
7bf939c720 Check for out-of-bounds access on |kIntrpCoef|.
BUG=chromium:600953

Review-Url: https://codereview.webrtc.org/2025493002
Cr-Commit-Position: refs/heads/master@{#13039}
2016-06-03 17:06:05 +00:00
f882880947 AudioDecoder: Document that the sample rate and number of channels is constant
Review-Url: https://codereview.webrtc.org/2029273003
Cr-Commit-Position: refs/heads/master@{#13012}
2016-06-02 10:19:26 +00:00
abe95ba323 AudioDecoderIsacT: Require caller to always specify sample rate
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}
2016-06-02 09:59:02 +00:00
6c2eab34f8 AudioDecoder: New method SampleRateHz, + implementations for our codecs
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}
2016-05-31 09:46:28 +00:00
4f6c2b6eff Fix UBSan errors (left shift of negative value)
BUG=chromium:601787

Review-Url: https://codereview.webrtc.org/2000403006
Cr-Commit-Position: refs/heads/master@{#12911}
2016-05-26 10:40:56 +00:00
64208e5523 Fix UBSan errors (left shift of negative value)
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}
2016-05-23 10:28:35 +00:00
2036135620 AudioEncoderOpus: Default to 32 kbit/s for mono, 64 kbit/s for stereo
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}
2016-05-20 11:57:08 +00:00
3fc8e8dde3 Fix UBSan errors (left shift of negative value)
BUG=chromium:604803

Review-Url: https://codereview.webrtc.org/1988113003
Cr-Commit-Position: refs/heads/master@{#12826}
2016-05-20 11:40:33 +00:00
e725f7c73e Turned AudioDecoderFactory into a RefCounted thing to use with scoped_refptr.
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}
2016-05-19 17:48:12 +00:00
89f237cedc Fix UBSan errors (left shift of negative value, left shift overflows int)
BUG=chromium:603498

Review-Url: https://codereview.webrtc.org/1979973003
Cr-Commit-Position: refs/heads/master@{#12787}
2016-05-18 09:20:35 +00:00
e305d956c0 Remove runtime NEON detection
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}
2016-05-17 17:56:48 +00:00
9b2228fdfc Fix UBSan errors (left shift of negative value)
BUG=chromium:603501

Review-Url: https://codereview.webrtc.org/1988723002
Cr-Commit-Position: refs/heads/master@{#12775}
2016-05-17 13:40:48 +00:00
8bce67b745 Added UMA logging for audio codec usage. A histogram statistic named "WebRTC.Audio.Encoder.CodecType" has been created.
Review-Url: https://codereview.webrtc.org/1967503002
Cr-Commit-Position: refs/heads/master@{#12760}
2016-05-16 14:34:31 +00:00
7e3968e46c Removed MaxEncodedBytes from AudioEncoder.
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}
2016-05-11 11:39:58 +00:00