Commit graph

9361 commits

Author SHA1 Message Date
Tanu Kaskinen
f5d3606fe7 virtual-surround-sink: Use correct sample spec with memblockq
The memblockq stores data in the virtual sink format, not in the master
sink format. The wrong sample spec caused a crash when the virtual sink
rendered data whose length was not divisible by the sink input frame
size.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/786
2020-01-05 09:31:07 +02:00
Tanu Kaskinen
a71136be52 virtual-source: Don't process the rewind during requesting it
The request_rewind() callback of the uplink sink called
pa_sink_process_rewind(), which is not allowed. Things are supposed to
happen so that first a rewind is requested, and then during the next
rtpoll loop the sink will process the request. Calling
pa_sink_process_rewind() during the request phase caused a crash.

Having a request_rewind() callback is completely unnecessary, because
it's only useful for forwarding the request to a downstream sink. In
this case there is no downstream sink.

I also set max_rewind to 0, because the sink doesn't support rewinding.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/775
2020-01-04 11:54:36 +02:00
Ben Buchwald
bcc2162fb4 module-jackdbus-detect: Separate sink/source channels arguments
If a channels argument is passed module-jackdbus-detect, it is passed to both
module-jack-sink and module-jack-source when those are started. This is a
problem if you want a different number of input channels from output channels.
In particular, if you want more of one than you physically have of the other,
it will fail. This commit adds separate source_channels and sink_channels
arguments to be able to specify the channels arguments to module-jack-source
and module-jack-sink separately. The combined channels argument is kept for
backwards compatibility and will be used as a default for source_channels and
sink_channels if either of them is omitted.
2020-01-02 16:44:15 +00:00
Ben Buchwald
64211b8f59 module-jackdbus-detect: Allow omitting channels argument
module-jackdbus-detect documents the channels argument as optional and "if
omitted, the sink wil use the number of physical output port and the source
will use the number of physical input ports registered in the JACK server."
However, although it would correctly omit the channels argument to
module-jack-sink and module-jack-source if its channel argument was omitted,
its argument validation was broken to consider omitting channels an error.
This commit properly validates the channels argument so omitting it is
accepted.
2020-01-02 16:44:15 +00:00
Pali Rohár
de66644776 bluetooth: Print SO_TIMESTAMP warning for SCO source only once 2020-01-02 13:32:45 +02:00
Pali Rohár
3f13af508d bluetooth: Implement reading SO_TIMESTAMP for A2DP source 2020-01-02 13:32:40 +02:00
Tanu Kaskinen
cdcb01889c switch-on-connect: Blacklist HDMI devices by default
As the comment says, switching to HDMI automatically often causes
problems. Commit bae8c16bfa
("switch-on-connect: Do not ignore HDMI sinks") enabled switching to
HDMI earlier. It was known already then that HDMI monitors don't
necessarily have speakers on them, but I accepted the patch on the
basis that module-switch-on-connect acts only if the card profile is
switched to HDMI, so if switching to HDMI is wrong, then already the
profile switch should cause problems. I didn't think of the case where
the default sink is on some other card, in which case switching the
profile on the HDMI card doesn't cause problems by itself.

I don't want to revert bae8c16bfa, because João needs to be able to
configure their systems to automatically switch to HDMI. Instead, this
patch utilizes the new blacklisting feature in module-switch-on-connect
to blacklist HDMI sinks by default. Switching to HDMI can be enabled by
setting the blacklist modarg to an empty string or something that
doesn't match HDMI sinks.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/749
2019-12-27 11:24:36 +02:00
Tanu Kaskinen
4dba56c1af core-util: Handle zero-length volume string
Without checking for zero we end up accessing memory outside the str
buffer: str[len - 1].

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/768
2019-12-27 07:33:52 +02:00
Jaroslav Kysela
cd4a69374c alsa-ucm: allow to set profile priority from UCM value
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-23 11:10:44 +00:00
Jaroslav Kysela
d7dbd0cbe3 alsa-mixer: improve check for the empty path set for sink/source
The unused mixer instances are created without this code.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-23 11:10:44 +00:00
Jaroslav Kysela
8837c90b7f alsa-mixer: do the quick card number lookup to save mixer instances
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-23 11:10:44 +00:00
Jaroslav Kysela
3ceff8bb3f alsa-ucm: add support for HDMI ELD
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-23 11:10:44 +00:00
Jaroslav Kysela
3bd7c70c51 alsa: rewrite mixer open/close, cache mixer accesses in probe
The ALSA mixer can be opened multiple times (especially for UCM
in the probe). This adds a simple mixer cache to prevent
multiple open calls.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-23 11:10:44 +00:00
Laurent Bigonville
6438e5c46d alsa-mixer: Set the intended-role of Steelseries Arctis 5/7 headset as phone
Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/640
2019-12-23 10:33:30 +01:00
Laurent Bigonville
c6a0665618 alsa-mixer: Add the ability to pass the intended-role to the mapping
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/640
2019-12-23 10:31:41 +01:00
ckdo
4854524058 raop: Add autoreconnect feature
This patch adds the autoreconnect feature to the raop module.
This is mainly to be used in a server context, but can be used
also in a desktop usage context.

