Commit graph

2818 commits

Author SHA1 Message Date
Jonas Holmberg
1a44689d3f module-loopback: Disconnect streams before destroying
Disconnect both streams before destroying any of them so that
playback_process() doesn't get called after the capture stream has been
destroyed.
2022-09-26 16:47:33 +02:00
Wim Taymans
e0d1be32fd pulse-server: don't read more than requested size
When we underrun, don't try to read more than what was requested
even if there is more in the ringbuffer.
2022-09-26 13:30:39 +02:00
Wim Taymans
78bfdd1717 raop: use pw_strip to string header values 2022-09-26 09:31:55 +02:00
Sebastian Koenig
fa20fb2e80 rtsp-client: remove trailing whitespace from header data
Some clients may send headers with trailing whitespace, which can upset
subsequent parsing of the data into numbers.  This patch removes such trailing
whitespace before further processing the header data.
2022-09-26 07:20:27 +00:00
Sebastian Koenig
fd66fb8867 raop: add support for ALAC codec
Some Airplay devices announce themselves as using the ALAC (Apple Lossless Audio
Codec) format, while pipewire only supports the PCM codec.  A look at the
Pulseaudio RAOP reveals that ALAC is supported there, but the encoding looks
exactly like what pipewire does for PCM.  This patch adds support for ALAC, but
it uses the existing PCM infrastructure to send the audio data.
2022-09-26 07:16:52 +00:00
Demi Marie Obenour
c1920163d5 Fix calls to sendmsg()
Align cmsg buffers properly and use MSG_NOSIGNAL.
2022-09-23 16:33:36 +00:00
Demi Marie Obenour
671a7102ff Fix some badly-behaved macros
Some macros evaluated their arguments more than once when it was not
needed, or were missing parentheses.
2022-09-23 11:39:33 -04:00
Demi Marie Obenour
bb4f274ae0 Make all fopen() calls use O_CLOEXEC
by adding "e" to the mode strings.
2022-09-23 15:19:01 +00:00
Demi Marie Obenour
400860f63c Add <stdint.h> includes
This is to make the headers standalone.
2022-09-23 15:19:01 +00:00
Wim Taymans
e0614246f5 pulse-server: set fragsize as latency
Reducing the latency is just papering over the issue in #2702. The
real fix is to limit the blocksize to the fragsize like what is done
in 00a234daf2

Reducing the latency then also causes regressions like #2715 so don't
do that anymore.

Fixes #2715
2022-09-22 11:58:14 +02:00
Wim Taymans
47f2b72088 pulse-server: don't overwrite previous towrite value
And actually take the MAX_BLOCK into account when writing samples to a
client.
2022-09-21 12:00:36 +02:00
Wim Taymans
00a234daf2 pulse-server: limit capture blocks to fragsize
Don't send larger chunks than the fragsize. Some clients don't like
this. Also checked with #2418.

Fixes #2711
2022-09-21 11:34:13 +02:00
Wim Taymans
bd584ca8c0 pulse-server: ignore adjust-latency for capture
Don't update the fragsize, it breaks #2418 again.
2022-09-21 11:34:13 +02:00
Wim Taymans
0ce95e69fd pulse-server: adjust_latency should update the fragsize
Rename MAX_FRAGSIZE to MAX_BLOCK because it does not really limit the
fragsize, just the amount of data we can send in one block.

See #2711
2022-09-20 13:24:30 +02:00
Wim Taymans
3faca67ffe filter-chain: instantiate the nodes when rate is known
Instantiate the graph nodes when the samplerate is known instead of
using a fixed samplerate of 48KHz.

Warn when the convolver samplerate does not match the graph rate. We
might want to resample the IR later.
2022-09-20 11:16:51 +02:00
Wim Taymans
6b6cd85e54 filter-chain: move debug to fastpath 2022-09-19 17:03:34 +02:00
Wim Taymans
772a12acb7 filter-chain: ref the node handle location
Use a reference to the location in the node where the handle of the
plugin can be found. That way we can change the handle only in the
node and have it changed everywhere else.
2022-09-19 15:20:59 +02:00
Wim Taymans
ac67475e64 filter-chain: move data allocation out of the link loop
The port data allocation does not depend on the links so move it
out of the loop.
2022-09-19 15:17:49 +02:00
Wim Taymans
d1cd199f16 pulse-server: set record latency as fragsize / 2
The record latency is set to fragsize / 2 by pulseaudio, so do the
same in pipewire.

