Skip to content
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

Revamp JackAudio implementation #3826

Merged
merged 1 commit into from Oct 10, 2019

Conversation

davidebeatrici
Copy link
Member

@davidebeatrici davidebeatrici commented Oct 4, 2019

Some users were encountering issues such as the client taking ~8 seconds to start when jackd could not be run, due to the library attempting many times to connect to the JACK server (#3822).

While working on a fix I corrected the many warnings emitted by Clang-Tidy and I realized that there were many things that could be improved.

This commit almost entirely rewrites the implementation, but here are some of the changes:

  • Mutexes are used everywhere, race conditions should not be possible anymore.
  • The JACK client is not opened until it's required (i.e. JackAudioInput and/or JackAudioOutput start running). The initialization code has been moved to a dedicated function, the constructor doesn't execute it anymore. This is what fixes [Linux] jackd support without jackd installed causes Mumble client startup delay #3822.
  • The JACK client is deactivated and closed automatically when both JackAudioInput and JackAudioOutput are not running.
  • Code specific to audio input or audio output has been moved from JackAudioSystem to the corresponding section (JackAudioInput or JackAudioOutput).
  • Some variables in JackAudioSystem have been replaced with functions which retrieve the corresponding value from the JACK server.
  • Removed all instances of delete, raw pointers have been replaced with std::unique_ptr<>().
  • Replaced NULL with nullptr.

Some users were encountering issues such as the client taking ~8 seconds to start when "jackd" could not be run, due to the library attempting many times to connect to the JACK server (https://bugs.debian.org/941455).

While working on a fix I corrected the many warnings emitted by Clang-Tidy and I realized that there were many things that could be improved.

This commit almost entirely rewrites the implementation, but here are some of the changes:

- Mutexes are used everywhere, race conditions should not be possible anymore.
- The JACK client is not opened until it's required (i.e. "JackAudioInput" and/or "JackAudioOutput" start running). The initialization code has been moved to a dedicated function, the constructor doesn't execute it anymore. This is what fixes the issue mentioned above.
- The JACK client is deactivated and closed automatically when both "JackAudioInput" and "JackAudioOutput" are not running.
- Code specific to audio input or audio output has been moved from "JackAudioSystem" to the corresponding section ("JackAudioInput" or "JackAudioOutput").
- Some variables in "JackAudioSystem" have been replaced with functions which retrieve the corresponding value from the JACK server.
- Removed all instances of "delete", raw pointers have been replaced with "std::unique_ptr<>()".
- Replaced "NULL" with "nullptr".
@davidebeatrici
Copy link
Member Author

@crknadle kindly tested the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Linux] jackd support without jackd installed causes Mumble client startup delay
1 participant