Commit graph

11174 commits

Author SHA1 Message Date
Wim Taymans
1ce94628ee client-node: rework mix_info
Use the port_set_mix_info to add and remove mix info information to the
client.

Previously it was impossible to clean up mix_info.

With this change we can also simplify the jack peer port detection.
Because the mix info is always sent before the link appears we can
simply look up the info when the link appears.
2023-06-22 11:59:39 +02:00
Wim Taymans
a6ebcc62db jack: set peer_port to NULL in mix 2023-06-22 11:59:19 +02:00
Michael Olbrich
e808875d60 alsa: improve audio output to multiple devices
There are currently several issues when multiple alsa devices are
involved.

For alsa devices that are followers, all data is written via
impl_node_process(). Currently spa_alsa_write() is only called if a new
buffer was queued.
It can happen that all buffers are in the ready list (queued by previous
calls but not yet written because there was no free space in the kernel
ring buffer). In this case writing stalls indefinitely.
To fix this, also call spa_alsa_write() if no new buffer is queued but
there are still buffers in the ready list.

If the ready list of the primary device is not empty then only this
device is handled because spa_alsa_write() is called directly. The other
devices make no progress during this interval.
The clock drift calculation works by comparing the alsa delay with the
expected delay since the last wakeup. This only work if the alsa
ringbuffer was filled completly. If the ready list contains a partial
buffer then the ringbuffer is not filled and the timing calculation
during the next wakeup is incorrect.

To fix all this, remove the special case for the non-empty ready list
and just call spa_node_call_ready() every time.
2023-06-22 09:28:44 +00:00
Wim Taymans
ad5ac964af module: disable resample when following graph rate
When we don't set a rate, assume both input and output streams are
following the graph rate and so disable the resampler.

This mostly works around an issue where the input and output could
negotiate to different rates in some cases. With the resampler disabled
this would still result in the same amount of samples going in as
comming out instead of a stuttering mismatch.

See #2969
2023-06-22 11:18:04 +02:00
Wim Taymans
3db3e6dacf Revert "module-loopback: request renegotiation when suspended"
This reverts commit 2c5a3e9593.

Causes problems when switching devices because it doesn't renegotiate
properly.
2023-06-22 10:09:16 +02:00
Wim Taymans
774af1487a Revert "audioadapter: renegotiate when EnumFormat changes"
This reverts commit b292e52740.

It is probably not a good idea to renegotiate right away, we should at
least wait until the node is started again.
2023-06-22 10:01:02 +02:00
Wim Taymans
74b6ab4288 remote-node: remove IO_Buffers before releasing the mix
This is usually done by the link but because we are a remote node, we
manage the links ourselves.
2023-06-21 18:38:21 +02:00
Wim Taymans
2c5a3e9593 module-loopback: request renegotiation when suspended
When one side of the loopback suspends, do a EnumFormat params to force
renegotiation on the other side as well.

Suppose this:

1. sink/filter/pw-play plays at 48000Hz
2. pw-play goes away, sink and filter-sink suspend, filter-playback
   idles
3. pw-play starts with 44100Hz
4. sink/filter-sink renegotiate to 44100Hz, filter-playback is still
   at 48000Hz and pitch shifted.

We might want to manually suspend the IDLE nodes instead but for now
this is a good workaround.

Fixes #2969
2023-06-21 16:29:45 +02:00
Wim Taymans
b292e52740 audioadapter: renegotiate when EnumFormat changes
Start renegotiation when EnumFormat changes.
2023-06-21 16:29:45 +02:00
Wim Taymans
c4c6a3fd1b Revert "module-loopback: request renegotiation when suspended"
This reverts commit bbf8f1a0c8.

