Commit graph

7551 commits

Author SHA1 Message Date
Tanu Kaskinen
6ad2d207c5 alsa-mixer: Document the description and description-key mapping options 2020-11-22 16:14:58 +02:00
Igor V. Kovalenko
e81873611c switch-on-port-available: Add logging for port availability group 2020-11-21 14:36:51 +00:00
Igor V. Kovalenko
329bfe8f20 module-alsa-card: Add debug logging if availability group was pruned 2020-11-21 14:36:51 +00:00
Igor V. Kovalenko
2d018a82ad pactl: explicitly print if port availability is unknown
Port availability is a tristate -- not-available / unknown / available.
Explicitly print if availability is unknown to reduce confusion.
2020-11-21 16:34:09 +03:00
Arun Raghavan
d83ad6990e module-alsa-card: Drop availability groups with only one port
These are not really meaningful, and can be confusing for clients.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1022
2020-11-17 16:38:56 +00:00
Arun Raghavan
323195e305 switch-on-port-available: Switch to headphones on unknown availability
Since not all users will have environments that asks what they plugged
in when their hardware supports TRRS inputs but don't have impedance
sensing, let's emulate our previous default behaviour of enabling the
headphone port at least.

This can likely be improved so users can configure the module to select
for the device they are most likely to plug in (so an option to enable
just the microphone, or headphones+headset-mic ports).

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1028
2020-11-15 04:00:25 -05:00
Tanu Kaskinen
e70d34ae18 alsa-mixer: Remove references to non-existent multichannel paths
We don't have any mixer configuration for the multichannel mappings.
2020-10-31 12:00:54 +02:00
Tanu Kaskinen
daf3a3c4b0 alsa-mixer: Fix jack name comparison
HDMI jacks are configured like this:

    [Jack HDMI/DP]
    append-pcm-to-name = yes

The pa_alsa_jack.name field is then "HDMI/DP" and pa_alsa_jack.alsa_name
is set to "HDMI/DP,pcm=3 Jack" or similar. If we compare the name fields
of HDMI paths, they appear to use the same jack element even though they
are different in reality, so all HDMI ports got incorrectly assigned to
the same availability group.
2020-10-30 16:55:39 +00:00
Tanu Kaskinen
eee8292ae1 alsa-mixer: Set availability groups once per card
Previously they were set once per mapping, which caused the numbering to
restart from 1 for every mapping, so ports were incorrectly assigned to
the same group.
2020-10-30 16:55:39 +00:00
Arun Raghavan
a9c6d43b7c sink, source: Skip filter streams while changing default sink/source
Streams connecting filter devices to their target devices shouldn't move
because of default settings (they are intended to be filtering the
specific device that are attached to).

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1015
2020-10-26 12:00:35 -04:00
Jaroslav Kysela
1d6bd6689f alsa: move the exceptionally large value errors from error to debug level
Almost all reports from users, I have seen in last years, were not valid.
The report is also printed when the system scheduler does not wake
the pulseaudio thread in the right time. Users are not able to distinguish
between slow machine and the real problem.

Move the log level from 'error' to 'debug' for those messages.

The right fix should be to measure the time between the call invocation and
return to determine (and skip) the scheduling problems, but it is another
extra code just to debug things.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-26 15:48:35 +00:00
Arun Raghavan
314e97d995 rtp: gstreamer: Account for rounding errors in RTP timestamp conversion
Since the RTP timestamp is converted to time units and back, a small
error can creep up, which then results in a single frame error in where
we place the buffer in the output memblockq. This results in minor
glitches, so we check for and eliminate the error.
2020-10-23 12:11:35 -04:00
Arun Raghavan
5f12dde2f5 rtp: gstreamer: Don't count on buffer DTS for capture time
With GStreamer 1.18, the old behaviour of storing the capture time in
DTS is gone (which is reasonable, since the semantics really don't
match). So instead, we get a capture timestamp when the buffer is being
pushed from udpsrc. This should eventually move into udpsrc, and the
timestamp should come from the cmsg instead of the clock.

We still fallback to the DTS if the meta isn't available, as the meta
might be dropped in older versions of rtpL16pay due to a bug.
2020-10-23 12:11:35 -04:00
Igor V. Kovalenko
3fc2ac10c6 module-bluez5-discover: avoid use after free on de-init
Hashmap loaded_device_paths contain objects holding keys to entries, and
these objects must be alive while map is emptied.

Reorder freeing this hashmap before destroying device objects to fix
crash on exit.
2020-10-23 04:57:15 -04:00
Igor V. Kovalenko
ef6ceb83a2 build-sys: meson: adjust path to gsettings-helper runing from build tree 2020-10-20 15:24:52 -04:00
Arun Raghavan
40bb058a31 build-sys: meson: Add libm dep to raop module
This is required for using pow().
2020-10-20 14:37:10 -04:00
Igor V. Kovalenko
44c5317624 device-port: fire port available changed hook after streams are moved
If port becomes unavailable then PA_CORE_HOOK_PORT_AVAILABLE_CHANGED
callbacks may eventually destroy related source or sink object. Call
this hook after stream is moved to prevent crash reading from freed
memory.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1008
2020-10-20 17:31:29 +03:00
Arun Raghavan
7f4d7fcf5f Revert "alsa-mixer: support up to 8 channels per mixer element"
This reverts commit e0ab9fa4a4.

