Commit graph

2490 commits

Author SHA1 Message Date
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
Wim Taymans
b50fa83325 module-rtp-sink: improve sync
Always write to index of the clock, not just for the first packet.
This ensure the timestamp on the packet always matches the time it was
processed in the graph.
2023-02-01 20:06:19 +01:00
Wim Taymans
1a5de467db module-rtp: support direct clock timestamps
Always use the timestamp of the graph clock for RTP packets. Add an
option to apply a random or fixed offset.
Add a ts-refclk option on the sender to specify a reference clock to
use for timestamping. This will activate the direct timestamp mode and
signal this in the SDP.

Parse ts-refclk and ts-offset from the SDP. Make it possible to match
them in rules. Add option to activate the direct-timestamp, where the
rate matching is disabled and the timestamps are used directly for
writing and reading from the ringbuffer using the graph clock.

This makes it possible to set a PTP clock on sink and source and avoid
rate matching by using a shared clock.
2023-02-01 18:31:33 +01:00
Dmitry Sharshakov
e4f4ef9e1c filter-chain: fix spatializer rate changes 2023-01-30 22:44:55 +03:00
Barnabás Pőcze
b931f53783 filter-chain: review comments 2023-01-30 22:02:48 +03:00
Wim Taymans
05048a2d9d filtet-chain: fix compilation without sofa 2023-01-30 21:43:07 +03:00
Dmitry Sharshakov
a5d15ff16a filter-chain: fix warning 2023-01-30 21:12:06 +03:00
Wim Taymans
6539535176 filter-chain: remove mutex
We only ever load the IR from the main thread so we don't need a lock.
2023-01-30 21:07:06 +03:00
Wim Taymans
42a40e07d7 filter-chain: make sofa changes lockfree
Use the control changes to load a new IR, then signal to data thread to
use the new IR. In the data thread, signal the main thread to free the old
IR after we swapped it out.

THis moves all allocations from the data thread into the main thread.
2023-01-30 21:07:06 +03:00
Wim Taymans
63002bfcee filter-chain: add method to notify control changes 2023-01-30 21:07:06 +03:00
Dmitry Sharshakov
cf09077705 spatializer: free old convolvers immediately
We shouldn't need them anymore
2023-01-30 21:07:06 +03:00
Dmitry Sharshakov
9a3bf1a6de spatializer: interpolate IRs
Fixes clicking
2023-01-30 21:07:06 +03:00
Dmitry Sharshakov
9399fc318e spatializer: move to sofa_plugin 2023-01-30 21:07:06 +03:00
Dmitry Sharshakov
8677cb2fdf spatializer: do not initialize convolvers in init
Ports are not accessible during init, so this is pointless
2023-01-30 21:07:06 +03:00
Dmitry Sharshakov
7977755dd0 spatializer: move coords to control ports
Allows for simple cases with moveable sources
2023-01-30 21:07:06 +03:00
Dmitry Sharshakov
3e0dc2678b filter-chain: add spatializer
SOFA is a file format used for storing and accessing spatial audio data, namely head-related transfer functions. These can be used to create binaural spatial sound using head- or earphones.

This commit introduces libmysofa as an optional dependency for loading SOFA files and creates a spatializer plugin for the filter-chain

ci: install libmysofa-devel for full build

ci: bump FDO_DISTRIBUTION_TAG
2023-01-30 21:07:06 +03:00
Wim Taymans
ecf06935ba filter-chain: don't leak config 2023-01-30 11:57:56 +01:00
Wim Taymans
fab9d12a44 module-rtp-source: use simple boolean to check activity
Avoid doing clock_gettime for each RTP packet and use a simple boolean
to check if packets arrived since the last SAP timeout check.
2023-01-27 11:49:20 +01:00
Dmitry Sharshakov
7b3d02b7fa module-rtp-source: touch session on RTP
Don't time out while actually running
2023-01-27 10:35:44 +00:00
Dmitry Sharshakov
785694db31 module-rtp-source: close socket while idle
Reduce network bandwidth when many streams are present but not used
2023-01-27 10:35:44 +00:00
Dmitry Sharshakov
62766d8175 module-rtp-source: set custom channel names if available
Some AES67 devices set `i` attribute with necessary information
2023-01-27 10:35:44 +00:00
Wim Taymans
fba7083f8c modules: also install module-combine-stream 2023-01-26 11:57:45 +01:00
Wim Taymans
97dd95ddec module-rtp-source: increase SAP timeout some more
Some AES67 senders need more time.
2023-01-26 09:09:46 +01:00
Wim Taymans
6e99ccb73e module-rtp-source: increase overrun watermark a little
On Wifi we can get big bursts.
2023-01-25 17:23:52 +01:00
Wim Taymans
8d4f7df9d6 module-rtp-sink: use min-ptime and max-ptime
Use the MTU, min-ptime and max-ptime to calculate the packet size to
send.
2023-01-25 17:08:10 +01:00
Wim Taymans
9fb44c3a71 module-rtp-source: improve buffer handling
Try to keep half the packet size in the ringbuffer as well. This helps
us adapt to the packet size of the sender.

Drop samples from the ringbuffer for the first packet we read. This
makes us lock onto the stream with the exact requested latency.
2023-01-25 16:23:00 +01:00
Wim Taymans
80a6880f33 module-rtp-sink: add tool and ptime attributes 2023-01-25 16:22:18 +01:00
Wim Taymans
6a375d5778 module-rtp-source: add match rules
Add match rules so that one can select what SAP announcements to
listen to. Also make it possible to set per session latency.
2023-01-25 14:58:15 +01:00
Wim Taymans
64dca0b36d pipewire: add conf.h to standard includes
Also fix function signature so that it matched the .h file.
2023-01-25 13:23:44 +01:00