Commit graph

1471 commits

Author SHA1 Message Date
Wim Taymans
1f04e911c5 module: handle work queue create errors
Handle NULL when creating a work queue instead of crashing. The
create can fail when we run out of fds.
2021-06-18 16:29:23 +02:00
Wim Taymans
bbbc79647f pulse-server: return INTERNAL error for ENFILE/EMFILE 2021-06-18 15:56:55 +02:00
Wim Taymans
05c633a4f5 profiler: Fix crash with many streams
Write the profiler data to an allocated buffer instead of the stack
so that we can make it a little larger.

Don't try to process the data when the builder had to truncate it
because it didn't fit.
2021-06-18 15:42:14 +02:00
Wim Taymans
def0caf281 pulse-server: handle out-of-files better
When we don't have enough files to accept the connection, clear the
_IN flag so that we don't try to accept if over and over again.
When a client disconnects, set the flag again so that we try to
accecpt new connections again.

See #1305
2021-06-18 15:26:20 +02:00
Wim Taymans
22b5b6b120 connection: make sure we don't overrun the fd array
Do some checks on the fd array and error out when we would overrun.
2021-06-18 15:26:20 +02:00
Wim Taymans
adee3d79b9 connection: handle truncated control data
We can't recover from truncated control data so return a fatal error
that should stop the client. Truncated control data can happen when
there are no more fds available, for example.

See #1305
2021-06-18 15:26:20 +02:00
Michal Vasilek
a870af02f0 module-rt: define RLIMIT_RTTIME if not defined
older versions of musl libc (before 1.2) don't define RLIMIT_RTTIME
2021-06-18 09:03:46 +00:00
Arun Raghavan
3272940731 echo-cancel: Don't use application name for stream node name
This is not too useful while looking at pipeline graphs, etc. We will
likely want to expand this to also include the module id or something to
distinguish multiple echo-cancel instances (which we can currently do
via the factory ID).
2021-06-17 17:04:35 -04:00
Wim Taymans
3944687a14 module-protocol-simple: limit to 10 connections
Like in pulseaudio.
2021-06-17 18:37:04 +02:00
Wim Taymans
38c721993f pulse-server: limit the amount of connections
Set to 64, like pulseaudio. We might want to configure this.

See #1305
2021-06-17 18:36:28 +02:00
Wim Taymans
d8ad87fd09 context: improve settings and defaults
Make structure with defaults that holds the defaults as they are loaded
from the config file or initialized with default values.

Copy this structure to a settings version that is used at runtime.

Add a force-quantum and force-rate field in the settings that can be
used to force a quantum and samplerate if != 0.
2021-06-17 11:11:45 +02:00
Barnabás Pőcze
bbbf5724be pipewire: module-zeroconf-discover: free correct pointer
Retrieve the pointer returned by `calloc()` and free that
instead of freeing the pointer to a member. This has worked
so far because as of yet `api` is the first member of the struct.
2021-06-16 17:39:25 +00:00
Barnabás Pőcze
58e254ec63 pulse-server: module-zeroconf-publish: remove unnecessary emit
Since !737 it is not required of modules to emit the "loaded"
event if they can load immediately, therefore remove the
unnecessary `module_emit_loaded()` call.

