Commit graph

311 commits

Author SHA1 Message Date
Markus Handell
6b7d25eed3 AudioDeviceMac: fix mutex re-entry.
This change fixes two cases of encountered mutex re-entries.

Bug: webrtc:11821
Change-Id: Iaef730e4233a79b0d1b2bf6a17fe3f14e2558e98
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/180800
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31831}
2020-08-03 10:54:56 +00:00
Eric Astor
81d2bbf96e Add a missing Windows library
"oleaut32.lib" is required for VariantInit: https://docs.microsoft.com/en-us/windows/win32/api/oleauto/nf-oleauto-variantinit

Bug: webrtc:11807
Change-Id: If0511571340e14407ad9402636a4a64d328fabca
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/180440
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Eric Astor <epastor@google.com>
Cr-Commit-Position: refs/heads/master@{#31806}
2020-07-29 14:06:35 +00:00
Markus Handell
5f61282687 Migrate modules/audio_device to webrtc::Mutex.
Bug: webrtc:11567
Change-Id: I6d1a7145aaaae2e4cd0c8658fa31a673f857dbd6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178814
Commit-Queue: Markus Handell <handellm@webrtc.org>
Reviewed-by: Magnus Flodman <mflodman@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31664}
2020-07-08 09:32:12 +00:00
Sylvain Defresne
c7f0dff191 Convert GN libs lists to frameworks
GN recently added support for Apple frameworks to link, rather than
overloading the libs lists. This pulls .frameworks out of the libs
lists, so that GN can stop supporting .frameworks in libs in the
future.

Bug: chromium:1052560
Change-Id: I263230ddd3c468061584423bba9e1f887503bcaa
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178601
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#31632}
2020-07-06 10:08:09 +00:00
Mirko Bonadei
2dcf348011 Use absl_deps in order to preapre to the Abseil component build release.
Bug: webrtc:1046390
Change-Id: Ia35545599de23b1a2c2d8be2d53469af7ac16f1d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176502
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31463}
2020-06-08 12:59:40 +00:00
Markus Handell
44b8b0bebb AudioDeviceMac, AudioMixerManagerMac: remove lock recursions.
This change removes lock recursions and adds thread annotations.

Bug: webrtc:11567
Change-Id: I995cdc71b4e447e1153617b3d8472f35c1670181
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176440
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31426}
2020-06-03 14:35:57 +00:00
Ivo Creusen
f1393e23a2 Add UMA histogram for actual Android buffer size
Previously a histogram was added to track the requested buffer size,
this CL adds a histogram for the actually used buffer size.

Bug: b/157429867
Change-Id: I04016760982a4c43b8ba8f0e095fe1171b705258
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176227
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31385}
2020-05-29 11:14:55 +00:00
Ivo Creusen
bdb5830d69 Add UMA histogram for native audio buffer size in ms
The Android native audio code asks the OS to provide an appropriate
buffer size for real-time audio playout. We should add logging for this
value so we can see what values are used in practice.

Bug: b/157429867
Change-Id: I111a74faefc0e77b5c98921804d6625cba1b84af
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176126
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Henrik Andreasson <henrika@chromium.org>
Commit-Queue: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31368}
2020-05-27 14:33:50 +00:00
Danil Chapovalov
41559a2b46 In modules/audio_device replace mock macros with unified MOCK_METHOD macro
Bug: webrtc:11564
Change-Id: Ic93bc8272da9d7cd3f4adde5a24c07fd05b894bb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/175643
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31317}
2020-05-19 09:11:48 +00:00
Mirko Bonadei
4aafdba57e Compile ADM pulse code by default.
Pulse related code should still be disabled unless
WEBRTC_ENABLE_LINUX_PULSE is defined but it will always be
compiled.

Bug: None
Change-Id: If8a03aae445a8c73c3c347e275c5996368fe3088
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/171513
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30886}
2020-03-25 16:48:41 +00:00
Mirko Bonadei
fc9770c102 Prefix ALSA and PULSE macros with WEBRTC_.
This CL renames the internal macros LINUX_ALSA and LINUX_PULSE and adds
the prefix WEBRTC_. Since these macros are internal to WebRTC, it is
better to use a prefix.

Bug: None
Change-Id: I2a07fa569a4da168006cc36f32e4dbb98a75814b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/171514
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30885}
2020-03-25 15:23:19 +00:00
Kiran Thind
d5d0a2b546 Fix: rename ms_per_buffer to buffer_duration
Buffer duration is in seconds, not milliseconds.

