Commit graph

7900 commits

Author SHA1 Message Date
Wim Taymans a0d7fb01ba pulse-server: add size check when reading strings 2021-11-25 10:14:30 +01:00
Wim Taymans 5d20e3028a pulse-server: avoid reading past the message size
We can't really get into this situation but it is a good idea to check
that we don't try to read past the message length.
2021-11-25 09:48:34 +01:00
Wim Taymans d79d2f69fb alsa: improve debug
Log the configured default_format.
2021-11-24 17:25:59 +01:00
Wim Taymans 955dde5272 alsa-plugin: use hw_avail in _delay for playback
for playback streams we want to include the hw_avail, which is the amount of
data that the hardware can read or the amount of data the application has
written.

This is in contrast to using _avail for the capture stream, which is
what the application can read. hw_avail for a capture stream is how many
samples the hardware can write or the amount of free space.

See #1697
2021-11-24 13:12:23 +01:00
Wim Taymans 743cced63e alsa-plugin: improve debug 2021-11-24 12:40:02 +01:00
Wim Taymans 301e729864 alsa-plugin: fix delay reporting
The delay should be calculated based on the amount of samples available
to the application, not the hardware.

This overreported the delay.

See #1697
2021-11-24 12:24:29 +01:00
Wim Taymans d8e24fca1c alsa-plugin: don't rate match for capture streams
For capture streams we can simple copy the complete pipewire buffer into
the alsa pcm ringbuffer to make it available for the application.
2021-11-24 12:24:29 +01:00
Wim Taymans 33f087d4db alsa-plugin: don't clamp elapsed time to stream delay
There is no reason to limit the elapsed time to the stream delay, it is
possible that it is larger and then it will be clamped later.
2021-11-24 12:24:29 +01:00
Wim Taymans 6f0c5b6428 alsa-plugin: improve debug 2021-11-24 12:24:29 +01:00
Wim Taymans ac4ec20b01 pulse-server: free pending client message
If the client is destroyed before it could completely read the message,
free the pending message as well.

See #1840
2021-11-23 18:13:35 +01:00
Wim Taymans 9feecb36d0 pulse-server: don't add large blocks to cache
See #1840
2021-11-23 17:44:01 +01:00
Wim Taymans 418c6fbe96 pulse-server: limit the max cache to 16MB
Don't recycle messages when we have too many allocated already.

See #1840
2021-11-23 17:24:24 +01:00
Wim Taymans 8995129e6c alsa: refactor property parsing
Move the common property parsing to the init function.
2021-11-23 12:27:36 +01:00
Wim Taymans 25bfc9c63d alsa: refactor a bit
Make spa_alsa_close() do spa_alsa_pause() first and also clear the
format.
2021-11-23 12:20:27 +01:00
Wim Taymans 13923416e0 alsa: keep track of rate in card object
Expose the card object and always obtain one per pcm.

Keep the configured format in the card object.

Add a api.alsa.multi-rate property. When multi_rate is disabled,
only allow the last configured card rate on all PCMs.

This works around drivers that can't handle multiple samplerates
on their PCMs.

With this patch it should be mostly safe to configure multiple
sample rates in pipewire.conf

See #1547
2021-11-23 11:44:26 +01:00
Wim Taymans e7f9046bb8 global: place object.serial in object info
Make a method to return or allocate the serial for a global.
When the global is unregistered, a new serial is calculated.
Place the serial in the object info and the global info.
2021-11-22 17:13:10 +01:00
Wim Taymans 53548aee75 global: add the object.serial property for globals
Make sure the lower 32 bits of the serial are never SPA_ID_INVALID. This
makes it possible for applications that need a unique 32 bits number to
use the lower bits while still having an invalid 32 bit serial number.
2021-11-22 16:30:00 +01:00
Wim Taymans 59c4975750 global: add serial number
Add a global serial number for each global object. We can use this
to uniquely define each global.
2021-11-22 16:00:25 +01:00
Wim Taymans dd62b12a1f jack: implement stub internal client API
Fixes #1842
2021-11-22 12:52:15 +01:00
Wim Taymans aeb435087b jack: ensure we don't have negative latencies 2021-11-22 12:12:29 +01:00
Wim Taymans 52b9ca8f2e jack: recompute latency on buffer size change
The latencies might be expressed in quantum, which changes when the
buffer size changes.
2021-11-22 12:11:49 +01:00
Wim Taymans 92a5570bbd raop: small cleanup 2021-11-22 10:53:49 +01:00
Wim Taymans 5ae75e1d2a pulse-server: use STREAM_CAPTURE_SINK for monitor capture
Make the pulseaudio layer set the PW_KEY_STREAM_CAPTURE_SINK property
when a monitor device is selected as a source to make it easier for the
session manager to find the right source.
2021-11-19 20:24:58 +01:00
Peter Hutterer d4d6458b5b modules: check for a NULL resource in client-device and client-node
See https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues/113
2021-11-19 09:58:49 +10:00
muzena 31a84a8deb Update pipewire.pot and hr.po 2021-11-18 11:50:09 +00:00
Wim Taymans 2e87127700 jack: keep object cache
Keep per type free_lists so that we can't reuse an old port object for
a link/node. This makes it more likely that ports are still available
after being freed.