With autoreconnect feature, the raop module behaves like this:

- At initialisation or in case of the RTSP TCP connection lost, it
  tries to reconnect every 5 seconds
- In case of any fatal error, it tries to reconnect every 5 seconds
- In UDP mode, if no timing packets received anymore for a long time,
  RTSP connection is closed, then it tries to reconnect..
- After reconnection, once RTSP session has been established again,
  playing is resumed automatically.
- When the connection is not established yet (or loss), the sink
  behaves like a null sink. In the source code I called it "autonull",
  even if autonull is set to autoreconnect param value, it could be
  split into two different params.
2019-12-22 09:43:14 +00:00
ckdo
46dd3be8ce raop: Code clarification : Only free the I/O thread when everything is initialized 2019-12-22 09:43:14 +00:00
ckdo
7e6bb05390 raop: Code clarification : Detect raop_client recording state in a proper way 2019-12-22 09:43:14 +00:00
ckdo
3e66643f50 raop: Fix callback call in raop client after auth : only call once everything is freed 2019-12-22 09:43:14 +00:00
ckdo
0c6678146a raop: Fix rewinding handling : process just after request received 2019-12-22 09:43:14 +00:00
Tanu Kaskinen
37babc6d1a stream: clarify the meaning of NULL device
The old wording could be understood so that the default sink/source
would always be used, but sometimes a policy module does a different
decision (for example module-stream-restore).

Related: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/767
2019-12-21 09:58:57 +02:00
Peter Meerwald
d6b69444be macro: Move PA_LIKELY()/PA_UNLIKELY(), PA_CLAMP()/PA_CLAMP_UNLIKELY() to pulse/gccmacro.h
PA_CLAMP_VOLUME() in pulse/volume.h makes use of PA_CLAMP_UNLIKELY()

see https://bugs.freedesktop.org/show_bug.cgi?id=89515

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2019-12-21 08:36:28 +02:00
Tanu Kaskinen
1f5da4c20b gitlab: explain the container image tag better 2019-12-21 05:15:31 +00:00
Arun Raghavan
c48f36fcb3 gitlab: Make container updates automatic 2019-12-21 05:15:31 +00:00
RODRIGUEZ Christophe
6f48bc9508 raop: Allow channel map module argument 2019-12-20 19:49:09 +00:00
ckdo
c922e2c5b2 raop: Fix soft volume not applied on initial volume 2019-12-20 16:17:40 +01:00
Jaroslav Kysela
f18b0c3402 alsa-mixer: handle interface type (CARD,PCM) for mixer element lookups
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-18 08:35:40 +01:00
Jaroslav Kysela
dacfcbb09c alsa-ucm: use the proper mixer name for ucm pcm sink/source
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-18 08:29:11 +01:00
Jaroslav Kysela
e438382a51 alsa-ucm: get the mixer names from ucm, don't guess
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-18 08:29:11 +01:00
Jaroslav Kysela
ddd0fdb997 alsa-ucm: add control and mixer device items
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-18 08:29:11 +01:00
Jaroslav Kysela
d8200ee805 alsa-util: do not try to guess the mixer name from the PCM name
This is just invalid. It results to an error in almost all cases.
The hw:<number> scheme is sufficient to get the right card mixer.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-18 08:29:11 +01:00
Jaroslav Kysela
ef1df94627 alsa-ucm: do not try to use UCM device name as jack name by default
Remove the implicit rule. It is perfectly ok to have the jack with
the same name for another I/O in the driver. Trust only the
value obtained from UCM.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-18 08:29:11 +01:00
Jaroslav Kysela
4c64f73c97 alsa-ucm: parse correctly the device values
The UCM library is used to get the fallback values from the verbs
and the defaults section. There is no reason to duplicate this code
inside application.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-18 08:29:11 +01:00
Hui Wang
f62a49b8cf stream-restore: skip entries set on source from gnome-control-center
When users select an input device from gnome-control-center UI, the
source of this input device will be set to the
configured_default_source and the default_source, 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 source users select, this is not correct since the
source is default_source 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-12-14 18:40:19 +00:00
Hui Wang
5e0d5a8682 source: move the streams to the default_source when the source unlink
When a source is unlinked, all streams of this source are moved to
default_source, this action is implemented in the core rather than
modules now.

