Commit graph

1030 commits

Author SHA1 Message Date
Barnabás Pőcze
37b2633756 pulse-server: reorder initialization to make proper cleanup possible
Previously, in case of errors, the struct members were not disposed of
correctly, leading to memory leaks. Reordering the initialization slightly
makes it possible to call `impl_free()`.

See https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1840#note_2106874
2023-09-29 18:19:13 +02:00
Wim Taymans
224f1f16f1 pulse-server: emit stream changed after Latency param change
Piggy back on the Latency param change to emit a stream changed event
because we now might have a link between the stream and a device.

We should really watch for new links and emit change events for the
streams that it links to.

Fixes #3522
2023-09-21 16:42:08 +02:00
Wim Taymans
846e732458 pulse-server: remove pending_streams list
We can simply use the pending flag and merge the handling of the new
stream with the stream move logic.
2023-09-14 12:08:48 +02:00
Wim Taymans
13caae49b5 pulse-server: avoid emitting changes for unused params
Don't emit change events when latency or tag change, for example.
2023-09-14 11:03:39 +02:00
Wim Taymans
3c812f672b pulse-server: add an option to check module arguments
Add a list of valid keys to the module info. When set, check if the
module arguments only contain the allowed keys and give an error
otherwise.
2023-09-13 12:26:57 +02:00
Wim Taymans
016d15e598 ratelimit: missed -> suppressed
To avoid confusing with missed samples.
2023-09-08 12:18:23 +02:00
Wim Taymans
9f30e58ef2 pipe-tunnel: support pipe-source as a driver
Use a timer to periodically schedule the pipe-source when configured
as a driver. Adjust the timeout period based on buffer fill levels.

Fixes #3478
2023-08-31 11:41:00 +02:00
Wim Taymans
9f66c42d1f pipe-tunnel: rework the source
Let the source write into a ringbuffer when there is data available.

We then read from the ringbuffer when scheduled and use a dll to keep
the delay constant. We can later make this a driver and use the rate
correction to tweak the timeouts instead of resampling.

See #3478
2023-08-30 18:41:19 +02:00
Wim Taymans
bc15d0c766 pulse-server: support use_system_clock_for_timing
Move the pipe-sink to the dummy driver when instructed to use the system
clock.
2023-08-30 18:36:01 +02:00
Wim Taymans
20fdafb7f1 pulse-server: rename a variable to avoid confusion 2023-08-30 18:32:34 +02:00
Wim Taymans
89fab13c77 pulse-server: allow monitors when selecting source by index
Fixes #3476
2023-08-30 09:59:37 +02:00
Wim Taymans
dbf1ea0e78 pulse-server: add alsa source and sink module
See #3456
2023-08-23 11:15:59 +02:00
Wim Taymans
820ca90705 pulse-server: set all change_mask flags when removing
So that the logic to emit events will select sink and source objects.

Fixes #3414
2023-08-08 13:01:30 +02:00
Wim Taymans
c9b7367f8f pulse-server: keep track of sink/monitor changes
For sink nodes, keep a separate device_info around for the sink and
the monitor source part of the node. Only emit changes for the sink
and monitor source part when it changed.

See #3388
2023-07-31 11:23:47 +02:00
Wim Taymans
3a8894d2a4 pulse-server: improve device lookup
Make sure don't handle names ending in .monitor as a valid sink (because
it's a monitor on the sink).

Make sure we don't return a sink (monitor) as a source accidentally but
only when explicitly requested by name with the .monitor extension.

Makes

pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo.monitor -5%
pactl set-source-volume alsa_output.pci-0000_00_1b.0.analog-stereo -5%

fail as expected.
2023-07-28 18:26:41 +02:00
Wim Taymans
3f77c4e25f pulse-server: move the changed counter internally
We don't actually use this counter anywhere.

Change the counter to a mask that will contain object specific changes
to the params. This should make it possible to track what kind of
changes where done to the object and make it easier to emit the right
events later.
2023-07-28 13:31:02 +02:00
Wim Taymans
39a1887a0b pulse-server: improve network and virtual node checks
Tag the sink/source as HARDWARE when it's not virtual, the presence
of a DEVICE_API property is not a good check.

Make a method to check if a node is a NETWORK sink/source to make it
use the same logic everywhere.
2023-07-26 11:51:48 +02:00
Wim Taymans
ad71dd89a2 protocol-pulse: remove private.h include
See #3243
2023-07-11 19:37:49 +02:00
Wim Taymans
dc07c2321b spa: add spa_ratelimit 2023-07-11 19:25:35 +02:00
Barnabás Pőcze
7d6fc0f544 pulse-server: fix remove proplist command
`command` is never equal to `COMMAND_UPDATE_CLIENT_PROPLIST`,
instead, the check should be against `COMMAND_REMOVE_CLIENT_PROPLIST`.
2023-07-11 16:04:53 +02:00
Barnabás Pőcze
fe45786a5d treewide: add some examples for the spa_auto* macros 2023-07-11 14:23:53 +02:00
Wim Taymans
895e516a75 pulse-server: support latency_msec in module-raop-discover
See #3247
2023-07-04 14:09:15 +02:00
Barnabás Pőcze
0f70256230 pulse-server: include "reply.h" in "reply.h"
So that definitions are checked against declarations.
2023-07-03 19:40:31 +02:00
Barnabás Pőcze
3b4a255dec pulse-server: format_info_from_spec(): remove redundant decl 2023-07-03 19:40:31 +02:00
Wim Taymans
c34a987076 pulse-server: add option to disable fix_ flags
Document the pulse.fix properties.
Add an option to disable handling of the FIX flags when the pulse.fix.
property is set to an invalid value/0.

