Commit graph

11212 commits

Author SHA1 Message Date
Barnabás Pőcze
b52d590936 spa: bluez: add send_with_reply() dbus helper
This function sends a DBusMessage on a DBusConnection
and sets the reply callback of the resulting DBusPendingCall,
as well as properly cancelling the pending call if anything fails.
2023-07-30 13:45:49 +02:00
Barnabás Pőcze
6e581deb91 spa: bluez: use spa_autoptr for DBusMessage 2023-07-30 13:45:49 +02:00
Sourav Das
c6c3259a08 spa: fixes for dereferencing pointer to incomplete type in __typeof__
before gcc 10 its not supporting pointer dereferencing in __typeof__.
    so made changes according to that. Fixes #3375

    clang also defines __GNUC__ and resolves '4' along with __clang__ which
    resolves '1'. On any version of clang, __GNUC__ and resolves '4'.
    anyway clang has this feature since version 3.
2023-07-30 10:31:19 +05:30
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
6e70fe459d pipewire: allow setting metadata on more objects
The wireplumber unit test sets metadata on object 15, which happens to
be a module.

Allow metadata on other objects for now. It would be nice to disallow
this in the future, though.
2023-07-28 11:18:12 +02:00
Wim Taymans
390f6c9cb8 perm: add a new L permissions
When a client has the L permission on the node, it can make links
between the node even if the owner of the node can't see the other node.
2023-07-28 11:01:43 +02:00
Wim Taymans
94385068cb pipewire: document permissions needed for methods 2023-07-28 10:51:20 +02:00
Wim Taymans
83efdf2340 core: X permissions is needed to destroy a global 2023-07-28 10:22:28 +02:00
Wim Taymans
212fe59530 perm: add permission mask to global
Add a mask of possible permissions for a global.
Make sure the permissions of an object are limited to the global
mask.
2023-07-28 10:22:12 +02:00
Wim Taymans
9bcc90fdc3 0.3.76 2023-07-27 17:54:12 +02:00
Wim Taymans
aca8bced9e man: improve pw-cat man page formats
See #3389
2023-07-27 14:41:29 +02:00
Wim Taymans
0ab6452b7e pw-cat: exit when we are unconnected
We get unconnected when the session manager kills us when it can't
make a link.

See #2731
2023-07-26 16:03:40 +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
ae4042e7a2 stream: flags should not override properties
Only set the properties from the flags when not already set before.

Fixes #3382
2023-07-26 10:44:47 +02:00
Wim Taymans
dd78f3d5f7 alsa: disable htimestamp by default
It seems there are drivers that don't return a good values and we end up
with a lot of delay or automatic disable of htimestamp when the values
look too off.
2023-07-26 10:32:53 +02:00
Wim Taymans
ce8f2c5d10 modules-vban: add vban sender and receiver
Fixes #3380
2023-07-25 18:36:48 +02:00
Wim Taymans
938bbc3039 protocol-pulse: document 2 other quirks 2023-07-25 12:47:58 +02:00
Wim Taymans
ad1a36a718 audioconvert: add option to disable volume updates
Add channelmix.lock-volumes. When set to true it will disable volume
updates until set back to false.

See #3361
2023-07-25 12:36:23 +02:00
Pauli Virtanen
cd3375f39e meson.build: enable LC3 by default
Enable LE Audio support by default if liblc3 is present, the Pipewire
implementation should be OK. Remove unused HAVE_BLUETOOTH_BAP define,
we don't have any #ifdefs for this.

The feature is still disabled by default in BlueZ, which also now takes
care of necessary hardware feature checks, and should be safe to enable
on Pipewire side.
2023-07-25 07:26:21 +00:00
Tom A. Wagner
193384b26a pipewire: add missing stdbool.h include to version.h.in
The header file only works when included in a file where stdbool.h was already included otherwise.
2023-07-24 12:48:33 +02:00
Wim Taymans
920bb7160e thread-loop: only signal when option is set
Add a thead-loop.start-signal option that will do a signal before
entering the thread loop. Doing the signal in all cases can confuse
apps that don't expect the signal.

Make module-rt use the thread-loop.start-signal.

Fixes #3374
2023-07-23 18:16:00 +02:00
Joan Bruguera Micó
55812195ce module-rt: error out on load if no bus is available
Since the recent changes to the RT module in Pipewire 0.3.75, some
applications such as those using OpenAL-Soft crash on startup if
neither the session nor the system bus is available. For example:

    bwrap --dev-bind / / \
          --bind /dev/null /run/dbus/system_bus_socket \
          --bind /dev/null $XDG_RUNTIME_DIR/bus \
          openal-info

Will result in a crash with the following error message:

    dbus[1626147]: arguments to dbus_message_new_method_call() were
    incorrect, assertion "path != NULL" failed in file dbus-message.c
    line 1373.
    This is normally a bug in some application using the D-Bus library.

The RT module previously failed to load if no bus was available, but
after the recent changes, the init. logic runs in a thread, and failing
to obtain the bus no longer causes the module to fail to load.

Then, functions called later such as `pw_rtkit_make_realtime` assume
the bus is available and try to use it, causing the error above.

Put the logic for obtaining and checking the bus back to `module_init`,
so the module fails to load again if no bus is available.
2023-07-22 02:22:18 +00:00
Wim Taymans
a3bd0f7a0a 0.3.75 2023-07-21 11:04:12 +02:00
Wim Taymans
8d1b3f6f48 module-rt: first destroy the loop and then rtkit
Or else we might still try to use the rtkit in the thread.

See #3357
2023-07-20 16:17:14 +02:00
Wim Taymans
163fde0a69 module-rt: fall back to some defaults in case of error 2023-07-20 15:57:31 +02:00
Wim Taymans
7b24b3b687 module-rt: use lock for thread lookup and invoke
We should only call invoke from one thread at a time so fuse the
gettid of the thread and invoke into the lock.

