Commit graph

3300 commits

Author SHA1 Message Date
Arun Raghavan
05a6af744b echo-cancel: Add beamforming support in the webrtc canceller 2016-02-25 09:17:25 +05:30
Arun Raghavan
cfd3a948de echo-cancel: Remove pa_ prefix on private functions 2016-02-25 09:17:25 +05:30
Arun Raghavan
be5e196c1a echo-cancel: Update a copyright notice 2016-02-25 09:17:25 +05:30
Arun Raghavan
07663b06b3 echo-cancel: Use webrtc's deinterleaved API
This is required to have unequal channel counts on capture in and out
streams, which is needed for beamforming to work. The deinterleaved API
only works with floating point samples.
2016-02-25 09:17:10 +05:30
Arun Raghavan
3133ff8e11 echo-cancel: webrtc canceller supports different in/out channel counts
Needed for upcoming beamforming code.
2016-02-25 09:09:13 +05:30
Arun Raghavan
222a98846c echo-cancel: Improve webrtc canceller error handling a bit 2016-02-25 09:09:13 +05:30
Arun Raghavan
5baecd37c3 echo-cancel: Fix webrtc canceller when rec channels != play channels
The calculations around how many samples were sent to the canceller
engine was not updated when we started supporting different channel
counts for playback and capture.
2016-02-25 09:09:13 +05:30
Arun Raghavan
08afc36ae4 echo-cancel: Make webrtc AGC start volume a modarg
Allows for tuning based on the target hardware.
2016-02-25 09:09:13 +05:30
Arun Raghavan
8de7dfec14 echo-cancel: Use anonymous unions for echo canceller params
Makes this part of the code just a little less verbose.
2016-02-25 09:09:13 +05:30
Arun Raghavan
8949ed96c6 echo-cancel: Add a modarg toggle for VAD in the webrtc canceller 2016-02-25 09:09:12 +05:30
Arun Raghavan
90608feac0 echo-cancel: Allow enabling of the webrtc experimental AGC mechanism 2016-02-25 09:09:12 +05:30
Arun Raghavan
19fb2481ea echo-cancel: Start capture at a sane volume if we're doing webrtc AGC
This is required to make sure the capture output has sufficient energy
for the AGC to do its job.
2016-02-25 09:09:12 +05:30
Arun Raghavan
a84d65d748 echo-cancel: Deal with volume limit breakage in webrtc AGC
The AGC code no longer seems to honour the analog volume limits we set,
and internally uses 0-255 as the volume range. So we switch to use that
(keeping the old API usage as is in case this gets fixed upstream).
2016-02-25 09:09:12 +05:30
Arun Raghavan
426c98acbb echo-cancel: Allow enabling tracing output from the webrtc canceller 2016-02-25 09:09:12 +05:30
Arun Raghavan
6431636fe1 echo-cancel: Mark private function as static 2016-02-25 09:09:12 +05:30
Arun Raghavan
0c86543c51 echo-cancel: Add a modarg to use sink/source master format and spec
This allows us to inherit the sample spec parameters from the sink and
source master (rather than forcing 32 kHz / mono). It is still possible
to override some of the parameters for the source side with modargs.

My original testing showed that these parameters provided a decent
perf/quality trade-off on lower end hardware (which I no longer have
access to). I figure it makes sense to continue with that for now, and
in the future this can be relaxed (use_master_format=yes could be the
default, and resource-constrained systems can disable it).
2016-02-25 09:09:12 +05:30
Arun Raghavan
23ef491122 echo-cancel: Express restrictions correctly on webrtc AEC stream config
In the refactoring, I'm expressing the constraints in what I see to be a
more natural way -- rec_ss expresses what we're feeding the canceller,
so it makes sense to apply the constraints on what the canceller accepts
there. This then propagates to the output spec.

This also exposes the range of sample rates that the library actually
supports (8, 16, 32 and 48 kHz).
2016-02-25 09:09:05 +05:30
Arun Raghavan
d777838fbb echo-cancel: Canceller may use different spec for playback and capture
The original intention was to configure low enough parameters to keep
CPU consumption down. Prior to this change, we assumed that the EC
backend would override the sink parameters based on the source
parameters to achieve this goal, and with this change we remove that
assumption by forcing the default parameters for the sink to be low
enough.
2016-02-24 18:43:58 +02:00
Tanu Kaskinen
fab8a16b0f echo-cancel: Add some bits for webrtc intelligibility enhancer
It's not possible to enable the intelligibility enhancer at the
moment, because the feature would require modifying the audio that we
play to speakers, which we don't do currently. All audio processing is
done at the source side, and it's not easy to change that.

This patch is based on Arun Raghavan's code, I just reordered things
a bit and reworded the FIXME comment.
2016-02-24 18:43:58 +02:00
Arun Raghavan
a14db55c2b echo-cancel: Allow enabling the extended filter in webrtc AEC
This creates a longer filter that is more complex and less sensitive to
incorrect delay reporting from the hardware. There is also a
delay-agnostic mode that can eventually be enabled if required.