Furthermore remove redundant log messages as well.
2021-06-16 16:40:57 +02:00
Wim Taymans
f43c57afdb pulse-server: add context listener last
Add if after we have done everything else because if there is an
error we don't remove it and there will be an invalid hook registered
in the context.
2021-06-16 12:17:39 +02:00
Wim Taymans
22bb2666c4 metadata: remove metadata when the global is removed
So that we can ensure the metadata only contains valid subject
ids.
2021-06-16 12:17:35 +02:00
Wim Taymans
f15d585f8d metadata: check M permissions before changing metadata
To change a metadata, we need to be able to read the subject and also
have the M permission on it.
2021-06-16 12:17:25 +02:00
Wim Taymans
9d9e3f2d23 metadata: add client-id to properties
Add the client that owns the metadata to the properties.
2021-06-16 12:17:20 +02:00
Sanchayan Maity
96c77e1f2f pulse-server: Implement module-pipe-source 2021-06-16 08:05:51 +00:00
Sanchayan Maity
d5ee0ad8cc module-pipe-sink: Fix usage of spa_strerror
spa_strerror() works with negative error codes and async spa results.
2021-06-16 13:30:48 +05:30
Sanchayan Maity
4be1981f54 module-protocol-pulse: Clean up unused #define ERROR_RETURN 2021-06-15 10:54:48 +05:30
Wim Taymans
b6559289f1 pulse-server: fix compilation on some compilers 2021-06-14 15:43:32 +02:00
Wim Taymans
1bc383a7b7 pipewire-pulse: also store format/channels for sources 2021-06-12 20:30:49 +02:00
Wim Taymans
ba402209ba pulse-server: use PulseAudio name for format and channels
Use the pulseaudio names for the format and channels, like the real
pulseaudio.
2021-06-12 20:29:51 +02:00
Sanchayan Maity
cf93fd7f9a module-protocol-pulse: Add Avahi zeroconf publish module 2021-06-12 17:56:49 +00:00
Sanchayan Maity
e66125ede0 module-protocol-pulse: Factor out some common code
Factor out some of the common code that will be required for zeroconf
support next.
2021-06-12 17:56:49 +00:00
Barnabás Pőcze
bd6f63fecd pulse-server: improve module loading
Modules no longer need to emit the "loaded" event manually
if they can load immediately. In that case, the module loading
code will take care of emitting the event. If they can't,
they must return an async spa result, and emit the "loaded" event
when they see fit.

Fixes #1232
2021-06-11 20:50:30 +02:00
Barnabás Pőcze
4d02233ff3 pulse-server: don't broadcast remove event when a module wasn't loaded 2021-06-11 20:50:30 +02:00
Barnabás Pőcze
f26358e958 pulse-server: module-simple-protocol-tcp: remove unnecessary struct member 2021-06-11 20:50:30 +02:00
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
Peter Hutterer
5cf3c28fa4 config.h is a local header, not a system one
Change the #include accordingly, that's what we use in the rest of the tree
too.
2021-06-10 09:04:16 +10:00
Peter Hutterer
da339c286f meson.build: drop HAVE_CONFIG_H
This is an autotools leftover, with meson we're always guaranteed to have
the config.h file.
2021-06-10 09:04:16 +10:00
Peter Hutterer
0054319d88 meson.build: add -D_GNU_SOURCE to the project arguments
This appends it to every compilation command so we can get rid of the c_args
for (almost all) executables.
2021-06-09 07:47:51 +00:00
Wim Taymans
1f85d06317 module-adapter: clear bound-resource when destroyed
So that we don't reference it anymore or try to remove the listener.
2021-06-07 12:57:09 +02:00
Barnabás Pőcze
b6c6a21747 pipewire: module-adapter: remove resource listener
Unregister the resource listener when the node is going
away to avoid use-after-free issues.

Fixes #1276
2021-06-07 10:54:19 +00: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
Arun Raghavan
d2d0375c39 module-echo-cancel: Change extension .cc to .cpp for aec-webrtc
Makes this consistent with the rest of the code base.
2021-06-02 18:26:19 -04:00
Arun Raghavan
d95870d8d3 module-echo-cancel: Wire up the webrtc echo canceller
Mostly uses the existing infrastructure, but the webrtc canceller has a
fixed blocksize, so we:

  1. Use the canceller blocksize if configured
  2. Accumulate output data in a ringbuffer
  3. Push out the data in the required chunk size
2021-06-02 17:56:40 -04:00
Arun Raghavan
1349d5334d module-echo-cancel: Drop buffers on overruns
Without this, if we do overrun, we'll never catch this.
2021-06-02 12:50:16 -04:00
Arun Raghavan
bbae1adda0 module-echo-cancel: Separate input gathering and output processing
This aggregates buffers from the capture stream and the sink in the
corresponding process callbacks, and runs processing based on the
desired resampler rate if there is one.

We allow the ringbuffer in which we capture buffers to grow to some
extent, as that seems to be required for playback to occur smoothly.
Whether this is hiding some other underlying problem likely needs
investigation.
2021-06-02 12:46:12 -04:00