No-Try: True
Bug: webrtc:11430
Change-Id: Ib03c2002f2dc6c43e01e50d745d709c2644c8b1e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/170500
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30798}
2020-03-16 11:04:20 +00:00
henrika
a598fafa41 Fixes flaky ADM unittest
Bug: webrtc:11399
Change-Id: Ic91e4954383f2f393efc23ae84587d945fd310fe
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/169556
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30673}
2020-03-03 15:07:58 +00:00
Fabian Bergmark
9a4eb32477 Change the AudioDeiviceDataObserver to be passed as a unique_ptr.
Bug: webrtc:11356
Change-Id: If89305f257fd966d83f37dbd03922c4d030b6d8f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168771
Commit-Queue: Fabian Bergmark <fabianbergmark@google.com>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30575}
2020-02-20 14:45:15 +00:00
Mirko Bonadei
4a14f4997c Remove wildcard ownership for build files.
No-Try: True
Bug: webrtc:10381
Change-Id: I852d9a2da7e0c5c12f508a1c788b0b5753503aba
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168769
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30558}
2020-02-19 14:05:46 +00:00
Mirko Bonadei
e52115a33e Remove inactive OWNERS.
No-Try: True
Bug: webrtc:10381
Change-Id: I3b56c74d913a47e4297518005b0cb19de8fafbff
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168421
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30556}
2020-02-19 13:37:36 +00:00
Fabian Bergmark
575c2ad8c5 Support passing the ADM to the ADMWrapper.
Bug: webrtc:11356
Change-Id: Ie68de35908e80cf395b6558d0725c0462412f333
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168482
Commit-Queue: Fabian Bergmark <fabianbergmark@google.com>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30543}
2020-02-18 14:13:46 +00:00
Danil Chapovalov
5528402ef8 Use newer version of TimeDelta and TimeStamp factories in modules/
This change generated with following commands:
find modules -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::Micros<\(.*\)>()/TimeDelta::Micros(\1)/g"
find modules -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::Millis<\(.*\)>()/TimeDelta::Millis(\1)/g"
find modules -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::Seconds<\(.*\)>()/TimeDelta::Seconds(\1)/g"
find modules -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::us/TimeDelta::Micros/g"
find modules -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::ms/TimeDelta::Millis/g"
find modules -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::seconds/TimeDelta::Seconds/g"
find modules -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::Micros<\(.*\)>()/Timestamp::Micros(\1)/g"
find modules -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::Millis<\(.*\)>()/Timestamp::Millis(\1)/g"
find modules -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::Seconds<\(.*\)>()/Timestamp::Seconds(\1)/g"
find modules -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::us/Timestamp::Micros/g"
find modules -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::ms/Timestamp::Millis/g"
find modules -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::seconds/Timestamp::Seconds/g"
git cl format

Bug: None
Change-Id: I117d64a54950be040d996035c54bc0043310943a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168340
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30489}
2020-02-10 11:49:57 +00:00
Steve Anton
760fd52494 Replace MockAudioDeviceModule mock refcounting with real refcounting
Bug: webrtc:11308
Change-Id: Ic55ec2c4b45f8fc709fe1348556bdeea6202e7a8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/166580
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30366}
2020-01-23 19:04:58 +00:00
Mirko Bonadei
ccbe95fd8a Reformat GN files.
`gn format` recently [1] changed its formatting behavior
for deps, source, and a few other elements when they
are assigned (with =) single-element lists to be consistent
with the formatting of updates (with +=) with single-element.

Now that we've rolled in a GN binary with the change,
reformat all files so that people don't get presubmit
warnings due to this.

CL generated with:
$ git ls-files | grep BUILD.gn | xargs gn format
$ gn format build_overrides/build.gni
$ gn format build_overrides/gtest.gni
$ gn format modules/audio_coding/audio_coding.gni
$ gn format webrtc.gni
$ gn format .gn

Plus a few manual changes to add exceptions for
"public_deps" (after changing these lines the presubmit
started to complain).

[1] - https://gn-review.googlesource.com/c/gn/+/6860

Bug: webrtc:11302
Change-Id: Iac29d23c1618ebef925c972e2891cd9f4e8cd613
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/166882
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30334}
2020-01-21 12:13:11 +00:00
Jonas Olsson
b2b2031457 Concatenate string literals at compile time.
This CL was generated by running:
git ls-files | grep ".cc" | xargs perl -i -ne 'BEGIN {undef $/}; s/("[\s\n]*<<[\s\n]*")/" "/g; print;'; git cl format

After that I manually edited modules/audio_processing/gain_controller2.cc to preserve its original
formatting.

This primary benefit of this change is a small reduction in binary size.

