Commit graph

368 commits

Author SHA1 Message Date
Sanchayan Maity
d8f98df6ed pulse-server: Implement module-pipe-sink 2021-05-11 13:31:41 +05:30
Wim Taymans
c50c8d2be9 modules: fix some leaks in error paths
As found by coverity
2021-05-11 09:55:14 +02:00
Wim Taymans
2414d3501c pulse-server: add ladspa sink and source
To make an rnnoise filtered source:

pactl load-module module-ladspa-source source_name=rnnoise_mic label=noise_suppressor_mono plugin=/usr/lib64/ladspa/ladspa/librnnoise_ladspa.so

To make an equalizer sink:

pactl load-module module-ladspa-sink sink_name=eq_out label=mbeq plugin=/usr/lib64/ladspa/mbeq_1197.so
2021-05-10 11:01:13 +02:00
Peter Hutterer
2405f0942b spa/buffer: rename SPA_MEMBER to SPA_PTROFF
SPA_MEMBER is misleading, all we're doing here is pointer+offset and a
type-casting the result. Rename to SPA_PTROFF which is more expressive (and
has the same number of characters so we don't need to re-indent).
2021-05-06 09:39:39 +00:00
Andrea Gelmini
47ef2b6b09 Fix typos 2021-04-30 07:40:20 +00:00
Wim Taymans
620c863b6d pulse-server: track and set monitor volume on monitor sources 2021-04-29 15:25:04 +02:00
Pauli Virtanen
20c8d7b29e pulse-server: keep track of seq in pw_*_enum_params
If multiple async enum param are running at the same time, take results
only from the latest one.
2021-04-25 20:56:57 +03:00
Wim Taymans
53cd601869 pulse-server: apply node.name to all streams
Pass properties as global properties so that they are applied
to both streams. Make sure node.name is set on both streams so that
they look good in tools like carla.
2021-04-25 10:37:51 +02:00
Wim Taymans
5d104994c0 pulse-server: mark remap source and sink passive
Make sure the links to the real source/sink are passive links so that
the virtual sink is suspended with the real sink when unused.
2021-04-24 19:46:06 +02:00
Wim Taymans
ab7bc6ed27 pulse-server: add remap sink and source modules 2021-04-22 20:44:55 +02:00
Wim Taymans
74430871fb pulse-server: implement the loopback module with module-loopback 2021-04-22 17:26:04 +02:00
Wim Taymans
8294a4f42c Add vm.overrides property in pipewire and pulse-server
Apply vm.override properties when running in a VM. Increase the
default quantum to 1024 when running in a VM to cause less
dropouts.
2021-04-21 15:58:30 +02:00
Wim Taymans
fbd6a62b73 pulse-server: cancel items from work-queue
Make sure we cancel any pending work-queue items for the object before
we destroy the object.
2021-04-21 13:23:13 +02:00
Wim Taymans
639e6ea644 pulse-server: use the work-queue to unload modules
This avoids allocating an eventfd for each module.
2021-04-21 13:17:28 +02:00
Wim Taymans
fee8bf69dd pulse-server: make method to schedule module unload 2021-04-21 13:11:16 +02:00
Wim Taymans
c70a5de526 pulse-server: use a work-queue to schedule destroy
Use the context work queue to schedule destroys from callbacks.
This is better because we can pass the destroyed object around and
implement just the action we need to do on it.
2021-04-21 12:55:49 +02:00
Wim Taymans
7031471807 pulse-server: add property to make virtual nodes
Make a property to mark virtual nodes and use it to hide the client
id from the sink-input/source-output info in pulse-server.
2021-04-20 21:05:59 +02:00
Wim Taymans
648c9b432c pulse-server: set monitor.channel-volumes=true by default
Make a null-sink with monitor.channel-volumes=true by default if not
defined otherwise. This ensures the volume of the null-sink is
always transfered to the monitor ports.

Also only set the object.linger flag when undefined.
2021-04-20 09:36:14 +02:00
Wim Taymans
575163e644 pulse-server: use args_to_audioinfo to parse channels 2021-04-19 16:49:25 +02:00
Wim Taymans
649d21ac02 pipewire-pulse: improve channels and channel_map parsing
If we have channels and channelmap, make sure they match.
If we have only channel_map, use this to derive channels instead of
taking the default number of channels and then ending up with a
mismatch.
If we have only channels, use this to generate a channelmap from
predefined maps or just unknown channels instead of taking the default
channel map.
If neither channels or channelmap is defined, use the defaults.
2021-04-19 16:41:14 +02:00
Arun Raghavan
74140abada pulse-server: Factor out module code to compile independently
This starts breaking up the giant monolith that is the pulse-server.c
code into more manageable chunks by trying to split the module code into
individual compilation units.
2021-04-15 19:37:15 -04:00
Arun Raghavan
abf193452c pulse-server: Factor out sample spec/channel parsing from modargs
This should be more broadly useful for other modules.
2021-04-15 15:55:51 -04:00
Wim Taymans
60b405fdfd pulse-server: only send 32 channels max to a client
Limit the amount of channels we send to a client to 32 because this
is the pulseaudio limit.

This means that only the first 32 channels are accessible from the
pulseaudio API.

Fixes #1033
2021-04-14 15:29:46 +02:00
Wim Taymans
8bf7ce5fa4 pulse-server: fix channels property
Setting the channel property should create as many channels as
requested, not just the number from the default channel map.

If no channel_map is set, use the default one if the channels match
or use one with unknown channel layout otherwise.

Check the configured channels against the channel map and error
if there is a mismatch.
2021-04-14 15:29:46 +02:00
Wim Taymans
22ffed456c pulse-server: improve event handling
Do the check for the client event mask in only one place where we
are actually going to send the event. This avoids sending events to
clients that did not register them.

Rework some of the event handling when the manager emit an
add/remove/change event. Make it possible to send multiple events, like
when a sink changes, also emit a change for the monitor.

See #1042
2021-04-12 17:19:15 +02:00
Wim Taymans
af6e212817 pulse-server: add simple protocol module
Fixes #954
2021-04-12 16:17:06 +02:00
Wim Taymans
d8f86ca6e5 pulse-server: make name in create_server const
constify the name in create_server() and make a copy of the name
were it is needed instead of modifying the argument in-place.
2021-04-10 11:22:41 +02:00
Wim Taymans
47bf30d734 pulse-server: create pid file only once
Only try to create the pid file once, not for every socket
we listen to.
2021-04-10 11:06:18 +02:00
Wim Taymans
225c9ebc2d pulse-server: limit the aux channels to 32
PulseAudio does not have more than 32 AUX channels so when we generate
them from unknown positions, make sure we wrap around.

See #1033
2021-04-09 19:20:46 +02:00
Wim Taymans
33ddd5f760 pulse-server: implement module-native-protocol-tcp
The module creates a tcp server on the given ip/port pair.
2021-04-09 18:27:30 +02:00
Wim Taymans
5d20f50df8 pulse-server: use the right config property 2021-04-09 11:45:06 +02:00
Wim Taymans
44e6e7f5c8 pulse-server: use PipeWire format and channel names
Use the PipeWire format and channel names in the config to avoid
confusion.
2021-04-09 11:30:57 +02:00
Wim Taymans
b305f57e4d pulse-server: make sample format and channel_map configurable
Add an entry in the config file for default format and channel map.
Use the defaults in the server_info request
Use the defaults for the default channels and map in the modules.
2021-04-09 11:12:13 +02:00
Wim Taymans
877309bfbe use priority.session to select the default sink/source
priority.session is meant to be used to set routing priorities.

priority.driver is meant to be used by the scheduler to select what
nodes is best for driving the graph. This usually depends on the
hardware quality and the use case (Pro Audio devices are likely
to be used as driving the graph).

See #1028
2021-04-08 17:48:13 +02:00
Wim Taymans
2e18d8d005 module-loopback: fix connecting to the .monitor source
When a pulseaudio clients asks to be connected to a monitor of a sink
we need to specify the sink to the session manager as the target.

Fixes #1024
2021-04-08 16:02:28 +02:00
Wim Taymans
09243d55ae pulse-server: fix leak in flatpak detection 2021-04-06 11:26:02 +02:00
Wim Taymans
bdbd3e3f2e pulse-server: Make sure we don't send null name and description
We can't send a null name or description because that makes clients
crash.
2021-04-05 17:36:38 +02:00
Wim Taymans
7bd6b725dc Fix some warnings
When memfd and systemd are disabled.

See #987
2021-04-04 21:09:39 +02:00
Wim Taymans
8cf6da467f pulse-server: use the name of the default sink
When setting a new default sink/source, use the name of the object
instead of the name used for selecting the sink/source. This makes
it possible to use the id to search for the device but still have
the device name in the metadata as is expected.

Fixes #1004
2021-04-02 10:07:39 +02:00
Wim Taymans
90de408e31 loopback: use _raw_build helpers
Now that the raw_builder supports wildcard for rate, use it in loopback
and add an option to force resampling as well.
2021-04-01 10:47:23 +02:00
Wim Taymans
7afb3bc1a4 pulse-server: add module properties 2021-04-01 09:35:31 +02:00
Wim Taymans
27e00d1be4 pulse-server: don't fix sample rate
Use the builder directly to leave the samplerate undefined so that we
adapt to the graph samplerate instead of forcing resampling.
2021-04-01 09:32:00 +02:00
Wim Taymans
4aa817771a pulse-server: arguments can be NULL
And module-null-sink does not have mandatory arguments.
2021-04-01 09:04:55 +02:00
Wim Taymans
cc7cbaa83b pulse-server: module-loopback fixes
source and sink need not be set and need to be mapped to the target
source/sink to connect to.
node.group needs to be a unique id shared by source/sink to make them
part of the same scheduling group and do clock sync.
Remove some unused properties
2021-04-01 08:24:51 +02:00
Wim Taymans
8383e86f33 pulse-server: module arguments can be NULL 2021-04-01 08:24:22 +02:00
Arun Raghavan
e7b04bca2c pulse-server: Implement module-loopback
Implements all modargs other than rate adjustment and max latency
related ones, which do not make sense in our context.

Fixes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/543
2021-03-31 18:19:36 -04:00
Pauli Virtanen
7b9792ffab pulse-server: fix brace in wrong place 2021-03-31 11:13:07 +00:00
Wim Taymans
dd6a18d576 pulse-server: handle 0 id as default sink/source as well
Also handle 0 id as the default sink/source

See #756
2021-03-30 10:15:36 +02:00
Wim Taymans
3878ad921a pulse-server: handle 0 sink/source name or index as default
Some apps use 0 to get some sort of sink/source info. PulseAudio
likely has a source/sink at index 0 but PipeWire certainly does not.

Asking for 0 source/sink is always because of some hardcoded values
in the app and we can return the default source/sink without causing
any problems for other apps.

See #756
2021-03-29 13:50:37 +02:00
Pauli Virtanen
eb7df98cd6 pulse-server: minor fix 2021-03-27 21:53:49 +02:00