This causes all kinds of things to go wrong, mostly failure to
renegotiate buffers. Needs more testing.
2023-06-21 15:58:49 +02:00
Wim Taymans
d24c8da5d2 stream: keep calling process when there is data
Don't only call the process function when we have a new buffer but also
when we still have something in the queue to process.
2023-06-21 15:34:16 +02:00
Wim Taymans
7a629fa378 impl-link: block some actions when destroyed
When we destroy a port, make sure we don't start to reactivate it
again.
2023-06-21 10:25:30 +02:00
Wim Taymans
1e4adff3fa impl-port: only add and remove the mix info once
Or we might crash.
2023-06-21 10:24:57 +02:00
Wim Taymans
265e6ca352 client-node: rename confusing id to mix_id
There is already an id in the port_mix structure that can be used to
index the mix structures in map if needed, the mix_id is the port_id of
the mixer and should not be confused.
2023-06-21 10:23:07 +02:00
Wim Taymans
85af2bdef2 jack: set peer_id correctly 2023-06-20 20:59:27 +02:00
Wim Taymans
44d2ba5276 impl-node: make node not-runnable when destroying
This avoid some links that are activated again when the node is
destroyed.
2023-06-20 20:46:20 +02:00
Wim Taymans
fd358c511d context: a node is runnable only when active
Also check if the node is active to decide if the node is runnable.
2023-06-20 20:45:42 +02:00
Wim Taymans
001f0656d4 remote-node: refactor init/create/ensure mix
Make a create_mix function that also takes the peer_id.
2023-06-20 19:24:38 +02:00
Wim Taymans
6806af954e impl-port: improve debug
Debug the mix port id as well.
2023-06-20 19:00:23 +02:00
Wim Taymans
9fa46af488 filter-chain: add link to biquad help page
Fixes #3257
2023-06-20 09:48:38 +02:00
Dmitry Sharshakov
4659bca609 pipewire-aes67: move the PTP driver to AES67 process 2023-06-20 06:51:30 +00:00
Dmitry Sharshakov
f257c3407d node-driver: allow specifying both PHC and ID 2023-06-20 06:51:30 +00:00
Dmitry Sharshakov
0fc1112c6d module-rtp-sap: get source.ip from network interface if not supplied 2023-06-20 06:51:30 +00:00
Dmitry Sharshakov
6581d4ee2a module-rtp-source: fix crash on stream deletion 2023-06-20 06:51:30 +00:00
Dmitry Sharshakov
991e3928d4 rtp-stream: do not set false ptime values 2023-06-20 06:51:30 +00:00
Dmitry Sharshakov
6d2b43b51c pipewire-aes67: improve default config
Ensure visibility in Dante Controller, improve SAP config

Co-authored-by: Sebastian Jaeckel <wose@zuendmasse.de>
2023-06-20 06:51:30 +00:00
Dmitry Sharshakov
024dc74e53 module-rtp-sap: bind transmission socket
Makes packets fly to correct interface
2023-06-20 06:51:30 +00:00
Wim Taymans
f2ba4caaf0 alsa: silence ctl probe errors
ALSA seems to emit some errors to stderr when the ctl can not be opened.
Silence those errors, we handle and log the result ourselves.
2023-06-19 17:20:57 +02:00
Wim Taymans
1589506c7c alsa: ratelimit impossible timeout messages 2023-06-19 16:58:29 +02:00
Wim Taymans
882df500b6 module-ffado: don't read/write twice
The process callbacks are called twice, once on graph start and once
on graph complete, make sure we only read in the right phase.
2023-06-19 16:43:56 +02:00
Wim Taymans
7805a454df module-jack: fix jack scheduling
Our sink and source callbacks are called twice, once when the graph
starts and once when it completes, make sure we don't signal the jack
graph twice or we get corrupted output.

Fixes #3255
2023-06-19 16:37:03 +02:00
Wim Taymans
3dbb865d6d module-node-factory: add option to export object
Add an option to export the node from the factory.

That way you can locally create a node from a factory and then export it
to the server. This is handy to make object in the server from a config
file using the node-factory.

See !1643
2023-06-19 12:41:30 +02:00
Wim Taymans
d321e9b93e core: ensure we don't remove and disconnect twice
Check for multiple recursive disconnect calls by checking the flags
before calling the pw_proxy methods. This ensure that calling disconnect
from one of the proxy removed callbacks does not trigger another
disconnect later on.
2023-06-19 12:31:46 +02:00
Wim Taymans
6fc9914431 jack: don't update srate/bufsize when there is a callback
When we have a callback installed but the bufsize/srate can not be
notified yet because the client is inactive, try again in the next
cycle.

