My current setup:
ALSA dmix (period_size 480, periods 3, rate 48000) --> spdif out --> spdif
in --> zita-a2j -p 96 -n 2 -p 48000
--> jackd -d netone -p 192 -n 2 or zita-j2a -p 96 -n 2 -r 48000
480*3 is definitely not a multiple of 96*2 although it seems to sound fine.
Should it be a multiple of zita-a2j buffer size?
If jackd and jack clients fail to preempt file system operations, xruns
occur.
Without PREEMPT_RT_FULL, jack clients cannot preempt file system operations
effectively.
If specific hardwares introduce high latencies outside operating system's
control, PREEMPT_RT_FULL cannot help you.
Dear Jack2 Maintainers,
I have a question about JackAudioDriver.cpp. It seems to me like there could be a possible race condition in JackAudioDriver::ProcessGraphSyncMaster(), where the driver would do read and write on a slave device without waiting for graph execution end.
Below is the proposed "fix", or what I would expect is correct, am I reading something wrong in the code? What do you guys think?
diff --git a/common/JackAudioDriver.cpp b/common/JackAudioDriver.cpp
index ef7c683..9172fe8 100644
--- a/common/JackAudioDriver.cpp
+++ b/common/JackAudioDriver.cpp
@@ -327,16 +327,12 @@ void JackAudioDriver::ProcessGraphSyncMaster()
// fBeginDateUst is set in the "low level" layer, fEndDateUst is from previous cycle
if (fEngine->Process(fBeginDateUst, fEndDateUst)) {
- if (ResumeRefNum() < 0) {
- jack_error("JackAudioDriver::ProcessGraphSyncMaster: ResumeRefNum error");
- }
-
if (ProcessReadSlaves() < 0) {
jack_error("JackAudioDriver::ProcessGraphSync: ProcessReadSlaves error, engine may now behave abnormally!!");
}
- if (ProcessWriteSlaves() < 0) {
- jack_error("JackAudioDriver::ProcessGraphSync: ProcessWriteSlaves error, engine may now behave abnormally!!");
+ if (ResumeRefNum() < 0) {
+ jack_error("JackAudioDriver::ProcessGraphSyncMaster: ResumeRefNum error");
}
// Waits for graph execution end
@@ -344,6 +340,10 @@ void JackAudioDriver::ProcessGraphSyncMaster()
jack_error("JackAudioDriver::ProcessGraphSync: SuspendRefNum error, engine may now behave abnormally!!");
}
+ if (ProcessWriteSlaves() < 0) {
+ jack_error("JackAudioDriver::ProcessGraphSync: ProcessWriteSlaves error, engine may now behave abnormally!!");
+ }
+
} else { // Graph not finished: do not activate it
jack_error("JackAudioDriver::ProcessGraphSync: Process error");
}
--
2.7.4
Best regards
Adam Miartus
Engineering Software Multimedia (ADITG/ESM)
Tel. +49 5121 49 6973
I have a USB soundcard that I add to netone backend through zita-a2j and
zita-j2a.
For software volume control, I put jackminimix between zita-a2j and
zita-j2a or between zita-a2j and netone.
I didn't know why I got xruns while I compiled kernel or gentoo packages.
Today, I used stress-ng to put various loads on my computer.
"nice -n 19 stress-ng --iomix 8 --ionice-class idle -t 5m" caused multiple
xruns.
"nice -n 19 stress-ng --cpu 8" didn't cause xruns.
I tried giving real-time ionice priorities to netone backend,
zita-ajbridge, and jackminimix.
Eventually, the setup that seems to withstand "nice -n 19 stress-ng --iomix
8 --ionice-class idle --cpu 8 -t 5m" was
ionice -c 1 -n 3 sudo -u user jackd -P 90 -d netone ("-p 256" inherited
from jack_netsource) -n 3
ionice -c 1 -n 0 sudo -u user stdbuf -o 0 zita-a2j -j from_alsa -d spdif_in
-p 128 -n 2 -r 48000
ionice -c 1 -n 0 sudo -u user stdbuf -o 0 zita-j2a -j headphones -d
xfihd_hdp -p 128 -n 2 -r 48000
ionice -c 1 -n 6 sudo -u user stdbuf -o 0 jackminimix -c 1 -p 20255 -n
hdp-vol
ionice -c 1 -n 6 sudo -u user stdbuf -o 0 jackminimix -c 1 -p 20256 -n
spk-vol
I will have to test more to be sure that this setup really withstands
writing to ZFS which amplifies writes many times.
I guess that writing to ZFS interferes with reading from and writing to USB
soundcard or ethernet adaptor. I thought ionice only affected file system
operations.
Perhaps, does ionice affect xruns because I log stdout and stderr of jackd,
zita-ajbridge, and jackminimix into files on ZFS without buffering? "stdbuf
-o 0" removes buffering.
After starting netone jack backend, zita-a2j, and zita-j2a, I started
jack_netsource.
zita-a2j and zita-j2a printed "Fatal error condition, terminating." and
exited.
I have noticed the JACK server limitation of port numbers in some
specific applications ("Maximum number of output ports is reached for
application ref = 2"). I have noticed the "-p" / "--port-max" parameter
and was able to artificially scale down or up the available number. But,
I seem to have reached and upper limit at around 800. Due to possibly
already existing ports like system input and output I am not certain of
the exact number.
To be fair, the available number is high enough for general use cases
(also for me). But in these certain conditions it definitely limits my
possibilities without an apparent workaround.
Is there a way monitor if the port-max is passed correctly? Or where the
limitation arises otherwise? Or how to possibly circumvent it?
Best,
/Hannes
I have tested with
jackd -P 90 -d alsa -p 256 -n 2
jack_netsource -n 3 -H xxxx
jackd -P 90 -d netone -n 3
zita-a2j -p 128 -n 3
zita-j2a -p 128 -n 3 and zita-j2a -p 256 -n 3
jackminimix
Every process in the list is in audio cgroup that allocates 95% of CPU time
to realtime threads to members.
Did I configure -p improperly?
According to
https://github.com/jackaudio/jack2/blob/6bacf6e1db975e5738821bf4abe20314f5e…
typedef enum {
NotTriggered,
Triggered,
Running,
Finished,
} jack_client_state_t;
I don't understand any of jack_client_state_t.
I usually see xruns with state = Triggered or Running.
I'm incrementally increasing period size of zita-a2j and zita-j2a in order
to eliminate xruns.
After they crash once, if I start them again, they don't crash.
I wanted to contact kokkini zita, but I don't have his email address.
Does anyone know how to fix this? Does anyone know how to contact kokkini
zita?