[Bug 276607] audio/jack: artifact noises, "Write buffer balancing", mixed rtprio

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 25 Jan 2024 13:14:49 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276607

            Bug ID: 276607
           Summary: audio/jack: artifact noises, "Write buffer balancing",
                    mixed rtprio
           Product: Ports & Packages
           Version: Latest
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: pmc@citylink.dinoex.sub.org
                CC: dev@submerge.ch
             Flags: maintainer-feedback?(dev@submerge.ch)
                CC: dev@submerge.ch

Created attachment 247947
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=247947&action=edit
rc.d/jackd: apply rtprio later

Hearing "knack" noises in the playback, I found these accompanying messages:

>       JackOSSDriver::Write buffer balancing -294 frames
>       JackOSSDriver::Write buffer balancing 367 frames

Also, rtprio seems inconsistent:

ps -o tid -axlHww  | grep jackd
   LWP  UID   PID  PPID  C PRI NI      VSZ     RSS MWCHAN   STAT TT        
TIME COMMAND
101791    0  8754     1  0 -51  0    12856    2580 piperd   S<s   -     
0:00.00 daemon: /usr/local/bin/jackd[8755] (daemon)
122472 1100  8755  8754  0 -51  0   153496   72692 sigwait  S<s   -     
0:00.07 /usr/local/bin/jackd -r -d oss -r48000 -p1024 -n2 -w16 -i4 -o8 -C
/dev/dsp0 -P /dev/dsp0
216324 1100  8755  8754  0  52  0   153496   72692 uwait    Is    -     
0:00.00 /usr/local/bin/jackd -r -d oss -r48000 -p1024 -n2 -w16 -i4 -o8 -C
/dev/dsp0 -P /dev/dsp0
216325 1100  8755  8754  0  20  0   153496   72692 select   Ss    -     
0:00.05 /usr/local/bin/jackd -r -d oss -r48000 -p1024 -n2 -w16 -i4 -o8 -C
/dev/dsp0 -P /dev/dsp0
216326 1100  8755  8754  0  20  0   153496   72692 select   Ss    -     
0:00.00 /usr/local/bin/jackd -r -d oss -r48000 -p1024 -n2 -w16 -i4 -o8 -C
/dev/dsp0 -P /dev/dsp0

Bringing all threads into rtprio solved the issue for me. 
For now I created a patch on rc.d/jackd that should do this. (If jackd happens
to create further threads inflight, we would need to patch the source.)

Full story here: 
https://forums.freebsd.org/threads/audio-jack-artifact-noises-and-message-write-buffer-balancing.92060/post-640487

-- 
You are receiving this mail because:
You are the assignee for the bug.