Commit graph

3300 commits

Author SHA1 Message Date
Jaska Uimonen
9acacd9ba3 alsa-ucm: Fix volume control based on review
- sync mixer logic added
- mixer path creation, empty set in mapping creation, paths added in path creation
- path creation moved inside new port creation as it might be called twice otherwise
- some comments added
2019-12-06 10:05:44 +00:00
Arun Raghavan
3dfccada46 alsa-ucm: Support Playback/CaptureVolume
This allows us to support the PlaybackVolume and CaptureVolume commands
in UCM, specifying a mixer control to use for hardware volume control.
This only works with ports corresponding to single devices at the
moment, and doesn't support stacking controls for combination ports.

The configuration is intended to provide a control (like Headphone
Playback Volume), but we try to resolve to a simple mixer control
(Headphone) to reuse existing volume paths.

On the UCM side, this also requires that when disabling the device for
the port, the volume should be reset to some default.

When enabling/disabling combination devices, things are a bit iffy since
we have no way to reset the volume before switching to a combination
device. It would be nice to have a combination-transition-sequence
command in UCM to handle this and other similar cases.

PlaybackSwitch and CaptureSwitch are yet to be implemented.
2019-12-06 10:05:44 +00:00
Jaroslav Kysela
1c240b7a12 alsa-mixer: improve alsa_id_decode() function
Accept those identifiers:

        Speaker,1
        'Speaker',1
        "Speaker",1

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-06 10:05:44 +00:00
Jaroslav Kysela
7f4b8e1a7c alsa-mixer: handle the index for ALSA mixer element identifiers
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-06 10:05:44 +00:00
Jaroslav Kysela
ab5be56a10 alsa-ucm: add mixer IDs to ucm_items
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-06 10:05:44 +00:00
Jaroslav Kysela
c8f065250d alsa-ucm: use ucm2 name for the direct card index open
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-06 10:05:44 +00:00
Dave Chiluk
1ee1f749e1 alsa-mixer: add support for LucidSound LS31, and create usb-gaming-headset profile 2019-12-05 03:02:28 +00:00
Krzysztof Stasiowski
79d3b99ba4 alsa-mixer: Add support for SteelSeries Arctis 5 2019 headset
Signed-off-by: Dave Chiluk <chiluk@ubuntu.com>
2019-12-05 03:02:28 +00:00
Josh
7259e8c22f alsa-mixer: add support for SteelSeries Arctis Pro 2019 headset
Signed-off-by: Dave Chiluk <chiluk@ubuntu.com>
2019-12-05 03:02:28 +00:00
Hui Wang
f899d5f466 stream-restore: skip entries setting action from gnome-control-center
When users select an output device from gnome-control-center UI, the
sink of this output device will be set to the configured_default_sink
and the default_sink, these actions are expected, but after these
actions, the gnome-control-center will call extension_cb() to modify
the entries in the database, let all stream entries to bind the sink
users select, this is not correct since the sink is default_sink now.

This is a temp fix for this issue, after gnome-control-center fixes
this problem, this patch should be reverted.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
2019-11-27 12:26:40 +08:00
Hui Wang
43e3a7f3c3 sink: move the streams to the default_sink when the sink is unlinked
When a sink is unlinked, all streams of this sink are moved to
default_sink, this action is implemented in the core rather than
modules now.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
2019-11-27 12:26:34 +08:00
Hui Wang
b886836630 sink: move streams to new appeared sinks if they prefer these sinks
When a new sink appears, all streams that have their preferred_sink
set to the new sink should be moved to the new sink.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
2019-11-27 12:11:28 +08:00
Hui Wang
40d92e9b1a core: move sink-inputs conditionally when update default_sink
When the default sink changes, the streams from the old default sink
should be moved to the new default sink, unless the preferred_sink
string is set to the old default sink and the active port of the old
default sink is not unavailable