The change broke some Xonar cards, and we probably don't want to hold up
the 14.0 release for this.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1009
2020-10-13 21:03:30 -04:00
Igor V. Kovalenko
05f567086b module-stream-restore: check if dbus entry exists in dbus_entries map before creating it
If write_entry fails to store new entry in database, next time we can try creating new entry again.
With DBUS enabled this will create another dbus entry for same name leading to crash inserting duplicate into dbus_entries map.

Fix this by checking if dbus entry exists in dbus_entries map before creating it.

Fixes: #974
2020-10-13 10:35:44 +00:00
Igor V. Kovalenko
99b2d88282 module-stream-restore: log error writing volume/mute/device entry to database 2020-10-13 10:35:44 +00:00
Jaroslav Kysela
e0ab9fa4a4 alsa-mixer: support up to 8 channels per mixer element
We have at least one USB hardware which supports the 8
channels in one mixer element:

  https://github.com/alsa-project/alsa-ucm-conf/pull/25

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-13 10:27:59 +00:00
Tanu Kaskinen
06990e32ff alsa-mixer: Document the intended-roles mapping option 2020-10-13 13:22:11 +03:00
Jaroslav Kysela
6101798c7a alsa: fix type for legacy hdmi devices
Although the hdmi-output is in well_known_descriptions[] table,
the hdmi device names are indexed (hdmi-output-0), thus there
is no match to assign the proper type automatically.

This patch puts the correct hdmi type to all relevant hdmi
configuration files.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-04 21:39:33 +02:00
Jaroslav Kysela
a46bdcedc1 alsa: fix analog-input-microphone-headset device type
From: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-04 14:22:53 +03:00
Jaroslav Kysela
3efcb6847d alsa: mixer - reorder the type field in path parser
The items array is assigned later and the order of fields is important.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-04 14:22:53 +03:00
Michael Pivonka
36a86d4149 alsa-mixer: Add Razer Kraken Tournament Edition USB headset 2020-09-29 15:32:45 +00:00
Ralph Seichter
0050e5863a macos: Add missing import statement
Add missing import of util.h. This fixes a build failure with the
Xcode 12 command line tools which manifests as follows:

  error: implicit declaration of function 'pa_thread_make_realtime'
  is invalid in C99 [-Werror,-Wimplicit-function-declaration]

Ref https://trac.macports.org/ticket/61107
2020-09-28 15:44:38 +03:00
Sanchayan Maity
410db7d216 rtp: Fix sending of small packets
The current implementation for RTP send isn't optimised for sending MTU
bytes of data like rtp-native. For eg. if MTU is 1280 bytes and we have
to send 1276 bytes, two packets are send out one of 1268 bytes and other
of 8 bytes. Sending out a packet of 8 bytes has a significant overhead
and we should be sending MTU bytes of data.

Fix this by accumulating MTU bytes of data and sending data only on
accumulation of MTU worth of data.
2020-09-21 10:06:48 +05:30
Jaroslav Kysela
c1a7e3c59d ucm: add possibility to skip the UCM card completely (Linked)
We have a requirement to "hide" some hardware drivers, because
other (main) UCM configuration will refer them.

This patch use special error codes to notify the upper layers
to skip the module loading.

BugLink: https://github.com/alsa-project/alsa-ucm-conf/issues/30
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-09-17 14:52:50 +00:00
Arun Raghavan
460d0c0b79 alsa-mixer: Add an explicit profile-set for Audigy devices
These lost analog-mono support when we made that a fallback profile, as
the stereo-fallback would be picked up as the only input profile, and
that does not work in duplex mode.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/750
2020-09-02 16:30:06 -04:00
Tom Yan
e36132b7dc main, core: check idle after loading conf
pa_core_check_idle() uses pa_core.exit_idle_time, which is set after the
pa_core_new() call, so pa_core_check_idle() needs to be called later.

This patch preserves the fact that core state is set to PA_CORE_RUNNING
after checking idle (now in main). It doesn't seem to matter anyway and
main(pa_core_new(state:PA_CORE_STARTUP)->...->state:PA_CORE_RUNNING)
seems right as well.
2020-08-31 19:09:02 +03:00
itsthem
90a6c5ef07 pulsecore: Replace gendered pronouns with gender neutral ones 2020-08-28 13:15:50 +00:00
Tanu Kaskinen
a863b5795a alsa-mixer: Fix indentation 2020-08-10 20:56:43 +03:00
Tanu Kaskinen
af42b3eb6f Rename "available group" to "availability group"
"Availability group" is more clear about what the field is about.
Credits to Arun Raghavan for coming up with the better name.
2020-08-10 20:54:21 +03:00
Tanu Kaskinen
1b44b44c75 alsa-mixer: Fix mapping_group_available() logic
There were three bugs:

