Commit graph

32 commits

Author SHA1 Message Date
Sergey Sukhanov
ec48886da9 Fix pointer overflow in neon implemenation of audio filters
Use signed arithmetic for indexes that can be negative

Bug: webrtc:15523
Change-Id: I41ea47a679242c8febe70373529173733058c479
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/322120
Reviewed-by: Jakob Ivarsson‎ <jakobi@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Sergey Sukhanov <sergeysu@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40924}
2023-10-13 06:41:08 +00:00
Mirko Bonadei
83a95f748f Avoid integer overflow detected by the compiler.
Trying to calculate std::abs(min_int) results in an int overflow.

Original author: asmok@.

Bug: None
Change-Id: I984e9ba4f48411a583a55cc3f9c66c9a1cc8dc92
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/318120
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40660}
2023-08-30 08:24:30 +00:00
Mirko Bonadei
9d9c2d5795 Make header files self contained.
This CL adds #includes to header files in order to make them
self contained after the preprocessor pass.

Bug: b/251890128
Change-Id: I81c3ba38fb8ab8a2bbd151ba99aa871fae9f1b1b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/278422
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38327}
2022-10-08 08:38:36 +00:00
Artem Titov
96315752d2 Use backticks not vertical bars to denote variables in comments for /common_audio
Bug: webrtc:12338
Change-Id: I884db28e6d9a87d343be7c2616571a8bee28252c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226944
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34568}
2021-07-27 18:21:35 +00:00
Minyue Li
5663ce9152 Avoid undefined behavior in a division operation.
BUG: webrtc:5486
Change-Id: I2850fbec3283b81b49ee4f966349a94aabc2bf82
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215969
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Commit-Queue: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33811}
2021-04-23 07:49:24 +00:00
Ivo Creusen
6031b74664 Implement a Neon optimized function to find the argmax element in an array.
Finding the array element with the largest argmax is a fairly common
operation, so it makes sense to have a Neon optimized version. The
implementation is done by first finding both the min and max value, and
then returning whichever has the largest argmax.

Bug: chromium:12355
Change-Id: I088bd4f7d469b2424a7265de10fffb42764567a1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/201622
Commit-Queue: Ivo Creusen <ivoc@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33052}
2021-01-21 13:42:34 +00:00
Timothy Gu
3111783aa1 Organize iLBC headers as per style guide
Prior to this commit, most .c files in modules/audio_coding/codecs/ilbc
don't include their corresponding headers, nor do they order #includes
as per the Google Style Guide [1]. The former is especially harmful,
since in C it can silently allow the function signature to diverge from
its prototype, thus causing disaster at runtime.

This CL fixes both issues. In effect, this allows the common_audio and
modules/audio_coding:ilbc targets to be compiled with Clang's
-Wmissing-prototypes, though this CL does not add that change.

[1]: https://google.github.io/styleguide/cppguide.html#Names_and_Order_of_Includes

Bug: webrtc:12314
Change-Id: I8299968ed3cc86ff35d9de045072b846298043af
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/198362
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Timothy Gu <timothygu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#32896}
2020-12-31 20:57:18 +00:00
Jiawei Ou
ffc525bb96 Fix a bug/typo in WebRtcSpl_FilterAR which updates the wrong state vector
Bug: webrtc:10877
Change-Id: I089ac68d71a31914ddb020cb78a44295230cb44b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/149028
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28868}
2019-08-15 16:46:22 +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
Karl Wiberg
225842ced8 Initialize signal processing function pointers statically
The last run-time logic for selecting function pointers was removed in
May 2016, here: https://codereview.webrtc.org/1955413003

It would be even better if we could eliminate the function pointers
entirely and just have different implementations that we select at
compile time; I've left a TODO asking for this.

Bug: webrtc:9553
Change-Id: Ica71d71e19759da00967168f6479b7eb8b46c590
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/144053
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28414}
2019-06-28 14:20:03 +00:00
Alessio Bazzica
1bc995a1cb WebRtcSpl AffineTransform: make input const
Bug: webrtc:10548
Change-Id: I4241dfe7ba282270422f8f8e90a8e5a439d3031c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132787
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27613}
2019-04-15 10:27:55 +00:00
Mirko Bonadei
6a489f22c7 Fully qualify googletest symbols.
Semi-automatically created with:

git grep -l " testing::" | xargs sed -i "s/ testing::/ ::testing::/g"
git grep -l "(testing::" | xargs sed -i "s/(testing::/(::testing::/g"
git cl format

After this, two .cc files failed to compile and I have fixed them
manually.

Bug: webrtc:10523
Change-Id: I4741d3bcedc831b6c5fdc04485678617eb4ce031
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132018
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27526}
2019-04-09 17:18:20 +00:00
Jonas Olsson
366a50c4ef Remove simple stringstream usages.
This CL replaces std::o?stringstream with rtc::StringBuilder where that's possible to do without changing any of the surrounding code. It also updates includes and build files as appropriate.