Signed-off-by: Hui Wang <hui.wang@canonical.com>
2019-11-27 12:09:21 +08:00
Hui Wang
bc0e728320 sink-input: clear the preferred_sink if it is default_sink
When the user moves a stream to the current default sink, the
preferred_sink should be set to NULL and module-stream-restore
should clear the routing for that stream in the stream database. From
that point on the stream will be always routed to the default sink.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
2019-11-26 19:38:29 +08:00
Hui Wang
24d5d180b8 sink-input: add a new API pa_sink_input_set_preferred_sink
If the sink here is NULL, that means users want to clear the
preferred_sink and move the sink-input to the default_sink, otherwise
set the preferred_sink to the sink->name and move the sink-input to
the sink. After that fire the sink_input_change event.

After adding this API, we can use this API to simplify the entry_apply
in the module-stream-restore.c.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
2019-11-25 19:43:53 +08:00
Hui Wang
fbf8716685 sink-input: change bool save_sink to char *preferred_sink
The finial objective is to store the preferred sink name in the
sink-input struct, and use module-stream-restore to save and restore
it.

This patch just replaces the save_sink with preferred_sink, and tries
to keep the original logic.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
2019-11-25 19:43:53 +08:00
Arun Raghavan
26a66d103f switch-on-connect: Fix warning on discarded const qualifier
pa_modargs_get_value() returns a const string -- instead of discarding
the const qualifier, let's just duplicate the string and free it
explicitly in the failure case.
2019-11-22 22:32:16 +05:30
Ryszard Knop
ad16d77dfe switch-on-connect: Add blacklisting
Add a new module argument, blacklist, which is a regular expression.
If the sink/source name matches the provided blacklist regex, don't
automatically switch to it. By default, no devices are blacklisted.

Add a new function to check whenever a regex pattern is valid, plus
extra NULL asserts in pa_match.
2019-11-21 22:19:44 +01:00
Wim Taymans
c7a55174dc X11: Add xauthority parameter
Add an xauthority parameter and use it in the startup script.

Apparently on some systems the X authentication cookie is not stored in
~/.Xauthority but in some dynamic location pointed to by the XAUTHORITY
environment variable. The environment variable therefore needs to be set
in the PulseAudio daemon environment in order to have access to the X
server from the PulseAudio daemon, but the variable is not necessarily
set when starting PulseAudio. For example, systemd starts PulseAudio
outside the X session. The start-pulseaudio-x11 script is run in the
X session, so it has the environment variable available, and can pass it
to the X modules, which then can set the variable in the daemon
environment.

RedHat bug: https://bugzilla.redhat.com/show_bug.cgi?id=1723065
Debian bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593746

Based on patch by Alexander Kurtz <kurtz.alex@googlemail.com>
2019-11-21 14:44:09 +02:00
David Heidelberg
5231483432 meson: convert post-install.sh to python
Inspired by: 36a2e4f8a7 (0cc1139e3347f573ae1feee5b73dbc8a8a21fcfa_0_14)

Signed-off-by: David Heidelberg <david@ixit.cz>
2019-11-14 21:10:00 +02:00
Arun Raghavan
a17cc55c4c rtp: Add some logging to know what backend is being used
Should make debugging any issues that come up easier.
2019-11-08 17:39:40 +05:30
Sebastian Dröge
a34d2e547b rtp: Properly timestamp buffers in the GStreamer sender pipeline
Otherwise default timestamping will happen, which might not be correct,
especially not after the stream was suspended for a while.
2019-11-08 17:39:40 +05:30
Sebastian Dröge
72dbbcbc65 rtp: Use udpsink instead of fdsink for the GStreamer RTP implementation 2019-11-08 17:39:40 +05:30
Arun Raghavan
74f8456acb rtp: Add a GStreamer-based RTP implementation
This adds a GStreamer-based RTP implementation to replace our own. The
original implementation is retained for cases where it is not possible
to include GStreamer as a dependency.

The idea with this is to be able to start supporting more advanced RTP
features such as RTCP, non-PCM audio, and potentially synchronised
playback.

Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2019-11-08 17:39:40 +05:30
Arun Raghavan
eb912d3605 rtpoll: Separate out before/after/work callback userdata
It is possible that we might want to have a separate userdata to be used
for these callbacks, so let's split them out.