In some very quick testing, not enabling this seems to provide better
results during double-talk.
2016-02-24 18:43:58 +02:00
Arun Raghavan
f8beaae238 echo-cancel: Update webrtc-audio-processing usage to new API
The code now needs C++11 support to compile with the updated
webrtc-audio-processing library.
2016-02-24 18:43:58 +02:00
Peter Meerwald
571aadfe3b modules: Fix compiler warning comparing 0 with bool
modules/module-stream-restore.c: In function 'clean_up_db':
modules/module-stream-restore.c:2344:74: warning: comparison of constant '0' with boolean expression is always true [-Wbool-compare]
         pa_assert_se(entry_write(u, item->entry_name, item->entry, true) >= 0);

reported by Ubuntu gcc-6

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2016-02-18 14:08:13 +01:00
Sangchul Lee
d049c2941e role-ducking: Fix improper unducking behavior in case of operating globally
Fix improper unducking behavior when using this module with "global=1" argument.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=93994

Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
2016-02-18 15:09:14 +05:30
Arun Raghavan
3977a906e2 coreaudio: Catch devices with more channels than we support 2016-02-12 19:34:58 +05:30
Arun Raghavan
cf503f9560 coreaudio: Dynamically allocate C string when converting from CFString 2016-02-12 19:34:58 +05:30
Jungsup Lee
2086fc82b6 rescue-streams : Fix a typo
Fix a typo in log message.

Signed-off-by: Jungsup Lee <jungsup4.lee@samsung.com>
2016-02-02 14:56:36 +05:30
Tanu Kaskinen
323dc5bfb9 device-manager: improve logging about non-existing data
Previously a missing key would cause this kind of log output:

D: [pulseaudio] module-device-manager.c: Database contains invalid data for key: sink:auto_null (probably pre-v1.0 data)
D: [pulseaudio] module-device-manager.c: Attempting to load legacy (pre-v1.0) data for key: sink:auto_null
D: [pulseaudio] module-device-manager.c: Size does not match.
D: [pulseaudio] module-device-manager.c: Unable to load legacy (pre-v1.0) data for key: sink:auto_null. Ignoring.

That is now replaced with

D: [pulseaudio] module-device-manager.c: Database contains no data for key: sink:auto_null
2016-01-26 15:46:20 +02:00
Jonathan Perkin
68216e8ff8 solaris: Catch up with newer API
Patch upstreamed from pkgsrc by Kamil Rytarowski <n54@gmx.com>.

See commit e4a7625ba8 for why this was
originally done.
2016-01-22 13:25:29 +05:30
Jason Gerecke
00ba340618 bluetooth: Prevent aborts caused by invalid module arguments
If 'pa_modargs_new' returns a NULL, we need to be careful to not call
'pa_modargs_free' in the failure path since it requires that we pass it
a non-null argument. Also updates 'module-bluetooth-policy.c:pa__init'
to follow the standard "goto fail" pattern used everywhere else.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
2016-01-15 16:20:53 +05:30
KimJeongYeon
19c71ce851 module-tunnel: Fix double free
Local pointer 'dn' freed again when pa_thread_new() failed.

Signed-off-by: KimJeongYeon <jeongyeon.kim@samsung.com>
2016-01-07 17:59:15 +05:30
Mihai Moldovan
403ba1e676 module-coreaudio-device: get channel name as CFString and convert to plain C string.
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
The old code fetched the channel name via AudioObjectGetPropertyData()
and accessed the "returned" data as a plain char buffer.

This may or may not have worked at some point according to the Apple
CFString documentation, which warns that the actual data layout is an
implementation detail and subject to change at any time.