The CL was generated by running 'git grep -l -P std::o?stringstream | xargs perl -pi -e "s/std::o?stringstream/rtc::StringBuilder/g"'. Then I've manually updated the #includes and BUILD files, run 'git cl format' and unstaged any file that would need more complex fixes.

Bug: webrtc:8982
Change-Id: Ibc32153f4a3fd177e260b6ad05ce393972549357
Reviewed-on: https://webrtc-review.googlesource.com/98460
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24605}
2018-09-06 12:53:19 +00:00
Artem Titov
29835996e9 Move spl_sqrt_floor dep to proper third_party directory
Bug: webrtc:8366
Change-Id: I326af5251dd88136dcc722e0ba1a2f9a8aebcf89
Reviewed-on: https://webrtc-review.googlesource.com/90405
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24205}
2018-08-07 10:33:13 +00:00
Niels Möller
a12c42a6b2 Delete root header file typedef.h.
Usage replaced with stdint.h, rtc_base/system/arch.h and
rtc_base/system/unused.h, as appropriate.

Bug: webrtc:6854
Change-Id: I97225465d14b969903d92979e2df3c3c05d35f18
Reviewed-on: https://webrtc-review.googlesource.com/90249
Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24100}
2018-07-25 14:59:26 +00:00
Mirko Bonadei
91df091ba6 Enabling clang::find_bad_constructs for common_audio.
This CL removes //build/config/clang:find_bad_constructs from the
suppressed_configs list, which means that clang:find_bad_constructs
is now enabled on these translation units.

Bug: webrtc:9251
Change-Id: I1607df2a3ad177e2f3023156eb8cf37857ae06ba
Reviewed-on: https://webrtc-review.googlesource.com/89041
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24002}
2018-07-17 09:37:40 +00:00
Mirko Bonadei
f9c2952837 Removing warning suppression flags in common_audio/.
Bug: webrtc:9251
Change-Id: I9cae182ceb5e6bd3d6a34dc1a336ee3900f4cc98
Reviewed-on: https://webrtc-review.googlesource.com/86946
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23839}
2018-07-04 11:13:09 +00:00
Yves Gerey
665174fdbb Reformat the WebRTC code base
Running clang-format with chromium's style guide.

The goal is n-fold:
 * providing consistency and readability (that's what code guidelines are for)
 * preventing noise with presubmit checks and git cl format
 * building on the previous point: making it easier to automatically fix format issues
 * you name it

Please consider using git-hyper-blame to ignore this commit.

Bug: webrtc:9340
Change-Id: I694567c4cdf8cee2860958cfe82bfaf25848bb87
Reviewed-on: https://webrtc-review.googlesource.com/81185
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23660}
2018-06-19 14:00:39 +00:00
Alessio Bazzica
78ad6ce381 Removing openmax_dl
Follow-up CL of https://webrtc-review.googlesource.com/c/src/+/69641
in which the 3pp lib openmax_dl had been disabled (but not removed).

Bug: webrtc:9071
Change-Id: Id766e4a48ab255a86e13f5f5f1480aee88c428a5
Reviewed-on: https://webrtc-review.googlesource.com/74482
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23140}
2018-05-07 12:12:04 +00:00
Henrik Lundin
9b4aa600e5 Fix ptr overflow warning in filter_ar.c
In this code, the problem was that the ptr could sometimes point
outside of the allocated arrays, in particular before the array,
causing a pointer overflow warning. However, the memory pointed to was
never read or written while the pointer was off.

With this change, we keep an index instead of a pointer, which avoids
warnings for pointer overflow. The index might be negative at times,
but the index will not be used to address the arrays while negative.

Bug: webrtc:9166
Change-Id: I3a32d8e814660f43be9d4c94889d00ac3f8403a5
Reviewed-on: https://webrtc-review.googlesource.com/71165
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Commit-Queue: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22951}
2018-04-20 09:29:10 +00:00
Artem Titov
13fb0ef801 Fix ptr overflow warning
Cast to ptrdiff_t, where negative ptr overflow is expected and add comments

Bug: webrtc:9166
Change-Id: Ib079791d67e4161b578cba15b67236822442ac08
Reviewed-on: https://webrtc-review.googlesource.com/70780
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22931}
2018-04-19 08:58:18 +00:00
Karl Wiberg
7aabd39b4b Move asm_defines.h to rtc_base/system/
This moves it from an API directory (system_wrappers/include/) to a
non-API directory, which is exactly what we want for utilities like
this.

Bug: webrtc:8445
NOPRESUBMIT=true

Change-Id: I30d01fcb9cbe1427a7703a3cdd7befae751066b5
Reviewed-on: https://webrtc-review.googlesource.com/21982
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22550}
2018-03-22 03:12:13 +00:00
Mirko Bonadei
d7573563a4 Fixing -Wstrict-prototypes warnings.
Bug: webrtc:8984
Change-Id: I9a7ffb0038f341bfec055f021fc203c7d45d72fa
Reviewed-on: https://webrtc-review.googlesource.com/60903
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22501}
2018-03-19 16:57:21 +00:00
Alex Loiko
ee67ca3fd8 Replace left shift with equivalent multiplication.
We have done changes to the Audio Processing fuzzer here
https://webrtc-review.googlesource.com/c/src/+/36500/6.