And after this change, the module-rescue-streams is not needed, but
for backward compatibility, we keep it as a dummy module.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
2019-12-14 18:40:19 +00:00
Hui Wang
976a366c9f device-port: moving streams since active_port on source changes status
When the active port of a source becomes unavailable, all streams from
that source should be moved to the default source.

When the active port of a source changes state from unavailable, all
streams that have their preferred_source set to this source should be
moved to this source.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
2019-12-14 18:40:19 +00:00
Hui Wang
1cea7ab38d source: move streams to new appeared sources if they prefer these sources
When a new source appears, all streams that have their
preferred_source set to the new source should be moved to the new
source.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
2019-12-14 18:40:19 +00:00
Hui Wang
c254f8405c core: move source-outputs conditionally when update default_source
When the default source changes, the streams from the old default
source should be moved to the new default source, unless the
preferred_source string is set to the old default source and the
active port of the old default source is not unavailable

Signed-off-by: Hui Wang <hui.wang@canonical.com>
2019-12-14 18:40:19 +00:00
Hui Wang
70bbbcdc84 source-output: clear the preferred_source if it is default_source
When the user moves a stream to the current default source, the
preferred_source 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 source.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
2019-12-14 18:40:19 +00:00
Hui Wang
e529db75ec source-output: add a new API pa_source_output_set_preferred_source
If the source here is NULL, that means users want to clear the
preferred_source and move the source-output to the default_source,
otherwise set the preferred_source to the source->name and move the
source-output to the source. After that fire the source_output_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-12-14 18:40:19 +00:00
Hui Wang
5eec504d68 source-output: change bool save_source to char *preferred_source
The finial objective is to store the preferred source name in the
source-output struct, and use module-stream-restore to save and
restore it.

This patch just replaces the save_source with preferred_source, and
tries to keep the original logic.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
2019-12-14 18:40:19 +00:00
Kai-Heng Feng
734a00c849 alsa: Skip resume PCM if hardware doesn't support it
Hardwares without SNDRV_PCM_INFO_RESUME capability, like USB Audio,
don't support snd_pcm_resume() when it's in suspended state.

Let's use snd_pcm_hw_params_can_resume() to check hardware's capability
before snd_pcm_resume() attempt. If it doesn't support resume, just go
to snd_pcm_drop() to leave suspended state directly.
2019-12-10 16:16:18 +08:00
Alexander Patrakov
464828faf2 Split the enable-lfe-remixing setting into two
remixing-produce-lfe controls upmixing, and remixing-consume-lfe
controls downmixing. The motivation is that a user might want to
synthesize LFE while playing stereo audio on his/her 5.1 speakers,
but at the same time follow the industry recommendation to omit
the LFE channel when producting a stereo downmix (e.g. for headphones)
from 5.1 content. Or the other way round.

Fixes: #753.
2019-12-10 06:50:59 +00:00
Marc Ranolfi
b94dba9daf card-restore: prevent segfault caused by 'restore_bluetooth_profile=true'
This fixes an oversight introduced in 1f45082c which ultimately causes a segfault error in 'add_key_value()' from 'modargs.c'.

Closes #773.
2019-12-08 01:24:13 -03:00
Jaroslav Kysela
e6779ad229 alsa-ucm: validate access to PA_DEVICE_PORT_DATA()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-06 10:05:44 +00:00
Jaroslav Kysela
f5c02dfcd8 alsa-ucm: add comments to ucm_get_mixer_id()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-06 10:05:44 +00:00
Jaroslav Kysela
e04f14ebf3 alsa-ucm: fix parsing for JackControl
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-06 10:05:44 +00:00
Jaroslav Kysela
156bd77424 alsa-ucm: split correctly JackHWMute device names
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-06 10:05:44 +00:00
Jaroslav Kysela
6d830bf0f0 alsa-ucm: add support for master volume
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-06 10:05:44 +00:00
Jaroslav Kysela
dc9dc70fcc alsa-ucm: use the correct mixer identifiers as first
The mixer identifiers should be used for snd_mixer_selem API.
Use them as first, then try to fallback to the raw control
identifiers.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-06 10:05:44 +00:00