Fixes #2702
2022-09-19 14:45:11 +02:00
Wim Taymans
94336cb2c9 module: use resample.prefill for coupled streams
So that we always process one complete input buffer as an output
buffer without keeping leftovers in the resampler.
2022-09-19 12:51:14 +02:00
Wim Taymans
d48627d0e7 module-loopback: use trigger to start processing
Move process to playback_process and use trigger from the capture
side to start processing. This ensures the requested size is updated.
2022-09-19 12:34:00 +02:00
Wim Taymans
8a39b22e25 filter-chain: use trigger to start processing
Add a process_playback function and use _trigger in the process_capture
to start processing. This ensure that the requested size is updated
before calling the process function.
2022-09-19 12:14:52 +02:00
Wim Taymans
4b16eee27a module-raop-sink: add more docs 2022-09-13 12:10:48 +02:00
Wim Taymans
5e890925a0 module-echo-cancel: don't load newer modules
Add some version comments for the new AEC methods
2022-09-13 09:44:36 +02:00
Jonas Holmberg
70471989e5 module-echo-cancel: Add activate/deactivate methods
Add methods activate() that is called before first call to run() when
stream starts and deactivate() that is called after last call to run()
when stream stops. This makes it possible for aec-plugins to reset their
state between streams.
2022-09-12 18:24:07 +00:00
Wim Taymans
c00e0e3467 filter-chain: handle port names with :
When a port name contains a ':' we will try to split it and use the part
before the colon as the node name, which will then fail.

If we can't find a node name after splitting, try again by assuming the
colon is part of the port name.

Fixes control port names such as "Ratio (1:n)" in #2685
2022-09-12 09:51:28 +02:00
Wim Taymans
fcff48f1f1 filter-chain: warn when control contains unknown port name
When the config control entry contains an unknown port name, log
a warning instead of silently ignoring it,

See #2685
2022-09-12 09:51:28 +02:00
Wim Taymans
56b03cb3a8 pulse-server: update requested for relative seek only
PulseAudio only updates the requested amount of bytes for relative
seeks, do the same.

See #2680
2022-09-10 16:06:45 +02:00
Wim Taymans
633f9c2d5e module-rt: only call set_rlimit once
We can call this once after we know that we can use RTKit to get
the limits or not.
2022-09-09 15:27:26 +02:00
Barnabás Pőcze
e9b5cc405e pipewire: rtsp-client: read message content properly
Make the receiving state machine more pronounced by explicitly storing
the state in the client. Furthermore, always consume the message content
if there is one and not only if the content type is "application/octet-stream",
but do not try to do it at once - like previously, instead only as the
socket becomes readable. The body is currently dropped, but it could
easily be collected in e.g. a `pw_array` should the need ever arise.

See #2673
2022-09-09 01:47:51 +02:00
Barnabás Pőcze
9b63c5011d pipewire: rtsp-client: check if the status code code is a number 2022-09-09 01:47:51 +02:00
Barnabás Pőcze
56df6fed13 pipewire: rtsp-client: reset receive state when connected
Previously, the state used to receive messages from the remote
end was not reset when the client connected, which could
lead to issues if the same client is reused for multiple
connections.
2022-09-09 01:47:51 +02:00
Barnabás Pőcze
2d7eb8678b pipewire: rtsp-client: allow sending arbitrary binary data
Previously, the content had to be a null-terminated byte
sequence because the sending function used `strlen()` to
determine its length. However, `rtsp_do_auth_setup()` needs
to send a non-textual byte sequence, and it only worked so
far because it did not happen to have any zero bytes in it.
Add a "content_length" parameter and change the type of
"content" to facilitate sending arbitrary byte sequences.
2022-09-09 01:47:51 +02:00
Barnabás Pőcze
e5ca5d0480 pipewire: rtsp-client: use tabs for indentation 2022-09-09 01:47:51 +02:00
Barnabás Pőcze
56c4aca5d9 pipewire: rtsp-client: remove unused "session" member 2022-09-09 01:47:51 +02:00
Barnabás Pőcze
36589039f4 pipewire: rtsp-client: make request CSeq uint32_t 2022-09-09 01:47:51 +02:00
Barnabás Pőcze
4bb8efd100 pipewire: module-raop-sink: simplify rtsp_do_auth_setup()
Rename "output" to "content" and mark it static and const,
and remove the "ret" variable.
2022-09-09 01:47:51 +02:00
Maxim Mikityanskiy
853a1c0ba8 module-rt: Fix setting realtime priority with rtkit
The commit cited below mistakenly removed the set_rlimit call from under
`if (impl->use_rtkit)`, saying it doesn't have an rtkit implementation.
However, this function does call rtkit, so it has to be called in the
rtkit flow, otherwise pipewire fails to set the realtime priority,
printing the following error message:

mod.rt: RTKit error: org.freedesktop.DBus.Error.AccessDenied
mod.rt: could not make thread #### realtime using RTKit: Permission denied

Fixes: 5ae1c03d77 ("module-rt: small fixes")
2022-09-08 20:03:56 +03:00
Barnabás Pőcze
27211856eb pulse-server: Handle overlong writes from clients
When a client writes more then requested, let the requested field go
negative so that it is taken into account the next time we ask for more
data.

Also the requested field follows the difference in the write pointer
caused by seeks.

See #2626
Fixes #2674
2022-09-08 09:14:19 +02:00
Wim Taymans
d5bc6aa2cb Revert "pulse-server: Handle clients that send more than requested"
This reverts commit a79b5c86ea.
2022-09-08 09:06:02 +02:00
Wim Taymans
a79b5c86ea pulse-server: Handle clients that send more than requested
A client can sometimes send more data than we requested. PulseAudio
keeps the extra data around, it just asks for more data when it consumed
some of it.

PipeWire however always tries to keep tlength worth of data, as
specified in the PulseAudio docs... Keep track of how much extra data
has been sent and keep this around as well. Make sure we flush this
extra data as well.

Fixes #2626
2022-09-07 13:07:28 +02:00
Wim Taymans
50f76c8730 pulse-server: implement TRIGGER and PREBUF methods
Start and stop prebuf.
2022-09-07 13:02:55 +02:00
Wim Taymans
305f2104ee pulse-server: rework buffer attributes
Move the latency fraction calculation to fix_ functions so that the
new latency rate can be used when creating the streams.
Actually set the requested record attributes on the stream instead
of modifying the defaults.

See #2671
2022-09-06 11:53:51 +02:00
Wim Taymans
1a915c2ced pulse-server: set record attributes more like PulseAudio
PulseAudio assigns half of the fragsize to the source latency.
PulseAudio sends in chunks up to a fixed limit.

Checked against #2418
2022-09-05 18:13:12 +02:00
Wim Taymans
ad06db91ee Revert "pulse-server: send chunks with half the fragsize"
This reverts commit e10305851d.

If causes some regressions: see #2671
2022-09-05 16:19:42 +02:00
Wim Taymans
83e83608c8 Revert "pulse-server: tweak the fragsize/minreq handling"
This reverts commit ad214dde2e.
2022-09-05 16:18:54 +02:00
Wim Taymans
009ab9681d Revert "pulse-server: simplify latency handling"
This reverts commit 9c34a923db.
2022-09-05 16:18:45 +02:00
Wim Taymans
72ce2f815b Revert "pulse-server: enforce minfrag after latency adjust"
This reverts commit b70f32a259.
2022-09-05 16:18:34 +02:00
Wim Taymans
b70f32a259 pulse-server: enforce minfrag after latency adjust 2022-09-03 13:07:09 +02:00
souravdas142
0079a1d5bc filter-chain: use right lv2 include path for some older distros also
3f6fe392 uses headers from /usr/include/lv2/atom/. but this leads compilation
    failure for some distros (i.e. ubuntu 18.04) as they have some
    different location for these headers. One can find these headers
    at /usr/include/lv2/lv2plug.in/ns/ext/atom/ (for ubuntu 18.04)
    instead /usr/include/lv2/atom/. So guard them with __has_include.
    and mention other possibilities.

    Fixes #2670
2022-09-03 13:14:00 +05:30