Bug: None
Change-Id: I689fa7ba9c717c314bb167e5d592c3c4e0871e29
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/165961
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30251}
2020-01-14 14:47:48 +00:00
Natalie Chouinard
65bbcabe2f [Android] Replace java_files with sources
Replace all usages of java_files with sources in gn files, and
automatically format.

This is in preparation for java_files being completely removed upstream
in favor of sources.

NOPRESUBMIT=true

Bug: chromium:1035074
Change-Id: Ib9a698740b7ad26a127031d90321c7ae2feb59bf
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/163161
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Natalie Chouinard <chouinard@google.com>
Cr-Commit-Position: refs/heads/master@{#30135}
2020-01-02 20:08:20 +00:00
Anders Klemets
eb8c4ca608 Remove unnecessary checks from AudioDeviceWindowsCore::CoreAudioIsSupported
This removes some code in the AudioDeviceWindowsCore::CoreAudioIsSupported function that was checking that every audio input and output device was functional. There are legitimate cases where some, or all, audio devices may not be accessible, and that was causing CoreAudioIsSupported to return false.

If CoreAudioIsSupported returns false, a subsequent RTC_CHECK call fails, which causes the entire app to exit.

After this change, the CoreAudioIsSupported() function simply checks if the Core Audio APIs are supported and no longer tries to do extra stuff unrelated to checking if the APIs are supported.

Note that Core Audio is actually supported in all versions of Windows after Windows XP. There were log messages in the code saying that if CoreAudioIsSupported() returns false, WebRTC will use the Wave Audio APIs instead. But this is no longer the case. The Wave Audio APIs would only be needed for Windows XP, and this code appears to have already been removed from WebRTC.
It is tempting to simply make CoreAudioIsSupported() do a "return true;" but for now I only removed the part of the logging messages that mentioned the Wave Audio APIs.

I understand that there is a new Audio Device Module (ADM) called WindowsCoreAudio2, which is now recommended for use by apps. Apps are supposed to instantiate WindowsCoreAudio2 and pass it in to WebRTC. When the app supplies its own ADM, CoreAudioIsSupported() does not get invoked, which avoids the bug. To help make it clearer that using WindowsCoreAudio2 is an acceptable solution, I am removing a comment that says that kWindowsCoreAudio2 is "experimental".

Bug: webrtc:11081
Change-Id: I7ed1684a276799f4c83006b45629e48814f0b18b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161463
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30025}
2019-12-06 10:09:03 +00:00
Mirko Bonadei
9f9e20a3dc Fix errorprone issues preventing Chromium Roll.
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}
2019-11-27 12:52:48 +00:00
henrika
af070d0299 Improves device enumeration in ADM2 for Windows.
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}
2019-11-22 14:27:10 +00:00
Tim Haloun
efbda8d90a Don't perform DataCallback if the input object has been stopped.
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}
2019-11-22 10:18:39 +00:00
henrika
bb55e0bc72 Clarifies identification of default communication device in ADM2
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}
2019-11-20 15:02:06 +00:00
Tim Haloun
83b286202b 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.

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}
2019-11-20 08:51:27 +00:00
henrika
351173c88c Tests that all available audio devices can be selected and used by the ADM.
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}
2019-11-18 17:47:31 +00:00
Tim Haloun
ef6fe0cf2b Use GetDefaultAudioEndpoint for the default communications device as well as the vanilla default device
Bug: b/144524502
Change-Id: I3349010a2f2d67cde29a61740496c38712f0f391
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/159900
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29808}
2019-11-15 23:26:07 +00:00
Tim Haloun
86b33e0b7e Don't ask for the friendly name of a default device if we failed to enumerate it.
Bug: b/144233691
Change-Id: I5f80c63858ec851ab14bcc3c1ca51ca2e9507834
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/159582
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Tim Haloun <thaloun@chromium.org>
Cr-Commit-Position: refs/heads/master@{#29778}
2019-11-12 18:41:24 +00:00
Danil Chapovalov
b9f69028a0 Store logging streams in a manually linked list instead of std::list
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}
2019-10-21 09:02:52 +00:00
Mirko Bonadei
3663ed3ad6 Move rtc_base/ignore_wundef.h to its own target.
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}
2019-10-19 10:50:36 +00:00
Mirko Bonadei
86d053c2db Use source_sets in component builds and static_library in release builds.
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}
2019-10-17 21:17:18 +00:00
Mirko Bonadei
317a1f09ed Use std::make_unique instead of absl::make_unique.
WebRTC is now using C++14 so there is no need to use the Abseil version
of std::make_unique.

This CL has been created with the following steps:

git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt
git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt
git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt

diff --new-line-format="" --unchanged-line-format="" \
  /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \
  uniq > /tmp/only_make_unique.txt
