Some ErrorProne warnings have been enabled by [1], that broke the
Chromium Roll into WebRTC, this CL should have taken care of all the
problems.
[1] - https://chromium-review.googlesource.com/c/chromium/src/+/1935889
Bug: None
Change-Id: I2670e948c320984a122fdb774b891c98e05f582e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160862
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29933}
Summary of changes/improvements and fixes:
Changes container for list of devices from std::vector to std:deque to
allow fast insertion and deletion at both its beginning and its end. This
approach makes it easier to first build a list of all available devices
and then check the size of the list. If size > 0 => two more devices are
added at the front (Default and Default Communication). The old solution
contained a risk of adding invalid Default and Default Communication
devices in cases where not physical device could be found.
Adds usage of |device_index_| in CoreAudioBase to ensure that the selected
device is unique. The previous version used only an ID but that ID is not
unique when e.g. only one device exists since it can have up to three
different roles.
Improves logging and comments.
No-Try: True
Tbr: thaloun@chromium.org
Bug: webrtc:11107
Change-Id: I9a09f7716ed8d8858dcc6a5354b038fc06496166
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160050
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29874}
Fix signed/unsigned mismatch.
Protect against NumberOfEnumeratedDevices and Get[In|Out]putDeviceNames returning inconsistent results.
It's possible for an device to be counted but getting its name fails, in which case the utility function returns true but would continue from its loop filling the AudioDeviceNames vector, leading to a smaller output than the later code expects.
Bug: b/144382120
Change-Id: Iab008c28f03023c830011d229b1f1c7e3e7bb5ee
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160226
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29871}
ADM2 for Windows is based on the CoreAudioUtil class in Chrome.
CoreAudioUtil in Chrome does not use a special string to identify
the Default Communication device but instead a combination of a
string (Default) and a role parameter [1].
When CoreAudioUtil was ported to WebRTC, I accidentally added an
invalid usage of a unique string to identify the default comm device
and it can lead to errors since there are then two different ways to
identify this device. It will also complicate life when we want to
merge changes from Chrome into WebRTC.
This CL removes usage of AudioDeviceName::kDefaultCommunicationsDeviceId
in WebRTC to reduce the risk of errors.
[1] https://cs.chromium.org/chromium/src/media/audio/win/core_audio_util_win.cc?q=core_audio_ut&sq=package:chromium&g=0&l=464
Excluding flaky bot win_x86_msvc_dbg and using Tbr.
Tbr: thaloun@chromium.org
No-Try: True
Bug: webrtc:11107
Change-Id: Ie6687adbe9c3940a217456e4025967f71d86214c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160047
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29848}
It's possible for an device to be counted but getting its name fails, in which case the utility function returns true but would continue from its loop filling the AudioDeviceNames vector, leading to a smaller output than the later code expects.
No-Try: True
Bug: b/144729866
Change-Id: If902cada4ef2911bc24fbec0f169da75ff6e6a83
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160020
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29840}
New tests are:
- AudioDeviceTest.StartStopPlayoutWithRealDevice
- AudioDeviceTest.StartStopRecordingWithRealDevice
(the comments below only affects ADM2 on Windows):
When adding these tests it was found that we could hit the same known issue
as in https://bugs.chromium.org/p/chromium/issues/detail?id=803056 and the
same solution as in Chrome was therefore ported from Chrome to WebRTC.
Hence, this change also adds support for core_audio_utility::WaveFormatWrapper
to support devices that can return a format where only the WAVEFORMATEX parts is
initialized. The old version would only DCHECK for these devices and that could
lead to an unpredictable behavior.
Tbr: minyue
Bug: webrtc:11093
Change-Id: Icb238c5475100f251ce4e55e39a03653da04dbda
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/159982
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29824}
LogMessage::streams_ is a global and thus should have trivial destructor
Bug: None
Change-Id: Ie6a8029602f50b2bc5bab546ffc0365ef0954024
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/157042
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29552}
Since rtc_base/ignore_wundef.h doesn't have any dependency, it is easy to
move it to its own target and allow its dependant to avoid to take a
dependency rtc_base:on rtc_base_approved.
Bug: webrtc:9419
Change-Id: I17f205b0cb2b21cad388b04e60082df9398dffdf
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/157428
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29548}
Static libraries don't guarantee that an exported symbol gets linked
into a shared library (and in order to support Chromium's component
build mode, WebRTC needs to be linked as a shared library).
Source sets always pass all the object files to the linker.
On the flip side, source_sets link more object files in release builds
and to avoid this, this CL introduces a the GN template "rtc_library" that
expands to static_library during release builds and to source_set during
component builds.
See: https://gn.googlesource.com/gn/+/master/docs/reference.md#func_source_set
Bug: webrtc:9419
Change-Id: I4667e820c2b3fcec417becbd2034acc13e4f04fe
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/157168
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#29525}
Both the tests and the code under test are very old, unstaffed and not
a part of webRTC stack.
Here sanitizers make the tests hang, without providing useful report.
So we are just disabling them, without intention to re-enable them.
Bug: webrtc:10951
Change-Id: I40e97208606ba3f0eb5b19d404f7d038e6cc2bdf
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/152487
Commit-Queue: Yves Gerey <yvesg@google.com>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29157}
Some of the macros in format_macros.h follow the C standard and try to fill holes in it (on Windows). But this one has no direct equivalent in the standard and is just mimicking the naming convention. That's not nice.
References:
https://devblogs.microsoft.com/cppblog/c99-library-support-in-visual-studio-2013/https://stackoverflow.com/a/2524673
Change-Id: I53f3faca2976a5b5d4b04a67ffb56ae0f4e930b2
Bug: webrtc:10852
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/147862
Commit-Queue: Oleh Prypin <oprypin@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28794}
Some of the constants and structure definitions used are only available with
specific and recent versions of the windows SDK. This change allows this
to build with a toolchain targeting WINVER 0x0601 (Windows 7)
Bug: None
Change-Id: I3339f7c44c375fb7d583b78aa137f748c9776a07
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/147440
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Commit-Queue: Paul Roberts <pacaro@google.com>
Cr-Commit-Position: refs/heads/master@{#28730}
The code was doing nothing except for triggering thread sanitizer,
since concurrent writes weren't guarded:
* ReadRecordedData() through webrtc_audio_module_rec_thread
* InitPlayout() through main thread
Bug: webrtc:9751
Change-Id: I7ecf4fa436ff0695e5b998d7e3f159fb6c7e9214
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/146216
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Yves Gerey <yvesg@google.com>
Cr-Commit-Position: refs/heads/master@{#28636}
Lifetime issue: "webrtc_audio_module_rec_thread" was still accessing
AudioTransport mock at and after its destruction.
Bug: webrtc:9751
Change-Id: I24308077cdeb77e570b8ec74098f1ae3397b7155
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/146217
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Yves Gerey <yvesg@google.com>
Cr-Commit-Position: refs/heads/master@{#28635}
Rationale:
* More explicit (you won't miss that when glancing at the code).
* More consistent (see MAYBE_* in other tests).
* Allow to re-activate tests via CLI (--gtest_also_run_disabled_tests).
* Tests won't wrongly show up as PASSING (bug/webrtc:10819),
since they won't show up at all.
Bug: webrtc:9778
Change-Id: Ic32e18cb8ee2352def95206c2aa66e1dea0cc1e3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/146200
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Yves Gerey <yvesg@google.com>
Cr-Commit-Position: refs/heads/master@{#28617}
Landing with TBR given vacation times and the fact that none of this
code is active "in production". The ADM2 implementation can be seen
as experimental (non-default) code and it takes some work to enable it
and replace the existing ADM. Hence, extremely low risk to break
anything.
TBR: henrik.lundin
Bug: webrtc:9265
Change-Id: Ibc9a57f4851bf4b890b77b9eaef1dfbe3ca86f83
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/146084
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28601}
Landing with TBR given vacation times and the fact that none of this
code is active "in production". The ADM2 implementation can be seen
as experimental (non-default) code and it takes some work to enable it
and replace the existing ADM. Hence, extremely low risk to break
anything.
TBR: henrik.lundin
Bug: webrtc:9265
Change-Id: Ia5cfb2aaa8eaf9537b916b3375f55d8df6287071
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/145921
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28600}
Marking test as skipped is more honest than pretending it is successful!
Prevent confusion like in the following scenario for one given test:
- ubsan: launched and sometimes failing.
- tsan: never launched but always flagged OK.
Bug: webrtc:9778
Change-Id: Ie0be0759347eabd3c9d29dd5ea2de809511d1b97
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/145980
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Yves Gerey <yvesg@google.com>
Cr-Commit-Position: refs/heads/master@{#28597}
Code is not used in production. Need this change for a local test.
Using TBR.
TBR: henrik.lundin
Bug: webrtc:9265
Change-Id: I9f0cb265a51507de59ef2d7fd151465133687525
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/145330
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28557}
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}
The test RunPlayoutAndRecordingInFullDuplex makes the speakers play the
signal it simultaneously records from the microphone, which can cause
full howling.
The test itself measures buffer usage and does not depend on what signal
is played through the speakers. This change mutes the speakers to prevent
howling when running modules_unittests.
Bug: webrtc:10704
Change-Id: I6176adb2fb5ce0e4d86f6f447476be8a88c2f2cf
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/139889
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28140}
This is a reland of e779847fb6
Original change's description:
> Change SimpleStringBuilder::Append to not use strcpyn and SIZE_UNKNOWN
>
> Also add explicit includes of rtc_base/string_utils.h in files depending on it.
>
> Bug: webrtc:6424
> Change-Id: Id6b53937ab2d185d092a5d8863018fd5f1a88e27
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/135744
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Commit-Queue: Niels Moller <nisse@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#27903}
Tbr: kwiberg@webrtc.org
Bug: webrtc:6424
Change-Id: Ic08d5d7fbc25ff89e4182d7c9cb3b0e8e356339a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/135946
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27957}
Also add explicit includes of rtc_base/string_utils.h in files depending on it.
Bug: webrtc:6424
Change-Id: Id6b53937ab2d185d092a5d8863018fd5f1a88e27
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/135744
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27903}
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}
ATL is being used to avoid a CoTaskMemFree, which we can just do directly.
Change-Id: Id5eddedd3634ca3d9adb9e5b54bc90ad298dd56c
Bug: None
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132080
Commit-Queue: Noah Richards <noahric@chromium.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27524}