1) j->state_plugged was set to PA_AVAILABLE_UNKNOWN too early. It must
be set only after we have found that the jack is shared by two ports.
The result of setting it too early was that no jack ever could have
the PA_AVAILABLE_YES status.

2) The inner jack loop iterated through p->jacks instead of p2->jacks,
so the code didn't compare jacks between two ports at all. As a result
all ports were put in the same availability group.

3) The inner jack loop checked j->state_plugged instead of
j2->state_plugged. The result was that the speaker port, which uses the
Headphone jack to toggle between unknown and unavailable, was put in the
same group with the headphone port.
2020-08-10 20:54:21 +03:00
Tanu Kaskinen
0ce3008605 Improve the port available_group and type documentation 2020-08-10 20:54:21 +03:00
Sanchayan Maity
1781031c8b modules: rtp-gstreamer: Fix RTP sound lag
In the current scenario of reading samples from the appsink, it is
observed that we do not actually read all the data available in the
appsink to read. This results in a choppy sound or heard as gaps in
the playback.

The underlying reason for this happening is as follows. Let's say
the appsink new sample callback is called 2-3 times, but, with the
underlying fdsem post machinery when pa_rtp_recv eventually gets
called, there would be those 2-3 samples to read. However, we were
only reading one sample in the current implementation.

Fix this by reading all samples from the appsink in a loop, coalescing
them and then writing to the memchunk.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/889

Signed-off-by: Sanchayan Maity <sanchayan@asymptotic.io>
2020-08-10 12:36:17 +00:00
Kai-Heng Feng
dd70c3c589 module-alsa-card: Set a minimum profile priority if it's not set
If the profile is generated from UCM, the priority won't be set so it
stays as 0.

Assume a card has two available profiles, when the selected one becomes
unavailable, module-switch-on-port-available's find_best_profile()
should pick the next available one. However, since the priority is 0,
the "off" profile was chosen instead of the available one.

So let's set the priority to 1 to make profile that is available has
higher priority than "off" profile.
2020-08-10 11:52:31 +00:00
Rosen Penev
ceaa69d71f raop-crypto: add missing header
Fixes compilation without deprecated OpenSSL APIs.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-08-10 11:38:48 +00:00
Rosen Penev
1ae8097b8b modules: fix wrong formats under 32-bit
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-08-10 10:56:40 +00:00
Jan Alexander Steffens (heftig)
b657cff400 build: Make alsadatadir configurable
Pipewire has started shipping copies of PulseAudio's ALSA card profiles.

It would be useful if both projects could share the same profiles and
this patch is a step toward that.
2020-08-09 01:57:01 +00:00
Jan Alexander Steffens (heftig)
af5ae60b33
meson: Add missing thread_dep to atomic-test
Otherwise it won't link.

    /usr/bin/ld: /tmp/atomic-test.uzrv5D.ltrans0.ltrans.o:
    undefined reference to symbol 'pthread_setaffinity_np@@GLIBC_2.3.4'
2020-08-09 03:29:23 +02:00
Tanu Kaskinen
628f068788 gitignore: Ignore hashmap-test 2020-08-06 14:34:56 +03:00
Kai-Heng Feng
e153fb8706 alsa-mixer: Recognize USB audio jack mixer
UAC v2 and v3 support insertion control (jack detection), and the
created jack mixers have "- Input" suffix and "- Output" suffix for
input jack and output jack, respectively.

Add these jacks so we don't always need to rely on UCM or PulseAudio
profile-set.
2020-08-05 00:42:26 +08:00
Tanu Kaskinen
9636c2940b udev: fix too long card name with HyperX Cloud Orbit S
Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/820
2020-08-04 12:40:22 +00:00
Tanu Kaskinen
7742c9aa50 meson: Build atomic-test
The test was missing from the build system.
2020-08-04 15:09:36 +03:00
Tanu Kaskinen
99db8038de build-sys: Build atomic-test only if pthread_setaffinity_np() is available
The function seems to be essential to the test, so the test has to be
disabled entirely if pthread_setaffinity_np() is not available.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/850
2020-08-04 15:09:33 +03:00
Wim Taymans
4d1e568619 alsa-util: fix check for digit
Fix the check for a digit by checking if the value is between the
*character* '0' (not *value* 0) and '9'.
2020-08-03 09:58:39 +02:00
Tomasz Kontusz
47d811224d alsa-mixer: add support for Astro A50 gaming headset 2020-07-26 04:39:40 +00:00
Tomasz Kontusz
8482b62b0a alsa-mixer: add description-key to Mappings and Profiles 2020-07-26 04:39:40 +00:00