Commit graph

11228 commits

Author SHA1 Message Date
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
Barnabás Pőcze
183270f53c spa: bluez: add cancel_and_unref() dbus helper
This function cancels and unrefs a DBusPendingCall and
resets the pointer to NULL.
2023-07-15 01:04:22 +02:00
Barnabás Pőcze
1025d5c600 spa: bluez: remove some unused DBusErrors 2023-07-15 00:55:31 +02:00
Barnabás Pőcze
10f1b6c13c spa: bluez: backend-hsphfpd: use const char * for string literal 2023-07-14 22:35:36 +02:00
Barnabás Pőcze
667703e27d spa: bluez: backend-native: remove unnecessary array of DBusMessageIter 2023-07-14 22:35:35 +02:00
Barnabás Pőcze
66014e5828 spa: bluez: backend-native: fix DTMF string leak 2023-07-14 18:20:07 +02:00
Barnabás Pőcze
33a5c4ba10 spa: bluez: fix spelling of HAVE_REALLOCARRAY feature macro
It should have two `R`s not three.
2023-07-14 18:20:07 +02:00
columbarius
0a13d37e5c spa: Add SPA_VIDEO_FLAG_MODIFIER_FIXATION_REQUIRED
This flags allows clients to use the parse_format functions and
determine from their result directly if the modifer was fixated yet.
2023-07-14 08:20:54 +00:00
Barnabás Pőcze
abe8c3581f spa: bluez: free spa_bt_transport::configuration
`spa_bt_transport_free()` did not free `spa_bt_transport::configuration`,
so fix that.
2023-07-13 21:27:53 +02:00
Wim Taymans
5942c282a2 module-raop-sink: bump latency to 1.5sec
Make it work on the Audio pro link 1
2023-07-13 17:56:34 +02:00
Christian Glombek
d8dc89ad1a module-raop/rtsp-client: Pass content to reply function 2023-07-13 15:42:56 +00:00
Christian Glombek
6368b8cb87 module-raop-sink: Always log reply status 2023-07-13 15:42:56 +00:00
Christian Glombek
a4c6f9a27f Revert "module-raop: zero uppet timestamp bits"
This reverts commit 21d16b1ad5.

The change causes the sound of videos to be way out of sync when streaming from Fedora to Sonos.

It seems the issue is a device-specific quirk, and the change cannot be applied universally to all devices,
thus reverting until a better solution is found that does not affect other devices.
2023-07-13 15:42:56 +00:00
Christian Glombek
f54938d24a module-raop-discover: Two small fixes
- Fixes comment listing the RAOP encryption types.
  Option 2 is not available, and 4 is /auth-setup

- Fixes value for AAC-ELD codec
2023-07-13 15:42:56 +00:00
Wim Taymans
0501ef165a spa: add atomic.h and port macros to it 2023-07-13 12:25:22 +02:00
Wim Taymans
e86a770349 private: we only ever decrement activation with 1 2023-07-13 12:18:11 +02:00
Wim Taymans
0ee64c6fd3 pipewire: add method to check linked library version 2023-07-13 12:11:27 +02:00
Wim Taymans
01b5bc443f thread: expose pw_thread_fill_attr() 2023-07-13 12:10:21 +02:00
Wim Taymans
af48398577 jack: avoid using private fields 2023-07-13 12:08:36 +02:00
Wim Taymans
da7f398299 0.3.74 2023-07-12 11:18:43 +02:00
Wim Taymans
d225a192a1 Revert "modules: enforce equal library and compiler versions"
This reverts commit 697daeedf7.

This is too much, we should do better and only disallow incompatible
versions.
2023-07-12 11:16:56 +02:00
Wim Taymans
f1b0ab431e client-node: create global mix for initial ports
Don't only create the global mix for new ports but also for existing
ports. Tis fixes some buffer errors when using video ports.
2023-07-12 11:12:55 +02:00
Wim Taymans
0cefb71c97 spa: fix compilation 2023-07-11 19:56:44 +02:00
Wim Taymans
697daeedf7 modules: enforce equal library and compiler versions
For all the modules that include the private header we require that the
library and compiler versions match.

Otherwise we might end up poking into new or old fields that got moved or
changed in the private struct and crash.

See #3243
2023-07-11 19:50:36 +02:00
Wim Taymans
ad71dd89a2 protocol-pulse: remove private.h include
See #3243
2023-07-11 19:37:49 +02:00
Wim Taymans
0dcbbcad01 client-node: do check for data_loop
so that we don't crash on older pipewire.

See #3243
2023-07-11 19:34:21 +02:00
Wim Taymans
5e2a7dbc4e modules: remove include of private.h
Remove some includes of private.h
Add some methods to get the mempool of client and context so that we can
remove direct access.
Move some things around.
Use methods to get pw_loop variables.