diff --new-line-format="" --unchanged-line-format="" \
  /tmp/only_make_unique.txt /tmp/memory.txt | \
  xargs grep -l "absl/memory" > /tmp/add-memory.txt

git grep -l "\babsl::make_unique\b" | \
  xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g"

git checkout PRESUBMIT.py abseil-in-webrtc.md

cat /tmp/add-memory.txt | \
  xargs sed -i \
  's/#include "absl\/memory\/memory.h"/#include <memory>/g'
git cl format
# Manual fix order of the new inserted #include <memory>

cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \
  xargs sed -i '/#include "absl\/memory\/memory.h"/d'

git ls-files | grep BUILD.gn | \
  xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d'

python tools_webrtc/gn_check_autofix.py \
  -m tryserver.webrtc -b linux_rel

# Repead the gn_check_autofix step for other platforms

git ls-files | grep BUILD.gn | \
  xargs sed -i 's/absl\/memory:memory/absl\/memory/g'
git cl format

Bug: webrtc:10945
Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 15:47:29 +00:00
Yves Gerey
ff060eef97 Disable AudioDeviceTest unittests under sanitizers.
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}
2019-09-11 14:25:08 +00:00
Alex Narest
44dc241ae8 Allows configuration of playout audio buffer
Playout audio buffer length in Java audio device configuration with fieldtrial.

Bug: webrtc:10928
Change-Id: I79286f09591f4b2c6a6146f23d3dce92a29f6b21
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150657
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Alex Narest <alexnarest@google.com>
Cr-Commit-Position: refs/heads/master@{#29005}
2019-08-29 12:57:14 +00:00
Niels Möller
f69bd5f184 Delete AudioDeviceWindowsCore::WideToUTF8, replaced with rtc::ToUtf8
Bug: None
Change-Id: I4152693622cc27a73ccd8526216d78532e110698
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/149837
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28927}
2019-08-21 13:23:09 +00:00
Alex Narest
bbeb10925e Reporting audio device underrun counter
Bug: webrtc:10884
Change-Id: I35636fcbc1e2a19a89242379cdff6ec5c12fd21a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/149200
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Alex Narest <alexnarest@google.com>
Cr-Commit-Position: refs/heads/master@{#28874}
2019-08-16 11:49:55 +00:00
Yves Gerey
704c8c4446 Re-enable AudioDeviceTest in combination with sanitizers.
Reactivate all tests which aren't flaky anymore.

Bug: webrtc:9751, webrtc:10867
Change-Id: I1d76e0f3e6cc82e78fc46214202f40a9666d41fd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/149060
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Yves Gerey <yvesg@google.com>
Cr-Commit-Position: refs/heads/master@{#28853}
2019-08-14 08:45:18 +00:00
Yves Gerey
412282acf9 [tsan] Guard audio_device_pulse_linux members from concurrent access.
This CL also fixes data races caused by tests themselves.

TBR= henrika@webrtc.org

Bug: webrtc:9751
Change-Id: Ie7c785b27142fd465f5b4dc9fb0628bd7274f1d2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/146600
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Yves Gerey <yvesg@google.com>
Cr-Commit-Position: refs/heads/master@{#28829}
2019-08-12 11:55:52 +00:00
Oleh Prypin
b1686786e8 Add RTC_ prefix to non-standard format specifier macro "PRIdNS"
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}
2019-08-07 13:36:05 +00:00
Oleh Prypin
84de3d95cf Factor framework dependencies out of audio_device_impl
Bug: None
Change-Id: I7d8d737134bb1a9dcf376cd39e74e73a5a6a0e97
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/147723
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Oleh Prypin <oprypin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28733}
2019-08-01 12:06:14 +00:00
Paul Roberts
fd643a4782 Build core audio for older windows versions
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}
2019-07-31 22:58:00 +00:00
Yves Gerey
432fe68af8 [Cleanup] Remove write-only member _sndCardRecDelay.
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}
2019-07-22 14:26:28 +00:00
Yves Gerey
b93a2451e0 [Unit tests] Remove race condition and dangling pointer to mock.
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}
2019-07-22 14:22:48 +00:00
Yves Gerey
1afe657d5c [Sanitizers] Disable tests at compile-time rather than run-time.
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}
2019-07-19 11:56:42 +00:00
henrika
6704df9640 Minor threading-model fix for ADM2 on Windows
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}
2019-07-18 16:23:05 +00:00
henrika
d8c6ec4d2f Adds support for disabling autostart in ADM2 for Windows
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}
2019-07-18 13:48:15 +00:00
Yves Gerey
ee0550cc4e [Unit tests] Show skipped tests instead of painting them green.
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}
2019-07-18 11:01:00 +00:00