We ran the new version of the fuzzer locally. The UBSAN
detector found these (minor) issues.

We have used the Godbolt compiler explorer to check that similar
changes produce identical compiled code.

Bug: webrtc:7820
Change-Id: I9cc3b81e4be7cf691f878c37010ce105bc2f3e38
Reviewed-on: https://webrtc-review.googlesource.com/39264
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21605}
2018-01-12 15:29:59 +00:00
Henrik Lundin
6f54e7ab67 Avoid integer-overflow in WebRtcSpl_FilterARFastQ12
Simply use int64_t instead of int32_t for two local variables.
This avoids integer-overflow in some rare cases.

Bug: chromium:784216
Change-Id: Ie96835d6dc04e338b157469b74ead29e8bd403dd
Reviewed-on: https://webrtc-review.googlesource.com/26580
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21141}
2017-12-07 16:56:47 +00:00
Henrik Lundin
5dcbbfd153 Create a fuzzer for ComfortNoiseDecoder
The fuzzer will hammer on the UpdateSid and Generate methods of
ComfortNoiseDecoder.

The change also includes a fix to an issue in WebRtcSpl_FilterAR, which
was immediately found by running the fuzzer locally.

Bug: none
Change-Id: I5283427cb27844fb953e2caa35423ea873aca2ff
Reviewed-on: https://webrtc-review.googlesource.com/28100
Commit-Queue: Henrik Lundin <henrik.lundin@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21134}
2017-12-07 08:53:37 +00:00
Karl Wiberg
e40468ba3d Move some numeric utility code from rtc_base/ to rtc_base/numerics/
Specifically, I'm moving

  safe_compare.h
  safe_conversions.h
  safe_minmax.h

They shouldn't be part of the API, and moving them to an appropriate
subdirectory of rtc_base/ is a good way to keep track of that.

BUG=webrtc:8445

Change-Id: I458531aeb30bcf4291c4bec3bf22a2fffbf054ff
Reviewed-on: https://webrtc-review.googlesource.com/20860
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20829}
2017-11-22 11:21:47 +00:00
Alex Loiko
187c6992fb Replacing undefined left shifts with multiplication.
Issue was found by the Audio Processing fuzzer.

Bug: chromium:778939, chromium:778921, chromium:778919
Change-Id: If613cf4c533f546d118f10a6358cecd329958177
Reviewed-on: https://webrtc-review.googlesource.com/16161
Commit-Queue: Alex Loiko <aleloi@google.com>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20494}
2017-10-31 09:43:02 +00:00
Alex Loiko
b9f536167c Removing undefined left shifts in AudioProcessing
This CL replaces 5 left shifts where the shifted value may be 
negative. The shifts are replaced with equivalent multiplications.

Bug: chromium:777231, chromium:776719, chromium:776624, chromium:776286
Change-Id: Ifb27d5506eac779e60f238432bdf9e4bc5b2da4c
Reviewed-on: https://webrtc-review.googlesource.com/14800
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20430}
2017-10-25 13:35:36 +00:00
Mirko Bonadei
7120742701 Adding NOLINT for typedefs.h and common_types.h
Now that we have moved WebRTC from src/webrtc to src/, common_types.h
and typedefs.h are triggering a cpplint error.

The cpplint complaint is:
Include the directory when naming .h files  [build/include] [4]

This CL disables the error but we have to remove these two headers
from the root directory.

NOPRESUBMIT=true

Bug: webrtc:5876
Change-Id: I08e1b69aadcc4b28ab83bf25e3819d135d41d333
Reviewed-on: https://webrtc-review.googlesource.com/1577
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Kjellander <kjellander@google.com>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19859}
2017-09-15 13:03:51 +00:00
Mirko Bonadei
92ea95e34a Fixing WebRTC after moving from src/webrtc to src/
In https://webrtc-review.googlesource.com/c/src/+/1560 we moved WebRTC
from src/webrtc to src/ (in order to preserve an healthy git history).
This CL takes care of fixing header guards, #include paths, etc...

NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
TBR=tommi@webrtc.org


Bug: chromium:611808
Change-Id: Iea91618212bee0af16aa3f05071eab8f93706578
Reviewed-on: https://webrtc-review.googlesource.com/1561
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Kjellander <kjellander@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19846}
2017-09-15 05:02:56 +00:00
Mirko Bonadei
bb547203bf Moving src/webrtc into src/.
In order to eliminate the WebRTC Subtree mirror in Chromium, 
WebRTC is moving the content of the src/webrtc directory up
to the src/ directory.

NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
TBR=tommi@webrtc.org

Bug: chromium:611808
Change-Id: Iac59c5b51b950f174119565bac87955a7994bc38
Reviewed-on: https://webrtc-review.googlesource.com/1560
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Kjellander <kjellander@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19845}
2017-09-15 04:25:06 +00:00