See #3317
2023-07-03 16:39:32 +02:00
Wim Taymans
f612ffe8e4 pulse-server: use the fixed rate for graph rate
We need to use the format rate for calculating the buffer size and
latency but the fixated rate for the graph rate.

See #3317
2023-06-30 12:34:25 +02:00
Wim Taymans
91ac3acf3d pulse-server: debug the fixed format/rate/channel 2023-06-30 12:34:25 +02:00
Barnabás Pőcze
2abd3432b8 pulse-server: module-combine-sink: remove redundant member
`module_combine_sink_data::info` member has not been used
since 782e0dfb1f, so remove it.
2023-06-29 23:57:48 +02:00
Wim Taymans
f9efc63a04 pulse-server: make sure we have a card_name
Clients crash if the card name is NULL so make sure we generate
a backup name.
2023-06-28 16:18:44 +02:00
Wim Taymans
0156d63109 audioconvert: don't negottiate rate when resample is disabled
This will leave the negotiated rate 0 when parsed and instructs the
stream to follow the graph rate.
2023-06-26 11:23:29 +02:00
Wim Taymans
b464d2145d pulse-server: don't override initial volume/mute
When we are asked to apply the initial volume/mute, don't overwrite it
with the default volume.

Fixes #3306
2023-06-23 09:51:09 +02:00
Wim Taymans
989c61e8a1 pulse-server: add virtual-sink and virtual-source
Although those are example elements, they actually work and we can
implement them as well.
2023-06-16 12:18:36 +02:00
Wim Taymans
a0a32af386 pulse-server: add 2 quirks to block sink/source updates
See #1517
2023-06-15 11:45:43 +02:00
Wim Taymans
8eb6c0ec33 pulse-server: handle special device names in play/record
@DEFAULT_MONITOR@ finds the default sink but returns is_monitor true.

Always lookup the device based on the name and index. This transform
the special device names like @DEFAULT_XXX@ to the default device.

Always use the found device name as the target. Make sure to set the
CAPTURE_SINK property when dealing with a monitor.

Fixes #3284
2023-06-11 18:37:24 +02:00
Wim Taymans
004d3d900a pulse-server: improve debug 2023-05-24 18:01:19 +02:00
Pauli Virtanen
38860630a5 pulse-server: module-gsettings: check schemas exist before starting
Check the required GSettings schemas exist before trying to use them, as
g_settings_new aborts if they are missing.  Instead, make it just log
errors.
2023-05-21 10:18:56 +00:00
Wim Taymans
782d5af050 pulse-server: add server.dbus-name option
Add an option to set the name for the dbus service. Setting an
empty name will skip dbus registration.

See #2987
2023-05-17 12:16:16 +02:00
Wim Taymans
7b0c019a2b pulse-server: include rate/format for tunnel 2023-05-12 10:11:17 +02:00
Wim Taymans
7eeb9a63f8 pulse-server: remove / when no target object 2023-05-12 10:11:01 +02:00
Wim Taymans
150e7031ae pulse-server: improve channel formatting 2023-05-12 10:09:42 +02:00
Barnabás Pőcze
2ba9881b4d pulse-server: pending-sample: handle client disconnection correctly
Previously, a client disconnecting while a sample was playing could
lead to issues. For example, if a client disconnected before the
"ready" signal of the sample-play arrives, `operation_new_cb()`
would be called and that would try to use the client's pw_manager,
however, that has previously been destroyed in `client_disconnect()`.

If the client disconnected after the "ready" signal but before the reply
has been sent, then `sample_play_ready_reply()` would never be called
since operations are completed via the client's pw_manager which
would already be destroyed at that point.

Fix this by installing a listener on the client, and properly
cancelling the operation and making sure that the pending_sample
is correctly destroyed.
2023-05-10 18:57:20 +00:00
Barnabás Pőcze
bd510bf602 pulse-server: pending-sample: add on_ prefix to event handlers 2023-05-10 18:57:20 +00:00
Barnabás Pőcze
0395424461 pulse-server: add operation_free_by_tag() 2023-05-10 18:57:20 +00:00
Barnabás Pőcze
dd5f0e6bea pulse-server: pending-sample: only start operation if not replied already 2023-05-10 18:57:20 +00:00
Barnabás Pőcze
c25b6c973e pulse-server: pending-sample: factor out freeing logic 2023-05-10 18:57:20 +00:00
Barnabás Pőcze
cc702dac69 pulse-server: pending-sample: only send reply once 2023-05-10 18:57:20 +00:00
Barnabás Pőcze
edad053911 pulse-server: pending-sample: set replied flag on error
Set the `pending_sample::replied` flag when an error reply
is sent to the client.
2023-05-10 18:57:20 +00:00
Barnabás Pőcze
dd7c47bb3d pulse-server: pending-sample: rename ready to replied
Rename `pending_sample::ready` to `pending_sample::replied` because
it is set when a reply is sent, not when the ready signal comes.
2023-05-10 18:57:20 +00:00
Barnabás Pőcze
e37da42632 pulse-server: move sample playing into pending-sample.c 2023-05-10 18:57:20 +00:00
Wim Taymans
7da4eb13f7 pulse-server: add some module docs 2023-05-05 15:41:44 +02:00