Commit graph

461 commits

Author SHA1 Message Date
Barnabás Pőcze
3eaea123f9 pulse-server: module-simple-protocol-tcp: add module listener 2021-06-11 20:50:30 +02:00
Barnabás Pőcze
12359b490d pulse-server: module-null-sink: provide fallback name
If no `sink_name` has been specified, use "null-sink" to avoid a
NULL pointer dereference later in the function.
2021-06-11 20:50:30 +02:00
Barnabás Pőcze
09c162c8bf pulse-server: module-null-sink: add missing version to events struct 2021-06-11 20:50:30 +02:00
Barnabás Pőcze
6f5b089767 pulse-server: clear hook list when module is freed
Moreover, rename the hook list to "listener_list".
2021-06-11 20:50:30 +02:00
Barnabás Pőcze
d9befc0792 pulse-server: eliminate some memory leaks in modules 2021-06-11 20:50:30 +02:00
Barnabás Pőcze
1d5fb2a7db pulse-server: remove unnecessary struct members 2021-06-11 20:50:30 +02:00
Barnabás Pőcze
cd0eb829dd pulse-server: remove redundant log messages from modules
The same information is printed in
* `on_module_loaded()`,
* `module_load()`, and
* `module_unload()`.
2021-06-11 20:50:30 +02:00
Nicolai Syvertsen
01875ad223 pipewire-pulse: set description
Some applications like TeamSpeak crash when this isn't set.
2021-06-10 22:21:26 +02:00
Arun Raghavan
08daf3f4f4 pulse-server: Add a module-echo-cancel
Fairly straightforwad module to load libpipewire-module-echo-cancel
2021-06-05 17:54:02 +00:00
Wim Taymans
2a8b7594bc pulse-server: avoid overflow
Make sure the requested bytes never go below 0.

See #1258
2021-06-04 09:13:43 +02:00
Barnabás Pőcze
e65afe8fa2 pulse-server: module-combine-sink: remove hooks
Remove hooks when the module is unloaded to avoid
use-after-free issues. Remove the cleanup source as well.

Fixes #1259.
2021-06-04 06:55:08 +00:00
Wim Taymans
669fbf10c1 fix some leaks in error paths 2021-06-03 20:33:59 +02:00
George Kiagiadakis
131832d441 pulse-server: suffix TAG_USEC constants with LL, as they must be 64-bit
Fixes protocol errors on arm
2021-06-03 17:36:19 +03:00
Peter Hutterer
71e0cfb5fa pipewire: allow NULL pointers in pw_free_strv()
Just like the real free() we should just ignore a NULL pointer, makes the
caller code easier for those instances where properties are optional.
2021-06-02 10:56:46 +00:00
Peter Hutterer
e0471c6757 pipewire: allow NULL pointers in pw_properties_free()
Just like the real free() we should just ignore a NULL pointer, makes the
caller code easier for those instances where properties are optional.

Patch generated with concinelle with a few manual fixes.
2021-06-02 10:56:46 +00:00
Barnabás Pőcze
4c13eced55 pulse-server: detach clients from server
When the server or client goes away, detach the client
from the server to avoid potential use-after-free issues
that might occur if the client causes the
unloading of the server it is connected to.

E.g.:

  pactl load-module module-protocol-native-tcp port=4713
  pactl -s localhost:4713 unload-module module-native-protocol-tcp

See #1240.
2021-06-01 22:11:49 +02:00
Wim Taymans
3889ea5277 pulse-server: add ref to client while processing
Add a ref to the client while processing messages. This way we don't
destroy the client if we destroy the server it is on.

Fixes #1240
2021-06-01 17:48:24 +02:00
Wim Taymans
102b77ea03 pulse-server: don't request already requested data
When we are flushing, don't ask for already requested bytes
or else we end up with too much data in our buffer.

Fixes #1243
2021-06-01 16:59:00 +02:00
Barnabás Pőcze
1cb613ee4b pulse-server: terminate connection in more cases
If any of those two branches are taken, the connection
cannot make forward progress since no data will be read/sent
from/to the client.

For example, sending just 21 invalid bytes to the server
causes the first 20 bytes (client descriptor) to be read,
then rejected, leaving `client->message == NULL`. But since
polling is level triggered, `on_client_data()` and thus
`do_read()` will continue to be called ceaselessly,
thereby spamming the log and wasting resources.
2021-05-31 21:34:58 +02:00
Barnabás Pőcze
bc6adbe15d pulse-server: make control flow easier to unserstand
Use a switch statement to make the control flow
a bit easier to understand.
2021-05-31 21:34:58 +02:00
Barnabás Pőcze
87c00a6f00 pulse-server: add missing EWOULDBLOCK check 2021-05-31 21:34:58 +02:00
Barnabás Pőcze
ebed44db79 pulse-server: support absolute unix socket paths
If a unix socket address starts with '/', use it
directly as an absolute path, do not prepend
the runtime directory.
2021-05-31 21:34:58 +02:00
Barnabás Pőcze
70c6e6ccc8 pulse-server: only unlink sockets
If the entity specified in a unix socket address exists, check
if it is a socket, and bail out if it is not.
2021-05-31 21:34:58 +02:00
Wim Taymans
a138152bef pulse-server: free message when resize fails
Based on patch by Peter Hutterer

