-
-
Notifications
You must be signed in to change notification settings - Fork 65
Make the PipeWire module a driver #205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Without that flag accessing the buffer memory is undefined behavior, though it happens to work in my tests.
This will help avoid data races in the future. No functional change intended.
b3d17f3
to
28e04e0
Compare
2e119c6
to
a844fc9
Compare
PipelineRetry |
7c03346
to
46c7f48
Compare
It doesn't build on Debian 12:
And also on Ubuntu 22.04 or CentOS Stream 8:
|
I’m not surprised @marmarek. Right now my main priority has been fixing Fedora and working around what appear to be multiple bugs in PipeWire. |
3229733
to
91d3b4b
Compare
645c19f
to
37fc750
Compare
PipelineRetry |
OpenQA test summaryComplete test suite and dependencies: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.2&build=2024020313-4.2&flavor=pull-requests New failures, excluding unstableCompared to: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.2&build=2024012304-4.2&flavor=update
Failed tests6 failures
Fixed failuresCompared to: https://openqa.qubes-os.org/tests/90505#dependencies 10 fixed
Unstable tests
|
openQArun |
3 similar comments
openQArun |
openQArun |
openQArun |
Also add explicit checks for two more known but unimplemented cases.
It was always "Unknown error -1" due to misplaced parentheses.
This will cause pacat-simple-vchan to print a "Stream uncork" message to the terminal, which can cause more xruns, creating a loop.
No functional change intended.
libvchan_write() should never be used to write to the control vchan, as partial records are not allowed there. Always use libvchan_send().
It's strictly better to record some samples than all zeros.
No other functional change intended.
This is needed to avoid running out of capture buffers.
This should not make a difference, modulo bugs...
This allows running any PipeWire stream out-of-process.
The PipeWire agent is more code than the PulseAudio agent, and it is not experimental.
Ubuntu Jammy (the oldest that needs to be supported) has 0.3.48.
1581d3e
to
081958f
Compare
pw_context_get_support() is guaranteed to return a non-NULL pointer that can be used with spa_support_find(), but does not guarantee that any particular interface is present in the returned support objects. The list of interfaces has changed in the past and might change again. Instead, use the public functions in the PipeWire API, which are more likely to remain stable in future releases of PipeWire.
081958f
to
7615b56
Compare
This still fails to build on Ubuntu jammy |
ab0fb95
to
8a13d5c
Compare
This avoids crashing, leaking memory, or other problems, even if the peer detaches unexpectedly or some function called by this module fails. In particular, this avoids a use-after-free during shutdown. The needed changes break the build on CentOS Stream 8, so stop building the PipeWire agent for this soon-to-be-EOL OS.
This avoids a bunch of repeated functions that merely extract the correct stream from the impl struct and then call the callback which does the real work.
This fixes audio quality in a Jitsi meeting using Firefox. It uses a delay-locked loop (DLL) to tell the resampler what rate it should use. If the buffer is too full, it tells the resampler to resample to a lower sample rate for playback, or to consume a higher sample rate for capture. If the buffer is not full enough, it tells the resampler to do the opposite. This ensures that buffer fill sizes are kept roughly constant, resulting in very stable performance even over substantial periods of time. This also allows using very large capture buffers (1MiB by default), which ensures that pacat-simple-vchan will not overrun its buffer unless something is very wrong. Without the DLL, such large capture buffers could fill up and cause massive latency spikes. Because rate-matching adversely affects audio quality and increases latency, this commit also adds support for driving the PipeWire processing graph. When this module is driving the graph, no rate-matching is done. Instead, the DLL is used to adjust the delay between runs of the processing graph. Since most Qubes OS VMs have no physical audio hardware connected to them, the only other driver is likely to be the "dummy" driver that just uses a timer. It is strictly preferable for this module to drive the graph instead, as this avoids rate matching and can sometimes avoid resampling. This was tested with PulseAudio in dom0 by me, and with both PulseAudio and PipeWire in dom0 by Marek. I also tested a version that does not drive the graph to ensure that this mode works fine, which it does. Using PipeWire in the AudioVM might provide a means of reducing overall system latency, especially since the current code needs rather large capture and playback buffers (8KiB by default) to smooth out uneven sample delivery and processing in the AudioVM. In the long term, I hope to improve Xen’s scheduler to prioritize audio and other hard-realtime tasks, which will allow the use of smaller buffers. This also adds two new tunables: - org.qubes-os.playback.target-buffer-fill (integer) sets the target fill level of the playback vchan. - org.qubes-os.record.target-buffer-fill (integer) sets the target fill level of the recording vchan. For consistency, org.qubes-os.record-buffer-size and org.qubes-os.playback-buffer-size have been replaced by org.qubes-os.record.buffer-size and org.qubes-os.playback.buffer-size, respectively. As it is believed that nobody but me is using these, backwards compatibility is not provided, but it is easy to add. The sample configuration has been updated accordingly.
8a13d5c
to
92a144b
Compare
PipelineRetry |
Does not work yet