Fixes #3297
2023-06-19 09:31:17 +02:00
Wim Taymans
946457d555 stream: add some docs 2023-06-18 17:13:34 +02:00
Wim Taymans
901388ae00 stream: PIPEWIRE_AUTOCONNECT env overrides config
Always make the env variable override any config setting.

See #3299
2023-06-18 17:09:15 +02:00
Arun Raghavan
abb300750f alsa: Implement playback/capture rate control for USB gadgets
If we detect Playback/Capture Pitch 1000000, we can adjust those values
to update the feedback endpoint for the host. On the capture side, this
will instruct the host to adjust the rate at which data is being sent.
On the playback side, this will adjust the amount of data the USB gadget
driver sends out in each USB tick.
2023-06-17 08:56:41 +00:00
Wim Taymans
2919b55f7f impl-link: don't set io in mix
Let the implementation handle this when needed. The main problem is that
we can set this to NULL before calling the port function and that might
crash things.
2023-06-16 20:31:33 +02:00
Wim Taymans
81fd6d5275 properties: improve containter serialize
If we are not recursing, take the complete property value without
attempting to parse it as json, only do this when recursing.

If the property value looks like a container is is exactly of the right
length, print is as a container, otherwise print is as string.

This makes properties like "[192.0.0.1]:45000" be printed as a string
instead of the array [192.0.0.1]. but still makes "[FL FR]" be an
array.

Fixes #3290
2023-06-16 17:36:25 +02:00
Wim Taymans
7c7e814b02 modules: build virtual sink/source 2023-06-16 16:24:49 +02:00
Wim Taymans
989c61e8a1 pulse-server: add virtual-sink and virtual-source
Although those are example elements, they actually work and we can
implement them as well.
2023-06-16 12:18:36 +02:00
Wim Taymans
b9789e36cd module-combine: always use last input buffer
To handle the case where buffers are queued up because a trigger didn't
complete.
2023-06-16 11:31:13 +02:00
Wim Taymans
cfaf424ed8 module-loopback: always dequeue the last capture buffer
Because the capture triggers the playback stream, the playback stream
might not be actually triggered when the stream is not running.

This can cause a buffer to be queued in the capture side that is never
dequeued from the playback side. If 2 buffers are queued (and 2 buffers
are available on the stream), the capture source has no more buffers and
starts to drop/stutter.

Fix this problem by always dequeueing/queuing all the queued buffers so
that we always use the last one.

See #3276
2023-06-16 11:12:51 +02:00
Wim Taymans
a0a32af386 pulse-server: add 2 quirks to block sink/source updates
See #1517
2023-06-15 11:45:43 +02:00
Wim Taymans
d04e430f23 audioconvert: add channelmix.mix/max-volume param
And clamp the volume values between these two. This can be used lock the
voluem to value or do some volume limit.
2023-06-15 11:06:52 +02:00
Wim Taymans
0b2d9ee007 module-session-manager: use dynamic builder
The buffer is very small and we should use a dynamic builder if we don't
know what pod we will expect.
2023-06-15 11:05:17 +02:00
Wim Taymans
bbf8f1a0c8 module-loopback: request renegotiation when suspended
When one side of the loopback suspends, do a EnumFormat params to force
renegotiation on the other side as well.

Suppose this:

1. sink/filter/pw-play plays at 48000Hz
2. pw-play goes away, sink and filter-sink suspend, filter-playback
   idles
3. pw-play starts with 44100Hz
4. sink/filter-sink renegotiate to 44100Hz, filter-playback is still
   at 48000Hz and pitch shifted.

We might want to manually suspend the IDLE nodes instead but for now
this is a good workaround.

Fixes #2969
2023-06-14 17:32:24 +02:00
Wim Taymans
05ea4520e6 audioconvert: improve debug 2023-06-14 16:57:13 +02:00
Wim Taymans
aaa91b2b7e stream: remove READ flag when removing params
Clear the READ flag when the param is removed.
Don't recursively emit param_changed events or we could end up in an
infite loop when we update params from param_changed.
2023-06-14 16:28:39 +02:00
Wim Taymans
0e516dec44 module-loopback: keep separate info for the delay rate/channels 2023-06-14 16:28:39 +02:00