Keep all allocated objects indexed in a global cache map. Use the global
cache index as the jack_port_id_t in connection and port registration
callbacks. Since the port_id is unique per allocated object and since
the objects types are never changed, we can always find a port with the
given port_id in the cache.

This vastly improves tools like catia that insist on querying objects
after they have been removed/destroyed.
2021-11-18 12:14:38 +01:00
Wim Taymans c387e83c65 pipewire-v4l2: avoid overflow in id calculation 2021-11-17 13:16:27 +01:00
Wim Taymans f5f66d1718 alsa: free card on error 2021-11-17 12:55:51 +01:00
Wim Taymans 5bc95234e8 filter-chain: fix memory leaks 2021-11-17 12:53:32 +01:00
Wim Taymans cf66400035 filter-chain: clean up on errors 2021-11-17 12:49:00 +01:00
Wim Taymans 1b88e0023b filter-chain: free plugin when load fails 2021-11-17 12:45:26 +01:00
Wim Taymans 6d492db948 impl-module: don't leak filename
When dlopen fails, don't leak the filename.
Fix indentation.
2021-11-17 12:43:46 +01:00
Wim Taymans 947ee152d3 bluez: check dbus service before enumerating objects
First check if the bluez dbus service is active before doing a
GetManagedObjects() call.

Else we might try to activate the bluetooth dbus service, which
should normally only be activated during bootup.
2021-11-17 12:00:00 +01:00
Wim Taymans 7eee45ff41 alsa: remove stray log line 2021-11-17 10:52:43 +01:00
Wim Taymans 23ac9e5f3c module-access: improve pipewire.client.access handling
If a client (pipewire-pulse) has performed the access check and creates
a client with a specific access path, it will set this in the
pipewire.client.access property. For example, when a flatpak client
connects to pipewire-pulse, it will create a client with the flatpak
pipewire.client.access property.

Check the property after reading it so that we don't blindly grant
complete access to the flatpak client. Instead let the session
manager to assign the permissions.

This fixes a problem where flatpak clients entering pipewire-pulse would
initially get full access and then be downgraded by the session manager.
This would result in the pulse client thinking that it has access to
objects while failing later.
2021-11-16 17:27:05 +01:00
Wim Taymans a0e0a4d9d2 protocol-native: improve permission debug 2021-11-16 17:26:46 +01:00
Wim Taymans af2e7b630a pulse-server: turn error into info
Receiving a message from an already removed stream should not result in
an error message.

See #1812
2021-11-16 12:33:23 +01:00
Wim Taymans f10b872733 resample: improve buffer size calculations
Scale the buffer size with the rate conversion ratio. Also make sure
that we can at least produce a maximum quantum of samples.

If we have large upconversion (8KH -> 48KHz) and small input
buffers, we would not allocate enough space for the output buffer
and cause xruns in the sink.

Fixes #1809
2021-11-16 11:48:02 +01:00
Peter Hutterer 34847f117f systemd: extend the description for the socket files
Let's add PipeWire and Socket into the description, the current messages
are not overly obvious:
   Listening on Multimedia System.
   Closing Multimedia System.
2021-11-15 10:17:39 +10:00
Wim Taymans c03d10296b raop: connect TCP socket
Connect to the server TCP socket in TCP mode.
Use getaddrinfo to resolve hostname.
2021-11-13 21:00:24 +01:00
Niklāvs Koļesņikovs ceeaf6c2f9 meson: add -Draop switch for OpenSSL dep control
Even though OpenSSL is very common, automagic dependencies
are still not great, so let's have a raop switch to control
that.
2021-11-13 12:07:33 +00:00
Wim Taymans a9fbc8a88d impl-core: use PW_ID_CLIENT to make things clearer 2021-11-13 13:05:31 +01:00
Wim Taymans e52f9f513e raop: add user agent 2021-11-13 10:13:55 +01:00
Wim Taymans 0573944e59 raop: add authentication 2021-11-13 10:00:50 +01:00
Wim Taymans 5d6690ebe7 raop: only encrypt when enabled 2021-11-12 18:10:39 +01:00
Wim Taymans 4695bd32c4 raop: move some info to debug 2021-11-12 17:56:04 +01:00
Wim Taymans 6ce9260980 pulse-server: implement module-raop-discover 2021-11-12 17:53:24 +01:00
Wim Taymans fa1f556d93 module-raop-sink: handle 0 block_size 2021-11-12 16:58:27 +01:00
Wim Taymans 3e659d01b8 doc: add raop sink to docs 2021-11-12 16:58:27 +01:00
Wim Taymans ac92f584ab raop: remove duplicate define 2021-11-12 16:58:27 +01:00