See #3357
2023-07-20 15:43:41 +02:00
Wim Taymans
47f7802c2e module-rt: wait for thread start
So that we always invoke in the thread.

See #3357
2023-07-20 15:30:01 +02:00
Wim Taymans
33be898130 thread-loop: signal when started
This makes it possible to wait for the thread to have started.
2023-07-20 15:29:30 +02:00
Wim Taymans
be9c6b1842 impl-link: only check permission changes for owners
When the permissions change on a node for a client, only check the
link permissions if the nodes of the link belong to the client.

Otherwise, we might destroy a link when the permissions are removed
from a node for an unrelated client.
2023-07-20 15:20:29 +02:00
Wim Taymans
86a52ea7b5 client-node: don't set io on our internal mix
We use the -1 mixer to keep track of the buffers and format after the
port mixer so we don't want to clear the io when we remove it.
2023-07-20 13:22:45 +02:00
Wim Taymans
66c09682c4 module-rt: make sure we change nice of main_pid 2023-07-20 12:16:13 +02:00
Wim Taymans
09277cbfa4 module-rt: do rtkit from a thread-loop
First check if we can adjust priorities with rlimits, if we can't and we
need to use rtkit, spawn a thread-loop to handle the rtkit stuff.

First do a pw_loop_invoke() to do the rtkit setup, including getting
some properties and then setting the nice level and rlimits.

Use pw_loop_invoke to queue rtkit realtime requests, this ensures we
always perform the requests after the setup and when the properties
are fetched.

See #3357
2023-07-20 12:03:29 +02:00
Wim Taymans
d74153a231 module-profiler: use an event to send out data
Don't use a timer but use an event to trigger a flush of the collected
data. We are now using a per-driver buffer and we don't want to make
this too large so make sure we flush the data quickly.
2023-07-20 12:01:38 +02:00
Wim Taymans
8eb1d8f2ac dbus: add some more debug 2023-07-20 10:15:30 +02:00
Wim Taymans
ab1436fb3b audioconvert: improve EMPTY flag on output buffers
Only set the EMPTY flag on output buffers if we don't have any
previously queued samples and the input is EMPTY.

Fixes #3365
2023-07-19 21:39:25 +02:00
Wim Taymans
f99fd7d75a improve some debug 2023-07-19 21:39:12 +02:00
Wim Taymans
2211016516 module-rt: don't block on method calls
Don't block on the method calls to make realtime or high priority.
Those calls don't return anything and other errors (invalid method,
invalid arguments, no service,...) can be caught differently async.

Fixes #3357
2023-07-19 13:41:18 +02:00
Wim Taymans
719e48a76d test: fix test 2023-07-19 11:35:03 +02:00
Wim Taymans
fba6083aaa module-profiler: use per-driver ringbuffer
Make a ringbuffer per driver because each driver might run in a
different threads and because a shared ringbuffer can not be written to
from multiple threads. Assemble all the driver stats into one buffer
before sending out the profile info.
2023-07-19 11:35:03 +02:00
Wim Taymans
7ae59ff399 profiler: use rt_events
Track the driver nodes and listen for rt events to collect stats.
2023-07-19 11:35:03 +02:00
Wim Taymans
cfd3bcd6b2 impl-node: add rt_events
Remove the context_driver events and replace them with realtime node
events. The problem is that the realtime node events are emitted from
the node data thread, which can be different for each node and
aggregating them into context_driver events is not a good idea.

It's also nice for the stream drained event, which no longer needs to go
through the context_driver events.
2023-07-19 11:32:13 +02:00
Robert Mader
5bac089229 spa: libcamera: add libcamera version check for properties::SystemDevices 2023-07-19 09:21:03 +00:00
Ashok Sidipotu
6cd29aed05 spa: v4l2: get the device number of the v4l2 device
This value can be used in filtering the camera devices in consultation with
libcamera
2023-07-19 09:21:03 +00:00
Ashok Sidipotu
79518d13ae spa: libcamera: consume the device numbers libcamera property
Pass on the device numbers property of libcamera to session managers, with they
are better equipped to filter the camera/video devices across v4l2 and libcamera.
2023-07-19 09:21:03 +00:00
Wim Taymans
983d34f344 spa: add some more docs
See #3351
2023-07-17 17:46:04 +02:00
Wim Taymans
9e44bd9982 stream: reorder property rules evaluation
First update some stream defaults, then apply generic property updates.

Before connecting, fill in some more default with the flags and the
direction of the stream, then evaluate the rules, then overwrite with
environment values.

This ensure that the rules can also use the flags and direction used
during _connect().

See #3355
2023-07-17 16:28:18 +02:00
Wim Taymans
9e0932b319 impl-link: enforce permissions in links
Enforce that the owner client of the output node can see the input node
and vice versa.

This works around an issue where the session manager performs a link
between nodes that should not be linked, like when doing screensharing
and the portal has set permissions to only see the screenshared stream,
wireplumber will link to the camera when the target.object is not set.
See also wireplumber#218

This has unfortunately the downside that patchbays like helvum will also
not be able to link those nodes. We should probably add a new link
permission to allow this explicitly.
2023-07-17 13:32:40 +02:00
Barnabás Pőcze
146665893e spa: bluez: upower: keep track of pending call
Keep track of the DBusPendingCall and cancel it when being destroyed,
furthermore, create `update_battery_percentage()` and don't duplicate code.
2023-07-15 01:08:24 +02:00
Barnabás Pőcze
708e5443ae spa: bluez: add steal_reply_and_unref() helper
This function retrieves the reply from a DBusPendingCall and unrefs the call.
2023-07-15 01:04:23 +02:00