Commit graph

11212 commits

Author SHA1 Message Date
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
Wim Taymans
3e0050d1cd client-node: clear resource after freeing mem
Some of the mem unref might send a message to the client.

This is not actually the case right now but just to be safe for the
future.
2023-07-10 16:55:05 +02:00
Wim Taymans
a966d4806b improve debug 2023-07-10 16:52:39 +02:00
Wim Taymans
f459320968 impl-node: first remove, then add ourselves
First remove ourself from the old driver, then add ourself to the
new driver.

This got changed as a possible error in b8fe832188
2023-07-10 11:15:53 +02:00
Wim Taymans
baa5497617 spa: warn out of buffers
Running out of buffers is pretty bad and warrants a warning because it
can cause loss of audio.

See #3316
2023-07-07 12:11:02 +02:00
Wim Taymans
21d16b1ad5 module-raop: zero uppet timestamp bits
The Audiopro link1 seems to want to upper bits of the timestamp in
sync messages as 0. It still seems to work with Sonos.

See #3247
2023-07-06 17:01:09 +02:00
Wim Taymans
fdc860c71b protocol-native: give an error when loading twice
Instead of silently ignoring the problem. It's possible that it is
loaded with different settings, which would then silently be ignored.
2023-07-06 13:51:37 +02:00
Wim Taymans
48a892aeec module-rtp: support sess.ignore-ssrc globally 2023-07-06 13:08:21 +02:00
Wim Taymans
126e03ec73 rtp: add option to ignore SSRC
This is useful when there is a fixed receiver and the sender can be
restarted.
2023-07-06 12:55:28 +02:00
Wim Taymans
b95ed6dcc1 jack: create mix explicitly
When we create a port, we should make the SPA_ID_INVALID mix_id for the
shared info on the mixer ports.
Only mix_info should create and destroy mix structures.
2023-07-06 12:53:28 +02:00
Wim Taymans
a9a9c72a0a client-node: create mix explicitly 2023-07-06 12:18:27 +02:00
Wim Taymans
44deacbc67 0.3.73 2023-07-06 11:42:24 +02:00
Wim Taymans
fd1fd7a00f module-rtp-source: improve docs a little 2023-07-05 15:29:56 +02:00
Wim Taymans
b5b01f4dd2 resample-peaks: improve peaks some more
Update the i_count in the loop because we use it to check when we have
completed a chunk.
2023-07-05 14:07:30 +02:00
Wim Taymans
48bf039e25 resample-peaks: fix peaks resampler
Avoid some segfaults in some cases.

fixes #3320
2023-07-05 13:46:08 +02:00
Wim Taymans
178f452127 context: upsample small rates up to the default rate
When the samplerate is smaller than half of the default, try to find a
rate less than the default to upsample to.

pavucontrol now asks for a 1/144 rate, which resulted in a graph rate of
88200 before this change.

See #3320
2023-07-05 12:44:05 +02:00
Wim Taymans
bec73f26a7 impl-node: don't log driver twice
When dumping the driver targets, only log the driver once.
2023-07-05 12:02:35 +02:00