Commit graph

3341 commits

Author SHA1 Message Date
Wim Taymans
c803444123 impl-port: only send latency param when supported
Check if the port has latency param and only try to set the
latency param when it appears available. This avoids sending unknown
latency params to an old client and erroring out.
2021-05-31 11:31:18 +02:00
Evgeniy Khramtsov
3cf4bf7cf7 modules: build module-rt only on Linux
RLIMIT_RTTIME is Linux specific, there is no equivalent replacement
for FreeBSD. Save trouble and build module-rt for Linux only, rtkit
WIP fork should be fine on FreeBSD for now.
2021-05-30 15:30:45 +03:00
Barnabás Pőcze
2a8d511be8 pipewire: map: initialize free_list to SPA_ID_INVALID
If `struct pw_map::free_list` is not initialized to `SPA_ID_INVALID`,
then `pw_map_insert()` will try to read `map->items.data[0]` when
inserting the first element, but `data` is a `NULL`
pointer after initialization.
2021-05-30 00:21:43 +02:00
Wim Taymans
0eb46d8ef4 filter: call the process rt_callback 2021-05-29 08:41:37 +02:00
Wim Taymans
934caab1e1 stream: emit events from only one thread
Emitting events using the listener_list can not be done from multiple
threads at the same time.  For this reason, make a copy of the events
with the process event and call it explicitly from the data thread.

See #1122
2021-05-28 13:24:10 +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
Wim Taymans
b9efb25605 pulse-tunnel: handle latency a little better
Set a limit on the buffer size.
Announce our latency on the streams.
2021-05-28 11:19:05 +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
06cf1e1c00 module: proxy latency params 2021-05-27 16:07:25 +02:00
Wim Taymans
e7eba82002 port: keep both output and input latency on port
But only emit latency changes for the latency matching the port.
2021-05-27 15:26:09 +02:00
Wim Taymans
07f8a0d275 impl-port: remove useless code
We already check for 0 as the undefined value in the combine
function.
2021-05-27 15:26:09 +02:00
Wim Taymans
f383ac21dd pw-cat: remove debug 2021-05-27 15:26:09 +02:00
Wim Taymans
bae0622311 filter-chain: pass latency param along
Intercept the latency param and pass it on the right stream.
2021-05-27 15:26:09 +02:00
Wim Taymans
d8e9a43b9c stream: handle Latency param
Handle the latency param and remember the latency. Add the latency
to the delay value in the time.

Also make it possible to add custom Latency params.
2021-05-27 15:26:09 +02:00
Wim Taymans
80d48ad3b6 link: recalc latency when the peer latency changed
Trigger a recalculation of the port latency when the peer port
latency changed.

This makes the latency update from a port propagate through the
pipeline.
2021-05-27 15:26:09 +02:00
Wim Taymans
cd58c51582 port: implement latency_changed event
Emit the latency changed event when the latency was updated.
2021-05-27 15:26:09 +02:00
Wim Taymans
b9b89b92b2 spa: add some latency helpers
Add more fields to the latency object.
Add methods to create, parse and process latency info.
2021-05-27 15:26:09 +02:00
Wim Taymans
cd32404e92 port: implement latency reporting some more
Implement a port recalculate latency method that takes the min
and max latency of all peer ports and sets that as the new port
latency.
When a link is made, let the output and input port recalculate
latencies.
Pass latency param in audioconvert.
2021-05-27 15:26:09 +02:00
Wim Taymans
46ef88e520 spa: save the old change_mask and restore when emitting full
When we add a new listener to an object, it will emit the full state
of the object. For this it temporarily sets the change_mask to all
changes. Restore the previous state after this or else we might not
emit the right change_mask for the next listener.

Consider the case where one there are two listeners on an object.
The object emits a change and the first listener wants to enumerate the
changed params. For this is adds a new listener and then triggers the
enumeration. If we set the change_mask to 0 after adding the listener,
the second listener would get a 0 change_mask and fail to update
its state.
2021-05-27 15:21:44 +02:00
James Henstridge
733ad43d3f module-portal: direct GetConnectionUnixProcessID call to /org/freedesktop/DBus
The D-Bus specification says that the message bus accepts method calls
on other object paths for backwards compatibility, and may reject
security sensitive calls on unexpected object paths:

https://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-messages
2021-05-27 11:24:04 +00:00
Wim Taymans
751f9a9ea0 dbus: make sure we don't unref a NULL dbus connection
See #1213
2021-05-26 10:52:38 +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
Wim Taymans
f007ca475c pw-cli: handle failure to create context
Fixes #1234
2021-05-26 10:18:15 +02:00
Wim Taymans
8027c9225e context: log some more errors when config file fails 2021-05-26 10:17:40 +02:00
Peter Hutterer
b64f0d581f doc: switch from .md to .dox files and impose some general structure
This is an attempt of breaking up the documentation, currently spread across
several pages. We're left with a few high-level topics with various things
grouped underneath those.