See #3243
2023-07-11 19:31:27 +02:00
Wim Taymans
dc07c2321b spa: add spa_ratelimit 2023-07-11 19:25:35 +02:00
Wim Taymans
17bc9d520e protocol-native: move compat_v2 to protocol 2023-07-11 16:13:38 +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
d7c54b3d82 gitignore: do not ignore the ".gitlab" directory 2023-07-11 14:23: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
Barnabás Pőcze
65d949558b spa: utils: add scope based resource cleanup
systemd, dbus-broker, and many glib applications heavily
utilize the GNU C attribute "cleanup" to achieve C++ RAII-like
semantics for local resource management. This commit introduces
essentialy same mechanism into pipewire.

At the moment, this is inteded to be a strictly private API.

free() and close() as cleanup targets are sufficiently common
to warrant their own special macros:

  spa_autofree char *s = strdup(p);
  // will call `free(s)` at the end of the lifetime of `s`

  spa_autoclose int fd = openat(...);
  // will call `close(fd)` if `fd >= 0` at the end of the lifetime of `fd`

However, with `spa_auto()` or `spa_autoptr()` it is possible to define
other variables that will be cleaned up properly. Currently four are supported:

  spa_autoptr(FILE) f = fopen(...);
  // `f` has type `FILE *`
  // will call `fclose(f)` if `f != NULL`

  spa_autoptr(DIR) d = opendir(...);
  // `d` has type `DIR *`
  // will call `closedir(d)` if `d != NULL`

  spa_autoptr(pw_properties) p = pw_properties_new(NULL, NULL);
  // `p` has type `struct pw_properties *`
  // will call `pw_properties_free(p)`

  spa_auto(pw_strv) v = pw_split_strv(...);
  // `v` has type `char **`
  // will call `pw_strv_free(v)`

It is possible to add support for other types, e.g.

  SPA_DEFINE_AUTOPTR_CLEANUP(pw_main_loop, struct pw_main_loop, {
    // the pointer can be accessed using `*thing`
    // `thing` has type `struct pw_main_loop **`
    spa_clear_ptr(*thing, pw_main_loop_destroy);
  })

  spa_autoptr(pw_main_loop) l = ...;
  // `l` has type `struct pw_main_loop *`
  // will call `pw_main_loop_destroy(l)`

or

  SPA_DEFINE_AUTO_CLEANUP(spa_pod_dynamic_builder, struct spa_pod_dynamic_builder, {
    // `thing` has type `struct spa_pod_dynamic_builder *`
    spa_pod_dynamic_builder_clean(thing);
  })

  spa_auto(spa_pod_dynamic_builder) builder = ...
  // `builder` has type `struct spa_pod_dynamic_builder`
  // will call `spa_pod_dynamic_builder_clean(&builder)`

The first argument is always an arbitrary name. This name must be passed to
`spa_auto()` and `spa_autoptr()` as it is what determines the actual type
and destructor used. The second parameter is the concrete type. For
`SPA_DEFINE_AUTO_CLEANUP()` this is the concrete type to be used, while for
`SPA_DEFINE_AUTOPTR_CLEANUP()` it is the concrete type without the
outermost pointer. That is,

  SPA_DEFINE_AUTOPTR_CLEANUP(A, foo, ...)
  SPA_DEFINE_AUTO_CLEANUP(B, foo, ...)

  spa_autoptr(A) x; // `x` has type `foo *`
  spa_auto(B) y; // `y` has type `foo`

A couple other macros are also added:

  spa_clear_ptr(ptr, destructor)
  // calls `destructor(ptr)` if `ptr != NULL` and sets `ptr` to `NULL`

  spa_clear_fd(fd)
  // calls `close(fd)` if `fd >= 0` and sets `fd` to -1

  spa_steal_ptr(ptr)
  // sets `ptr` to `NULL` and returns the old value,
  // useful for preventing the auto cleanup mechanism from kicking in
  // when returning the pointer from a function

  spa_steal_fd(fd)
  // sets `fd` to -1 and returns the old value
2023-07-11 14:23:53 +02:00
Wim Taymans
4456f2efd1 impl-node: remove the node from the target peers
When we destroy a node, we need to remove the node as a current
driver peer.

Not doing this has 2 problems:
- remote drivers still trigger our node
- the client-node does not clean up the memid for the activation and
  we might reuse it later for a new node with the same fd.

See #3316
2023-07-10 16:59:17 +02:00
Wim Taymans
098ac51272 remote-node: don't init/release our special mix
We have SPA_ID_INVALID mix id for all ports to handle the formats and
buffers, we don't need to init/release the mix for this or else our
n_mix accounting is wrong and we might not clear the format right.
2023-07-10 16:56:58 +02:00