Commit graph

2818 commits

Author SHA1 Message Date
Wim Taymans
03d11953a6 module-rtp: handle state of stream better
Don't try to read packets when the data port or stream is not
ready.
Don't send packets when the data port is not ready or the stream
is paused.
2023-03-09 13:14:21 +01:00
Wim Taymans
bf9236ec8d module-rtp: improve node name and description
Don't auto connect audio either. There are more meant as source/sink
pairs.
2023-03-09 13:14:21 +01:00
Wim Taymans
fcac5298b9 module-rtp: add and check session parameters
Only allow compatible sessions.
2023-03-09 13:14:21 +01:00
Wim Taymans
4dc3e0d967 module-rtp: add audio params to avahi txt 2023-03-09 13:14:21 +01:00
Wim Taymans
4507f7ab39 module-rtp: only create sessions with avahi 2023-03-09 13:14:21 +01:00
Wim Taymans
432f927da9 module-rtp: listen only for compatible sessions 2023-03-09 13:14:21 +01:00
Wim Taymans
4937da471f module-rtp: listen to all available session types 2023-03-09 13:14:21 +01:00
Wim Taymans
4ee9696548 module-rtp: improve session setup 2023-03-09 13:14:21 +01:00
Wim Taymans
94b67603e5 module-rtp: improve session setup 2023-03-09 13:14:21 +01:00
Wim Taymans
dda5ed696b module-rtp: fix sender timestamps 2023-03-09 13:14:21 +01:00
Wim Taymans
7c04b42e38 module-rtp: improve properties 2023-03-09 13:14:21 +01:00
Wim Taymans
3badf6f3ac module-rtp: move avahi in rtp-session
It needs to be there because we need to be able to relate
zeroconf entries to udp connections.
2023-03-09 13:14:21 +01:00
Wim Taymans
7da031c969 module-rtp: add new rtp-session module
The module uses the apple session setup for managing peer connections.

Make a generic rtp stream object, make midi and audio implementations.
2023-03-09 13:14:21 +01:00
Wim Taymans
2c4bd25a89 pulse-server: fix comments
128/48000 = 0.002666... so rounding to 2.7ms is more accurate.
2023-03-08 12:53:22 +01:00
Wim Taymans
ddbb54fd6f pulse-server: reduce min quantum to 128/48000
some games want 5ms latency and the 256/48000 previous min value was
5.3ms and just a little too high, reduce this because we probably can.
2023-03-08 11:10:39 +01:00
Wim Taymans
af91ae67de module-echo-cancel: improve docs 2023-03-08 09:58:21 +01:00
Wim Taymans
ee6866a947 pulse-server: add doc about pulse.cmd section 2023-03-08 09:28:44 +01:00
Wim Taymans
dd80b76cb0 pulse-server: escape module values
We need to unescape the module argument values, just like pulseaudio
does.  We might end up with invalid escape sequences for the JSON
parser.

Fixes #3071
2023-03-07 13:15:49 +01:00
Wim Taymans
7a923bc204 module-rtp-sink: use sess.media for media type
media.type is already taken.
2023-03-05 19:12:14 +01:00
Wim Taymans
a21da3802b client-node: the id must be strictly smaller than MAX_AREAS
.. or else it points past the allocated array.
2023-03-04 20:40:48 +01:00
Robert Rosengren
57a89e5723 module-rtp: Add configurable DSCP support
Add configurable DSCP support with the net.dscp option. Applying only on
RTP, not on SAP discovery.
2023-03-03 15:13:37 +00:00
Wim Taymans
5ab1d898ca impl-port: improve port properties
Move the port property logic from the adapter to the port itself.

The port was already doing some of the same work as a fallback but can
just as well do everything. This also makes things more unified when
there is no adapter used.
2023-03-02 12:35:11 +01:00
Wim Taymans
ab94a71e3c pulse-server: improve channel_map parsing
Add some more common channel name shortcuts supported by pulseaudio.
Make sure we match the full channel-name, not just the prefix.
Generate an invalid channel map when an invalid channel name was
given instead of a partial channel map.
2023-03-01 13:44:24 +01:00
Wim Taymans
8a24f58cd1 pulse-server: improve format parsing
The pulseaudio format should be parsed case insensitive.
Add some more pulseaudio supported formats.
2023-03-01 13:44:24 +01:00
Wim Taymans
03abce72e5 pulse-server: error on invalid format
When an invalid format is given as a module argument, generate an error.
2023-03-01 13:44:24 +01:00
Barnabás Pőcze
d776d378cd pipewire: module-protocol-simple: cast argument of accept4()
With glibc omitting the cast does not trigger a warning because
glibc uses GCC's `transparent_union` attribute. musl does not
do that, so to avoid getting warnings there, add the cast.

https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#index-transparent_005funion-type-attribute
2023-02-25 20:21:45 +01:00
Wim Taymans
eb797cac48 pulse-server: improve FIX_ flag handling
When a stream uses the FIX_ flags it should negotiate to the format of
the sink or source it connects to. To do this, look up the sink or
source and look at the format, use this as the allowed format for the
stream when the FIX flags are set.

