Commit graph

5091 commits

Author SHA1 Message Date
Wim Taymans
6fda8212e7 impl-node: refactor pause_node
Rename pause_node to idle_node and only perform the pause when
pause_on_idle is active.
2022-09-23 17:02:01 +02:00
Wim Taymans
69e6db5216 impl-node: only pause pause_on_idle nodes
When we are starting a node and need to cancel it, only set the node
to the paused state when pause_on_idle is set. Use the pause_node
function to make sure everything is in the paused state.

Otherwise we would send a Pause command to the node but because it was
still added to the graph we would continue to call the process function
on it.

Fixes #2701
2022-09-23 16:58:15 +02:00
Wim Taymans
7c93c29cfd add some more debug 2022-09-23 16:48:40 +02:00
Wim Taymans
9119e8a26e improve debug 2022-09-23 15:14:50 +02: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
000a6608cf context: suspend all nodes when doing rate change
Suspend all nodes of the driver, even if the driver is already
suspended.

The suspend command makes sure that all nodes renegotiate to the new
graph rate.

This fixes the following sequence of events:

1. Play 44.1KHz file to loopback sink
2. Sink switches to 44.1, negotiates to 44.1
3. Loopback input and output streams negotiate to 44.1. All is good.
4. Stop playback, wait 5 seconds
5. Sink suspends, loopback input suspends (output stream doesn't suspend)
6. Play 48KHz file
7. Sink switches to 48, negotiates to 48. Sink (and followers) don't
   suspend because sink was already suspended.
8. loopback input negotiates to 48, output stays at 44.1 -> failure

This patch fixes step 7. where it now tries to suspend all followers
even when the driver was already suspended. This then ensures that all
followers will try to negotiate to the new driver rate.
2022-09-20 10:56:31 +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
893c5aab4d stream: update requested size before calling process
We always need to update the latest requested size for output streams
before calling process. If there are no buffers or no suggestion, let
the audioconvert make one before we try again.

This way we always get the most recent requested size.
2022-09-19 12:02:14 +02:00
Wim Taymans
bdfbce8939 pw-cli: don't keep doing syncs in monitor mode
In monitor mode, we only need one sync to get the prompt and then we
just wait until we need to stop. There is no need to keep on syncing
because it consumes a lot of CPU.

Patch by Hiero32

Fixes #2709
2022-09-19 10:57:49 +02:00
Wim Taymans
9755cb9083 examples: add capture from monitor option 2022-09-16 11:38:44 +02:00
Wim Taymans
92deb1d868 example: improve volume meter output 2022-09-15 16:35:44 +02:00
Wim Taymans
01fedfb9cd examples: add audio capture example 2022-09-15 16:05:15 +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
Jonas Holmberg
70c314f254 pw-top: Print microseconds as "us"
Avoid unicode characters in the columns since it breaks formatting on
non-unicode hosts.
2022-09-08 16:31:48 +02:00
Wim Taymans
900621ba9e impl-node: only activate input links after adding node
Only activate the input links to a node after the node has been added to
the graph.

This ensure that we don't accidentaly schedule the node before the Start
command has completed and the node is actually ready to process data.
2022-09-08 11:18:08 +02:00
Wim Taymans
ff84acdf3d impl-node: avoid scheduling the node before added
The Start command might be async and we should not schedule the node
until the reply has arrived and we have actually added the node to
the graph.

Otherwise it is possible that the node is scheduled before it could
complete the start command. This could be a problem for adapter because
it does negotiation and so on in the Start call.

See #2677
2022-09-08 10:31:46 +02: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
75af02edcd stream: add Format and EnumFormat on stream nodes
The stream only has one format/enumformat list for the one port it has
so also expose this on the node. We can then remove the adapter for
video.

We can also now show midi (control) streams as the format in pw-top.
2022-09-06 20:42:19 +02:00
Wim Taymans
32421965c7 stream: add a video adapter for video streams
The vidweo adapter is in passthrough but allows us to query the
node for the formats, which then show up in pw-top.
2022-09-06 19:06:10 +02:00
Wim Taymans
e9b7667b55 pw-top: remove some slashes to avoid confusion
Update man page
2022-09-06 18:32:56 +02:00
Wim Taymans
76631e6251 pw-top: show negotiated formats
Add a column with negotiated formats.
It requires an adapter that will enumerate the port formats so it does
not work for video streams yet.

Fixes #2566
2022-09-06 15:36:58 +02:00