Ticket #91 (closed defect: fixed)

Opened 1 year ago

Last modified 10 months ago

The jack modules aren't real-time safe.

Reported by: tanuk Assigned to: tanuk
Priority: normal Milestone: 0.9.7
Component: module-jack-* Severity: normal
Keywords: Cc:

Description

The jack modules are unusable in a low-latency setup.

I have come up with a patch for the sink. For some information that I don't see necessary to repeat here, see my message to the list, where I posted the first version of the patch: http://article.gmane.org/gmane.comp.audio.pulseaudio.general/105

I was told that writing to a pipe may block, and that it causes an undesirable context switch anyway. So I made another version. That didn't work. This is the third version, I added an extra thread that takes care of writing to the pipe. I would have liked to get away with no new threads, since I have no experience of creating threads in a C-like environment. So review carefully at least the start_filling_ringbuffer function where the thread is created. Not that I have experienced any problems, though.

Another thing I'm not sure: do I have to do any memory locking related things? The jack ringbuffer has a locking function, which I have not used. Jack automatically locks the clients' memory, present and future, is that enough? I think I have read somewhere that all memory should be 'touched' before use in the real-time context...

This time the handling of the jack blocksize changes is tested.

The file is completely reordered to my liking, so the patch may not be very easy to follow. For the reviewer's convenience I have also uploaded the resulting file to http://iki.fi/tanuk/tmp/module-jack-sink.c

Attachments

realtime_safety.patch (28.1 kB) - added by tanuk on 05/30/07 20:39:15.
module-jack-sink.c (25.0 kB) - added by tanuk on 08/18/07 13:24:29.
An improved version (a couple of bug fixes, numbered ports).

Change History

05/30/07 20:39:15 changed by tanuk

  • attachment realtime_safety.patch added.

07/08/07 20:59:24 changed by tanuk

I noticed that there has been left a kind of debug message in the patch, that shouldn't be there. Search for "Perhana" and delete the line.

Also a semaphor might be more efficient than signaling with conditionals. And caching the buffer pointers is incompatible with an experimental feature of jackdmp, the multi-processor friendly jackd replacement.

I can do these changes, if you want. After the core upgrade, of course.

07/14/07 21:07:03 changed by tanuk

Another improvement to do: Plain numbered ports would make more sense in the jack world (out_1, out_2 etc.)

08/18/07 13:24:29 changed by tanuk

  • attachment module-jack-sink.c added.

An improved version (a couple of bug fixes, numbered ports).

09/06/07 20:35:26 changed by tanuk

The new version of module-jack-sink is now in svn trunk, and has at least one bug less than any of what you can find in this bug report.

The module-jack-source is still as broken as it has always been (I'm working on it, and 0.9.7 should have nicer Jack modules).

09/11/07 06:20:45 changed by tanuk

  • owner changed from lennart to tanuk.
  • milestone set to 0.9.7.

10/30/07 14:59:59 changed by lennart

  • status changed from new to closed.
  • resolution set to fixed.

SVN trunk now has a real-time safe JACK module.