Commit graph

10719 commits

Author SHA1 Message Date
Wim Taymans
a77b12a024 client-node: clean up useless node object 2023-05-04 21:46:07 +02:00
Wim Taymans
ffa21d696d module-pulse-tunnel: avoid using NULL module
Set the module to NULL when unloading. Check if the module exists before
attempting to unload it.

Flush any pending invokes on the mainloop before destroying the impl.

Fixes #3199
2023-05-04 20:28:10 +02:00
Wim Taymans
75d7c574cf impl-node: don't do output mix for remote nodes
Remote nodes already did the output mix remotely so we don't have to
attempt it on the server (and it doesn't actually have output mixers).
2023-05-04 20:26:17 +02:00
Wim Taymans
f756eebac5 impl-node: add some SPA_LIKELY 2023-05-04 20:25:50 +02:00
Wim Taymans
7f53571e0c impl-node: avoid division by zero better
Since the activation is in shared memory, a bad client could try to
modify them after we check the signal_time and prev_signal time and
cause a division by zero. Make a unique copy of the values and use
those.
2023-05-04 19:47:46 +02:00
Wim Taymans
2be49838d0 pulse-server: remove some warnings 2023-05-04 19:11:21 +02:00
Wim Taymans
b13e9f7a8d pipewire-pulse: add module-jackdbus-detect 2023-05-04 18:46:36 +02:00
Wim Taymans
37210794d8 pulse-server: rework audioinfo argument parsing
Make a new method to parse parts of the audioinfo based on custom
keys, leaving unparsed values to defaults. Implement the generic audio
parsing with this.

We can then remove some duplicate code where the audio keys didn't match
or where only parts of the info needed to be parsed.

Also make a method to serialize the audioinfo to properties and use that
when making arguments to load the modules.

Avoid doing some custom property serialization, move all key/values into
properties and serialize those with the generic functions.
2023-05-04 18:43:08 +02:00
Wim Taymans
11c478d0fa improve debug of commands and events
Add the type name in the log.
2023-05-04 13:03:40 +02:00
Wim Taymans
0b3a06192e module-jack: add jack.connect option 2023-05-04 11:55:01 +02:00
Wim Taymans
43b6054631 module-jack: add jack.client-name option 2023-05-04 11:44:55 +02:00
Wim Taymans
7ac8e29160 module-jack: handle non-duplex case 2023-05-04 11:41:17 +02:00
Wim Taymans
7a82fc7fc7 module-jack: fix compilation without fastpath 2023-05-04 09:29:51 +02:00
Pauli Virtanen
55fc2ac7ef stream: ignore latency of monitor stream ports
Have monitor streams not affect the latency calculation of the ports
they are connected to.

Connecting monitor streams to ports (e.g. volume level monitoring)
should not affect latency values of other streams connected to those
ports.

This fixes e.g. just running pavucontrol from modifying latencies of all
existing ports.
2023-05-03 18:01:00 +00:00
Pauli Virtanen
6e17962ad0 impl-port/audioconvert: add PORT_IGNORE_LATENCY
Add port.ignore-latency prop, which if true causes peer ports to ignore
the latency of the given port.

This is useful for ports that are not intended to affect latency
calculations of other ports, such as ports in monitor streams.
2023-05-03 18:01:00 +00:00
Pauli Virtanen
85d2933268 module-access: add missing include
Ensure PATH_MAX gets defined also if no glib2.
2023-05-03 18:00:03 +00:00
Wim Taymans
1d872c5cde impl-node: restore previous signal_time
So that we can save if below and do the stats correctly.
2023-05-03 19:03:16 +02:00
Wim Taymans
107061bb77 module-jack: implement with pw-filter
It is faster and allows us to add midi easily as well.
2023-05-03 18:37:43 +02:00
Wim Taymans
09994f7141 filter: add more possible params
Support Format and EnumFormat node params to make it possible to
implement a sink.
2023-05-03 18:33:46 +02:00
Wim Taymans
ff6a86644b client-node: take data_loop and system from node 2023-05-03 18:18:12 +02:00
Barnabás Pőcze
2dd3a00bb5 spa: bluez: modemmanager: fix DBusMessage leaks
A DBusMessage needs to be unref-ed after sending it regardless
whether or not it was successfully sent. So do that in
`mm_dbus_connection_send_with_reply()` so that the callers
do not need to deal with that.
2023-05-03 11:27:25 +00:00
Barnabás Pőcze
4591cfcd37 spa: bluez: modemmanager: do not log message sender as warning 2023-05-03 11:27:25 +00:00
Barnabás Pőcze
54b0886c78 spa: bluez: backend-native: use correct pointer
The yolo pointer strikes again. Pass the correc pointer to `mm_unregister()`.
2023-05-03 11:27:25 +00:00
Barnabás Pőcze
ff62eb59e2 spa: bluez: modemmanager: remove unused member 2023-05-03 11:27:25 +00:00
Barnabás Pőcze
06030ddf76 spa: bluez: backend-hsphfpd: fix dbus type
Use `DBUS_TYPE_STRING` for a string and not `DBUS_TYPE_BOOLEAN`.
2023-05-03 11:27:25 +00:00
Barnabás Pőcze
abe9615fec spa: bluez: backend-hsphfpd: use dbus_bool_t for DBUS_TYPE_BOOLEAN 2023-05-03 11:27:25 +00:00
Barnabás Pőcze
36bfd5263f spa: bluez: do not check if service is running
It is inherently racy, and we have a better way to ensure that
we won't autostart the service:

  dbus_message_set_auto_start()

So use that.

This commit also adds a missing call to `dbus_pending_call_unref()`
and indirectly fixes a type mismatch (`dbus_bool_t` vs. `bool`)
that was present in `is_dbus_service_running()`.
2023-05-03 11:27:25 +00:00
Barnabás Pőcze
4d5f3620af spa: bluez: initalize DBusError object
The DBusError passed to `dbus_set_error_from_message()` must
be initialized, otherwise libdbus aborts:

  dbus[129473]: arguments to dbus_set_error_from_message() were incorrect,
                assertion "(error) == NULL || !dbus_error_is_set ((error))"
                failed in file dbus-message.c line 4043.
  This is normally a bug in some application using the D-Bus library.
2023-05-03 11:27:25 +00:00
Pauli Virtanen
10352dbaa5 pulse-server: combine-sink: add latency_compensate option
Add option to turn on latency compensation in module-combine-stream.
2023-05-03 11:22:01 +00:00
Pauli Virtanen
cc5da73665 module-combine-stream: add option to add delays for latency compensation
Add combine.latency-compensate option, which uses delay buffers to
compensate for different latencies in the target streams.
2023-05-03 11:22:01 +00:00
Wim Taymans
e24d7cc8b7 module-jack: don't crash when NULL source/sink
It is possible that we destroyed the source/sink when we get a latency
update from jack, don't try to update the source/sink in that case or
we will crash.
2023-05-03 13:04:58 +02:00
Wim Taymans
caeaaf9c24 impl-node: work around old clients
Old clients (screencast) set the TRIGGERED state before signaling
node_ready, which causes errors in pw-top. Patch this up here.
2023-05-03 12:51:34 +02:00
Wim Taymans
ea1385ffe0 jack-tunnel: use cycle_wait/cycle_signal
Use cycle_wait and cycle_signal so that we can avoid using a semaphore
and resume the jack graph right after we finish the pipewire graph.
2023-05-03 11:51:13 +02:00
Wim Taymans
bcbb6e42e7 remote-node: don't send signal/awake time in ready
Let the server calculate signal time when it starts the graph. Otherwise
we overwrite old values and we can't do stats.

We might be able to piggyback the signal time in the prev_signal_time
field later.
2023-05-03 11:06:14 +02:00
Wim Taymans
604d60650a impl-node: call implementor of node on xrun
Signal the eventfd of the node directly to run the driver node for a
last time after an xrun
2023-05-03 10:48:29 +02:00
Wim Taymans
7edcfad7db impl-node: process_node now always run on the implementer
process_node is now always called on the process that implements the
process function and so we can always fill in the finish_time.
2023-05-03 10:42:28 +02:00
Christian Glombek
b6b8035b0d module-raop-sink: Add default PW_KEY_DEVICE_ICON_NAME prop
Default icon prop to "audio-speakers"
2023-05-02 17:08:09 +00:00
Wim Taymans
f8663ab31c client-node: activate using the node eventfd
Don't make an extra eventfd for activating the remote-node, we can
use the server side eventfd and send them to the remote side using
the transport.

The remote node already adds the eventfd to the data-loop so avoids
doing the same on the server.

This makes driver nodes trigger all remote nodes directly instead of
going through an intermediate eventfd. For resuming nodes, we already
used the node eventfd directly so this only a small optimization
for the initial cycle start.
2023-05-02 18:47:10 +02:00
Wim Taymans
8f799af6df impl-node: use the added boolean to add/remove source
There is no reason to use the loop of the source.
2023-05-02 18:47:10 +02:00
Pauli Virtanen
7d4491ce6b module-combine-stream: add latencyOffsetNsec prop
Add latencyOffsetNsec prop to the combine node.

This is mainly useful for BAP device sets; the property appears in
Pulseaudio UI only when the node is associated with a device.
2023-05-02 13:43:56 +00:00
Wim Taymans
be59d2b5d0 jack: don't emit callbacks from do_wait()
Some functions need to wait for the reply of the server before they can
complete but the JACK API does not allow us to emit notifications while
blocking a function.

Delay emiting notifications when we are in selected methods and send a
notify to an eventfd to call the queued notifications.

Fixes #3183
2023-05-02 14:41:46 +02:00
Wim Taymans
bcec0ad103 impl-node: implement pw_impl_node_trigger
The trigger operation decrements the activation count on a node and
signals the eventfd when 0.

Implement pw_stream_trigger_process() with this new function.
Make the 3 types of trigger operations on a stream more explicit.

trigger:       -> do node_trigger()
driver/driving -> start graph with ready callback
other:         -> emit request trigger event.
2023-05-02 14:32:21 +02:00
Wim Taymans
953876bd58 impl-node: always wake up nodes with the eventfd
Don't call into the node process directly but use the eventfd to wake up
the node.

This is slightly slower and causes some change in behaviour
because we now need to go back to the poll loop and then let the node be
scheduled.

It is however nicer to have a uniform way to wake up nodes and it
opens up some new possibilities such as scheduling nodes in their own
threads on the server.
2023-05-02 14:14:45 +02:00
Wim Taymans
6bbe64a64b node: small cleanups and debug improvements 2023-05-02 14:11:37 +02:00
Wim Taymans
dd36352a5c stream: move from dequeued to queued for capture stream flush
When flushing a capture stream we move all dequeued buffers to the
queued queue for recycling. The dequeued queue is filled again when
captured buffers become available. Otherwise we might never recycle
some dequeued buffers.
2023-05-02 13:41:00 +02:00
Wim Taymans
b1a80a8f46 impl-node: call process_node directly
Don't go through the signal_func when we need to complete the graph
or when we need to process the node, do directly to process_node.

The signal_func is really only for nodes activating peers.
2023-05-01 13:42:50 +02:00
Wim Taymans
adb7559359 impl-node: fix timing for client-nodes using trigger
For client-nodes that use trigger, set the signal and wakeup time when
they start the server node. Also set finish time before we resume the
peers on the server.

Client-nodes should really resume the peers directly without going
through the server but this is something to improve later.
2023-05-01 13:37:44 +02:00
Wim Taymans
c23c27b566 module-raop: fix warning on uninitialised res variable 2023-05-01 09:59:55 +02:00
Christian Glombek
0bb0b524c7 raop: Deduplicate sink creation
Currently, RAOP sinks referencing the same remote ip and port may be created multiple times:
One each for IPv4 and IPv6, times the number of network interfaces used for mDNS discovery.

A recent change added `(IPv4)`and `(IPv6)`identifiers to the sinks' pretty names, however that
is misleading, as often times the service advertised through an mDNSv6 record is actually an
IPv4 service (i.e. the IP reference contained in the IPv6 record may be an IPv4 address).

With this change, sink creation is skipped if a sink with the same advertised name already exists.
2023-05-01 07:48:19 +00:00
Pauli Virtanen
0e831c52d8 module-access: determine trusted application executable
Determine application executable file so that the result can be trusted,
and the file exists in the current namespace.

Don't use /proc/pid/cmdline, since that contains whatever was specified
by the exec() call.
2023-05-01 07:44:08 +00:00