Further refinement is necessary, but this can now be done in incremental steps
over massive reworks.
2021-05-26 10:02:10 +02:00
Peter Hutterer
13bb152840 doc: fix a copy/paste-o 2021-05-26 10:02:10 +02:00
Peter Hutterer
5e5b9e3050 conf: PIPEWIRE_CONFIG_DIR should take precedence if set
This matches the behavior of most applications - check environment variables
first, then fall back to the various built-in options (in our case xdg, /etc/
/usr/share, in that order).
2021-05-26 07:54:29 +00:00
Peter Hutterer
25a58fd939 examples: 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
e1211e6a94 tools: 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
0b5f19f1d2 pipewire: 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
049eaac821 modules: 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
07503410c7 stream: 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
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
Barnabás Pőcze
1e9442e6b8 pulse-server: fix memory issue
Previously, when `pw_protocol_pulse_new()` returned NULL,
the code would jump to the `error` label, which would
call `impl_free()`. At this point, however, `impl->module_listener`
is not initialized, which would lead to a SIGSEGV when
`spa_hook_remove()` is called from `impl_free()`.
2021-05-25 14:55:00 +02: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
Fabrice Fontaine
fa64d93e64 fix linking with -latomic
Linking with -latomic has been added to pipewire-jack since
b8c58c74d8

However, this is not the right place to add this dependency, atomic_dep
should be added to pipewire_dep to avoid the following build failure:

/home/giuliobenetti/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/sparc-buildroot-linux-uclibc/9.3.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: src/pipewire/libpipewire-0.3.so.0.326.0.p/filter.c.o: in function `impl_node_process':
filter.c:(.text+0xf28): undefined reference to `__atomic_fetch_add_4'

Indeed, atomic operation such as __atomic_fetch_add is used in libcamera
as well as in ./spa/plugins/libcamera/libcamera_wrapper.cpp,
./spa/include/spa/utils/ringbuffer.h and ./spa/include/spa/graph/graph.h

Fixes:
 - http://autobuild.buildroot.org/results/b5305e8e7dd1a5e8bfaba72b06251056ba7d1af1

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2021-05-24 08:33:50 +00:00
Barnabás Pőcze
22d874cdeb filter-chain: handle LADSPA_PATH as colon separated list of paths
Split up LADSPA_PATH at colons, and try to load the particular
plugin from each directory specified in LADSPA_PATH.

Fixes #1217.
2021-05-24 08:23:21 +00:00
Barnabás Pőcze
67e588f382 filter-chain: actually use ladspa_handle_list
Add successfully loaded handles to the list in `ladspa_handle_load()`,
and remove them when they are freed in `ladspa_handle_unref()`.
2021-05-24 08:23:21 +00:00
Barnabás Pőcze
a8a6def20f filter-chain: fix reference counting issue
Fix a reference counting issue that resulted in
ladspa_handle's refcount being equal to the
sum of the refcounts of its descriptors.

This would result in a memory leak when a descriptor
is loaded more than once from the same handle.
This cannot happen because `ladspa_handle_list` is
not  populated by `ladspa_handle_load()`.
The next commit implements exactly that, so
the fix is applied before the change that
would introduce the problem.
2021-05-24 08:23:21 +00:00
Barnabás Pőcze
e9ba0899c2 filter-chain: fix rnnoise example configuration
Other filter-chain configuration file examples do not prefix
the plugin key with 'ladspa/'. And in the absence of
the LADSPA_PATH environmental variable, this would lead
to "/usr/lib64/ladspa/ladspa/librnnoise_ladspa.so" being used
as the path, which is not correct.
2021-05-24 08:23:21 +00:00
Sjoerd Simons
d2e1b968af Let pipewire-pulse services conflict with their pulseaudio counterparts
You can only run either pulseaudio *or* the pipewire-pulse daemon at one
time. So make the pipewire-pulse units conflict with their pulseaudio
counterparts to avoid both running at the same time
2021-05-22 14:26:30 +02:00
Wim Taymans
3c503ca240 impl-link: improve debug, log param name 2021-05-21 10:46:14 +02:00
Wim Taymans
36000ea508 stream: clean up the params
Use defines for the param index.
Fix params for filter. Make it possible to use Props params.
2021-05-21 10:45:19 +02:00
Peter Hutterer
cbe29c070c doc: switch doxygen to using groups instead of pages and classes
C code doesn't lend itself well to using classes and pages are best for prose.
A doxygen group is a set of related functions - which is exactly what we have
here, e.g. pw_context.

This patch basically adds the following lines to each header:
\defgroup pw_whatever
\addtogroup pw_whatever
\{
....  function declarations ....
\}

Doxygen is smart enough to merge documentation in the header with
documentation in the correspondin .c file where the function is implemented.
2021-05-21 15:05:30 +10:00
Peter Hutterer
7c4bfe5a15 doc: use markdown ticks instead of escaped html for readability 2021-05-21 15:04:22 +10:00