Fixes !701
2021-05-28 11:52:29 +02:00
Wim Taymans
913434167d modules: remove some useless device names 2021-05-28 11:20:06 +02:00
Barnabás Pőcze
48f03f85a7 pulse-server: add support for IPv6
Add support for listening on IPv6 addresses.
The following address formats are supported:
 * tcp:[<ipv6-addr>]:<port>,
 * tcp:<ipv4-addr>:<port>,
 * tcp:<port>, and
 * unix:<path>.

The IP addresses are parsed using `inet_pton()`,
only the formats supported by that function
are accepted.

The IPv6 address must be surrounded by square brackets,
they do not mean "optional" here. Specifying only the
port is equivalent to the following two addresses:
 * [::]:<port>, and
 * 0.0.0.0:<port>.

Address parsing has been made stricter: the port
must always be specified explicitly.

Fixes #1216.
2021-05-27 21:12:14 +02:00
Barnabás Pőcze
279470bc07 pulse-server: native-protocol-tcp: do not hardcode port
Use `PW_PROTOCOL_PULSE_DEFAULT_PORT` from pulse-server.h
instead of hard-coding the default port.
2021-05-27 19:32:02 +02:00
Wim Taymans
492caf4456 pulse-server: handle errors during create
If a stream is being created and an error occurs we always need to
reply with the pending create_tag.

Fixes #624
2021-05-26 10:44:59 +02:00
Wim Taymans
4e4294dc13 pulse-server: handle NULL dbus connection
Fixes #1224
2021-05-26 10:23:17 +02:00
Peter Hutterer
2cb7b19b7d pulse-server: fix scan-build errors for unused variables
All cases of value stored but never read
2021-05-26 07:51:27 +00:00
Peter Hutterer
6d19dd0162 pulse-server: if all transport methods failed, fail server creation
No point in keeping a server running if it doesn't listen to anything.
2021-05-26 07:46:55 +00:00
Wim Taymans
8e36353311 pulse-server: module-combine-sink remove right property 2021-05-24 12:58:10 +02:00
Arun Raghavan
25f9765e9c pulse-server: Implement module-combine-sink 2021-05-24 08:34:23 +00:00
Peter Hutterer
71c6a175c4 Drop double semicolons 2021-05-20 07:24:22 +00:00
Peter Hutterer
4e70799922 treewide: drop strzcmp implementations in favor of spa_streq 2021-05-18 22:10:27 +10:00
Peter Hutterer
522f87d5ea treewide: replace strcmp() != 0 with !spa_streq
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10:00
Peter Hutterer
95a84e797a treewide: replace !strcmp() with spa_streq()
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10:00
Peter Hutterer
7697ed0757 treewide: replace strcmp() == 0 with spa_streq()
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10:00
Wim Taymans
170294d7ac pipewire-pulse: add zeroconf module 2021-05-14 11:39:44 +02:00
Wim Taymans
59842b3bd6 make and use pw_properties_serialize_dict()
Remove the multiple other variants and make a better one. Flags are for
future options for escaping and formatting.
2021-05-14 09:08:46 +02:00
Wim Taymans
fb6db4a1f9 pulse-server: clean up default format a little 2021-05-12 18:06:48 +02:00
Wim Taymans
ab9023f752 pulse-server: improve module argument parsing
ticks also delimit strings.
Unescape values.

Fixes #1173
2021-05-12 17:44:57 +02:00
Wim Taymans
3ae2b9e189 pulse-server: implement module-tunnel-sink/source
See #865
2021-05-12 17:00:45 +02:00
Sanchayan Maity
d8f98df6ed pulse-server: Implement module-pipe-sink 2021-05-11 13:31:41 +05:30
Wim Taymans
c50c8d2be9 modules: fix some leaks in error paths
As found by coverity
2021-05-11 09:55:14 +02:00
Wim Taymans
2414d3501c pulse-server: add ladspa sink and source
To make an rnnoise filtered source:

pactl load-module module-ladspa-source source_name=rnnoise_mic label=noise_suppressor_mono plugin=/usr/lib64/ladspa/ladspa/librnnoise_ladspa.so

To make an equalizer sink:

pactl load-module module-ladspa-sink sink_name=eq_out label=mbeq plugin=/usr/lib64/ladspa/mbeq_1197.so
2021-05-10 11:01:13 +02:00
Peter Hutterer
2405f0942b spa/buffer: rename SPA_MEMBER to SPA_PTROFF
SPA_MEMBER is misleading, all we're doing here is pointer+offset and a
type-casting the result. Rename to SPA_PTROFF which is more expressive (and
has the same number of characters so we don't need to re-indent).
2021-05-06 09:39:39 +00:00
Andrea Gelmini
47ef2b6b09 Fix typos 2021-04-30 07:40:20 +00:00
Wim Taymans
620c863b6d pulse-server: track and set monitor volume on monitor sources 2021-04-29 15:25:04 +02:00
Pauli Virtanen
20c8d7b29e pulse-server: keep track of seq in pw_*_enum_params
If multiple async enum param are running at the same time, take results
only from the latest one.
2021-04-25 20:56:57 +03:00