On recent OS X versions, this behavior led to "random data" channel
names like >H��{, H��{<.

We need to actually let AudioObjectGetPropertyData() populate a CFString
struct and convert this into a plain char buffer.

The conversion function will not free the CFString, so do that in the
caller.

Signed-off-by: Mihai Moldovan <ionic@ionic.de>
2016-01-04 12:39:21 +05:30
Arun Raghavan
810aa36189 alsa: Don't disable timer-based scheduling on USB devices
This isn't a great fix, but we need ALSA API to do this right. In the
mean time, USB devices work fine with timer-based scheduling, so there's
no reason to force a large minimum latency by disabling tsched on them.
2015-12-29 06:00:14 +05:30
Tanu Kaskinen
e8d5a6af1e always-sink: simplify hook management with pa_module_hook_connect() 2015-12-21 05:37:28 +02:00
Georg Chini
fc803b4883 loopback: Validate the rate parameter 2015-12-18 07:35:15 +02:00
Arun Raghavan
12b5e7c873 echo-cancel: Don't skip canceller when sink is inactive
This forces the canceller engine to be invoked even if playback is not
currently active. We need to do this for cases where the engine provides
additional processing that is independent of playback, such as noise
suppression and AGC.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=83557
2015-12-15 17:09:31 +05:30
Tanu Kaskinen
1d7ce90139 conf-parser: add support for .d directories
This allows a configuration scheme where after loading configuration
from "somefile", the parser loads configuration from files in
directory "somefile.d". This feature needs to be enabled on a per-file
basis, though, and this patch doesn't yet enable the feature for any
files.
2015-12-14 13:45:39 +01:00
Juho Hämäläinen
f61a16b8b1 alsa-mixer: Have valid proplist for synthesized path as well.
When synthesized alsa path is freed there is an assert from NULL
proplist. Create empty proplist for the path to fix.

Signed-off-by: Juho Hämäläinen <juho.hamalainen@nomovok.com>
2015-12-11 10:05:41 +01:00
Kamil Rytarowski
93cccdee8d core, pulse, modules: Fix undefined behavior with array subscript of invalid type
From the NetBSD manual:

     The first argument of these functions is of type int, but only a very
     restricted subset of values are actually valid.  The argument must either
     be the value of the macro EOF (which has a negative value), or must be a
     non-negative value within the range representable as unsigned char.
     Passing invalid values leads to undefined behavior.

     --  ctype(3)
2015-12-08 08:56:07 +05:30
Kiran Krishnappa
96b368b960 module: Remove redundant core argument from pa_module_unload()
pa_module_unload() takes two pointers: pa_module and pa_core.
The pa_core pointer is also available via the pa_module object,
so the pa_core argument is redundant

[David Henningsson: Rebased to git HEAD]
2015-12-07 09:31:58 +01:00
Alexander E. Patrakov
04737989ec alsa-sink: Don't pretend to support passthrough on HDMI surround sinks
It doesn't work currently (fails and falls back to PCM), due to channel
count mismatch between the sink sample spec and the sample spec required
by IEC61937.

To be reverted when someone implements changing channel count without
switching profiles. This would also be required for HBR passthrough over
HDMI.

Reported-by: Xamindar <junkxamindar@gmail.com>
Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
2015-12-04 17:40:24 +05:30
Nazar Mokrynskyi
30a9523b75 alsa-mixer: sb-omni-surround-5.1.conf: remove analog-surround-21, add Linux 4.3+ support
In 2.1 mode LFE is not actually working at all, so it is removed.
With Linux 4.3-rc1+ Mic/Line are hw:%f,0,0 as it should be: https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/usb?id=5ee20bc792467d7d612157e0a9962765aa943b08
So now we support both Linux 4.2.x- and 4.3-rc1+ setups.
Also in Linux 4.3-rc1 S/PDIF input was detected incorrectly (there is no such hardware input), so it is not present in config.
2015-11-26 18:31:48 +01:00
David Henningsson
bea37613ce module-card-restore: Remove "version" from internal entry struct
If we always write entries of the latest version, we can simplify
code a little by only handling old versions in the "entry_read"
function and assume we have the latest version everywhere else.

Suggested-by: Tanu Kaskinen <tanuk@iki.fi>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-11-22 04:59:32 +02:00
David Henningsson
e87100d41e module-switch-on-port-available: Route to preferred profile
This makes the routing slightly more aggressive:

 * It will try to route to another profile, if such a profile
   is preferred by the port.

 * It will allow changing profiles on transitions both to
   PA_AVAILABLE_YES and PA_AVAILABLE_NO

To accommodate there is also some refactoring.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-11-22 04:59:30 +02:00
David Henningsson
063a1d350f module-switch-on-port-available: Use input and output names
In case input or output names are filled in, we can use this to
get a better match in the profile_good_for_input/output functions
instead of guessing based on number of sources and channels.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-11-22 04:59:29 +02:00
David Henningsson
9059fb3b4e card-restore: Save and restore "preferred profile" of port
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-11-22 04:59:27 +02:00
David Henningsson
2a71fd7597 alsa-mixer: Fill in input and output names
Fill in input_name and output_name to make routing easier for
routing modules.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-11-22 04:59:21 +02:00
Arun Raghavan
a01354db00 tests: Make echo-cancel-test not crash
Adding AGC broke this test, so we hard-disable the volume code in test
mode. This is probably okay for now, since at least with analog AGC, the
source volume changes and the data we get is going to be with AGC
applied, but digital gain won't be encapsulated here.

Long term, we might need to figure out how to deal with this properly.
2015-11-20 19:24:50 +05:30
Arun Raghavan
d084cf144a alsa: Use helper function for byte conversion across sample specs 2015-11-20 17:34:38 +05:30
David Henningsson
107dfa8e01 alsa-mixer: Return early in case of no mixer poll descriptors
We encountered an alsa plugin a while ago (not sure if the source
can be shared) which had mixer controls, but no descriptors to
poll for changes.

Quit early to avoid latter assertion failures.

BugLink: https://bugs.launchpad.net/bugs/1092377
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-11-17 09:30:58 +01:00
Zbigniew Kempczyński
f621aa5e2c alsa-sink: Avoid unloading alsa-sink module before calling try_recover()
This fixes rare condition when pulseaudio client tries to rewind,
but a device previously reached underrun and was changed to XRUN state.
2015-11-14 09:50:34 +05:30