Make it still possible to override with with properties. Use
audio.position to make it possible to set a channelmap override.
2023-02-23 12:53:58 +01:00
Wim Taymans
ad6ab7e0b7 pulse-server: refactor channel position parsing 2023-02-23 12:39:36 +01:00
Wim Taymans
c74efea51e pulse-server: pass format to the null-sink
The effect is that the null-sink will report the given format in the
Sample Specification, which is what some applications might expect when
they pass a format parameter.
2023-02-23 10:34:07 +01:00
Wim Taymans
d11f8d5dea pulse-server: move fix function to format functions 2023-02-23 09:23:32 +01:00
Wim Taymans
4163991a97 pulse-server: use pulse.fix.* keys
Use a different key than the usual one to select an audio format when we
are fixating a stream format to avoid confusion.

So pulse.fix.rate, pulse.fix.format, pulse.fix.channels are now used to
force a specific format when the stream has the FIX_ stream flags.
2023-02-23 09:23:32 +01:00
Wim Taymans
d28990af34 pulse-server: add support for overriding fix format
Add support for using custom format, rate or channels when the streams
asks to fix those parameters for us.

Some streams might expect to see S16LE when they connect to a sink in
S16LE when the FIX_FORMAT flag is set but this is not the case in
PipeWire because the audio DSP pipeline works in F32, and so F32 is
choosen. Make it possible to use a pulse.rule with a audio.format
property to control this.
2023-02-22 18:11:52 +01:00
Wim Taymans
84eafcd12f pulse-server: fix return value 2023-02-22 18:03:07 +01:00
Wim Taymans
4e298f2fe7 pipewire: add pw_random()
Make pw_getrandom() more usable by handling the EINTR case and returning
< 0 when there was an error or not enough random data was available.

Make a new pw_random() function that uses pw_getrandom() but falls back
to a pseudo random number generator otherwise. This pseudo random number
generator is seeded with either data from the urandom source or from the
current time when pipewire is initialized.

In most cases where crytographic security is not required pw_random()
should be easier to use.
2023-02-22 15:27:27 +01:00
Wim Taymans
1c9ffef813 module-rtp: reset ringbuffer on resync 2023-02-17 15:38:11 +01:00
Wim Taymans
8eaf46a678 module-rtp: add rate matching for the source
correlate the timestamps against the graph clock and calculate a rate
correction. this smooths out the timestamps.
2023-02-17 11:23:51 +01:00
Wim Taymans
fbd068977c module-rtp: Add rtp-midi support
Add rtp-midi support with the media.type = midi option
2023-02-16 16:47:29 +01:00
Barnabás Pőcze
934ab3036e treewide: use SPDX tags to specify copyright information
SPDX tags make the licensing information easy to understand and clear,
and they are machine parseable.

See https://spdx.dev for more information.
2023-02-16 10:54:48 +00:00
Wim Taymans
965b220206 module-rtp: clear ringbuffer in resync
When we resync to the timestamp, clear the ringbuffer to avoid playing
old stale samples.
2023-02-15 11:08:08 +01:00
Wim Taymans
aa3b776f6f module-rtp: resync after paused state
After the paused state, resync to the new clock time.
2023-02-15 11:06:01 +01:00
Niklāvs Koļesņikovs
5e0bfa0beb
RLIMITs: add support for generating limits.d files
This commit implements generating /etc/security/limits.d/20-pw-defaults.conf and
/etc/security/limits.d/25-pw-rlimits.conf files. The numbering is arbitrary and
may very well warrant being in the reverse order, however `man 5 limits.conf`
does not appear to specify the parsing order or even say exactly how multiples
matches will resolve, so the value can be adjusted later, if required.

The actual limit values, the match rule and even whether each file is to be
installed can be changed via the build system before compilation. Likewise
the files can be modified or (re)moved during distro package building phase.

The 20-pw-defaults.conf should only be installed on legacy systems lacking both
a modern kernel and up to date systemd, because all it does is set the current
Linux default. Accordingly its not installed by default.

Signed-off-by: Niklāvs Koļesņikovs <89q1r14hd@relay.firefox.com>
2023-02-14 17:37:59 +02:00
Niklāvs Koļesņikovs
d082ec0809
src/modules/meson.build: fix indentation and remove obsolete comment
Signed-off-by: Niklāvs Koļesņikovs <89q1r14hd@relay.firefox.com>
2023-02-14 17:37:59 +02:00
Wim Taymans
344be779b1 filter-chain: support single copy plugin
When input and output are linked with a copy function, don't disable the
node but add it to the valid graph inputs.
2023-02-07 14:14:55 +01:00
Wim Taymans
72242dc91f filter-chain: add invert plugin
To invert the polarity of a signal.

See #3008
2023-02-07 13:46:06 +01:00
Wim Taymans
fda829a1fa conf: fixup config comments
Use () to mark optional fields to avoid confusion with [] for arrays.
Add contition fields where available.
2023-02-07 10:35:43 +01:00
Thomas Weißschuh
4f9f32084c module-combine-stream: add missing proxy event version 2023-02-06 06:07:13 +00:00
Frédéric Simonis
04e769ff35 Add source example for the loopback module 2023-02-02 19:10:42 +00:00
Wim Taymans
7e2dab876a module-rtp-sink: handle buffer offset and size correctly 2023-02-02 16:08:40 +01:00
Wim Taymans
aed394cf89 module-rtp: use timestamps as ringbuffer index
Use the timestamps directly as the ringbuffer index. We can save some
conversions to bytes and there is a direct mapping to RTP timestamp,
clock position and ringbuffer index.

Simplify the source a little. Remove the buffering state, we always
start with read and write pointers separted by the target buffering.
2023-02-02 15:54:53 +01:00
Wim Taymans
16e995be26 module-rtp: remove some useless debug 2023-02-02 12:12:01 +01:00