This is particularly needed when using an pa_rtpoll_item around pa_fdsem
since that uses its own before/after callback but will essentially have
whatever is using the fdsem set up the work callback appropriately (and
thus at least the work callback's userdata needs to be separated from
the before/after callback -- we might as well then just separate all
three).

Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2019-11-08 17:39:03 +05:30
Arun Raghavan
d15291bbbb rtp: Hide RTP implementation details from module-rtp-*
This moves RTP implementation-specific information out of
module-rtp-send/recv. This is basically done by making the
pa_rtp_context structure opaque from the perspective of these modules.
We can then potentially replace the underlying RTP implementation with
something else transparently.

One RTP detail that does "leak" is the RTP timestamp. We provide this to
module-rtp-recv so that it can perform rate adjustments to match the
sender rate.

Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2019-11-08 17:39:03 +05:30
Arun Raghavan
0548cdc6d6 rtp: Move MTU handling to the RTP implementation
module-rtp-send itself doesn't really need to handle this, the
implementation can keep track (and make sure sending happens in MTU
sized chunks).

Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2019-11-08 17:39:03 +05:30
Arun Raghavan
02fa9d5fc6 rtp: Drop support for non-L16 media
There doesn't seem much value in supporting streaming U8/mulaw/alaw on
the network, and it's unlikely these get any testing. Makes more sense
to drop these formats and just convert to L16 if we're dealing with
source media in that format.

Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2019-11-08 17:39:03 +05:30
Arun Raghavan
7766f0e8d7 rtp: Don't use cookie for SSRC
Publishing the cookie on multicast seems to be a bad idea.

Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2019-11-08 17:39:03 +05:30
Arun Raghavan
a9a3f0874a rtp: Make init return a value for success/failure
This will be used in the future when writing other RTP implementations
that can fail on init.

Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2019-11-08 17:39:03 +05:30
ckdo
aee67ba806 rtp: Fix reverted test for INHIBIT_AUTO_SUSPEND_ONLY_WITH_NON_MONITOR_SOURCES
RTP Monitor sources were never suspended when
inhibit_auto_suspend=only_with_non_monitor_sources

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/735
2019-10-26 16:36:19 +03:00
Tanu Kaskinen
248a77c7fd alsa-mixer: recognize the "Speaker Jack" control
This control has been seen in the wild:
https://lists.freedesktop.org/archives/pulseaudio-discuss/2017-August/028595.html
(The pastebin link in that mail might not work anymore, but the paste
just shows that there's a Speaker Jack control).
2019-10-26 16:21:27 +03:00
Rasmus Thomsen
bff163089c meson: link libintl if it's not provided by libc
This fixes the build on musl with external gettext
2019-09-25 04:42:03 +00:00
Tanu Kaskinen
d72a3a5eca null-sink: allow clients to configure the supported formats
The set_formats() callback is already implemented, so the only thing
missing was the SET_FORMATS flag.
2019-09-24 02:36:56 +00:00
ckdo
0d22558b47 raop: Fix non working tcp mode 2019-09-24 02:29:59 +00:00
Jan Alexander Steffens (heftig)
7e039c4ff7 meson: Define TUNNEL_SINK for module-tunnel-sink
This was missing, so it was building another tunnel-source instead.

Fixes https://bugs.archlinux.org/task/63755
2019-09-20 12:18:11 +00:00
David Emett
b76f668253 dbus: fix ActiveProfile setting
Just like with handle_set_active_port, we need to look up the profile
corresponding to the provided path rather than doing a name comparison.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/709
2019-08-27 08:51:27 +05:30
Pali Rohár
bdf66c4693 bluetooth: Only perform write-related calculations when we have a sink
This avoids a potential divide-by-zero when we try to decide how much to
write to the sink in the source thread when there is no sink.

Fixes https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/717
2019-08-27 08:44:27 +05:30
RODRIGUEZ Christophe
2e7c0ee8f8 raop: Fix infinite loop in raop-sink with UDP mode
There are potentially unresolved issues around the EAGAIN logic, but
this should prevent an infinite loop and log flood in the mean time.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/695
2019-08-17 10:43:20 +00:00
Arun Raghavan
0f1920f337 build-sys: meson: Add mkfifo checks for module-pipe-* 2019-08-15 18:57:13 +05:30
Arun Raghavan
1e996445f7 build-sys: meson: Add atomic ops related checks 2019-08-15 18:57:13 +05:30
Lucas Stach
1911ef16e2 meson: allow to build bluez support without libbluetooth
pulseaudio does not link against libbluetooth, as it's only talking to the
bluez daemon over dbus. So the build dependency on libbluetooth is overly
restrictive, as some embedded systems choose to ship without libbluetooth
but still have bluez daemon support.

This syncs the meson to the autotools configuration behavior by changing
the bluez option to a default on boolean.
2019-08-14 10:16:34 +02:00
Jan Alexander Steffens (heftig)
728a4402eb
build-sys: meson: Fix 2 cases of joining paths w/o join_paths
Fixes https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/712
2019-08-13 22:10:44 +02:00
Arun Raghavan
7f44a623e0 build-sys: meson: Correctly set up RPATH
This was being done automatically by autotools, now we need to manually
specify this for each executable/library with a dependency in a
non-standard directory.
2019-08-05 09:52:32 +05:30
Arun Raghavan
f996ad0688 build-sys: meson: Add -Wl,no-delete to relevant libraries
This mirrors the autotools option for all server-side dynamic libraries.
2019-08-05 09:52:32 +05:30
Pali Rohár
9e70d05201 bluetooth: Fix usage of RTP structures in SBC codec
Rename struct rtp_payload to rtp_sbc_payload as it is specific for SBC
codec payload.

Add proper checks for endianity in rtp.h header and use uint8_t type
where appropriated.

Field frame_count is only 4 bit number, so add checks to prevent overflow.

And because is_fragmented field is not parsed by decoder there is no
support for decoding fragmented SBC frames. So throw an error in this case.
2019-07-24 17:29:45 +03:00
Pali Rohár
064277b4ee bluetooth: Change A2DP codec API of reset() method to indicate failure
SBC codec reset() method may fail, so propagate this failure to caller.
2019-07-24 17:29:45 +03:00
Pali Rohár
018b38ec39 bluetooth: Fix usage of MTU, buffer sizes and return values of encode/decode methods
Add explanation why minimal bitpool value is used in SBC codec as initial
bitpool value for A2DP source.

Set buffer size for reading/writing from/to A2DP socket to exact link MTU
value. This would ensure that A2DP codec does not produce larger packet as
maximal possible size which can be sent.

Because A2DP socket is of SOCK_SEQPACKET type, it is guaranteed that
we do not read two packets via one read/recvmsg call.

Properly check for all return values of encode/encode methods of A2DP codec
functions. They may fail at different levels. Also encode or decode API
method may return zero length buffer (e.g. because of algorithmic delay of
codec), so do not fail in this case.
2019-07-24 17:29:45 +03:00
Kaleb Ercanbrack
e34dd0fb8f alsa-mixer: Add a missing USB product ID for SteelSeries Arctis 7 2019-07-11 14:09:58 +00:00
Frédéric Danis
f89d64b98e bluetooth: Fix crash when disabling Bluetooth adapter
This crash occurs when PA is connected to a phone through the oFono
backend.
When disabling the Bluetooth adapter, pa_bluetooth_device is removed before
hf_audio_card. Both keep refs on pa_bluetooth_transport. Those removal will
call pa_bluetooth_transport_free() from device_free() (bluez5-util.c) and
hf_audio_card_free() (backend-ofono.c).
In the end, the call to pa_bluetooth_transport_free() calls
pa_hasmap_remove() through pa_bluetooth_transport_unlink(), but since
memory has already been freed, the second try results in a segfault.

Triggering hf_audio_card removal during pa_bluetooth_device removal allows
hf_audio_card to be freed at the right time.
2019-07-02 06:06:07 +00:00