-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Remove the FIFO thread #7568
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
base: master
Are you sure you want to change the base?
Remove the FIFO thread #7568
Conversation
acfbfc4 to
663ca7e
Compare
|
Changed the PR to still remove the FIFO thread but keep the chunking of the buffer size (to avoid problems with non sample accurate automation but to also fix the problems this thread has caused). |
|
This shoulda had higher priority. @LMMS/testers |
|
Wait the tester role is only for peki? |
Rossmaxx
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fatloss on this is insane. I am not approving for now because I am doubtful if something might have gotten lost somewhere. I will approve after i get around to testing.
Also, don't understand what is now happening with the chunking mechanism. Is the audio thread processing in chunks of 256 and then outputting to the playback/export at the user defined buffer size? Or is there something I missed.
|
This is supposed to solve the performance degradation on master compared to 1.2 and the rare case with deadlocks making a mess, along with the buffer size and automation performance, among other stuff. @sakertooth correct me if I'm wrong. If what i guess is right, this PR has the potential to straighten up a lot of the performance bugs. |
For the time being, yeah. I think I get rights to review PRs and whatnot, so it's probably not wise to give it away to anyone wanting to test, but I'm not entirely sure about if that's how it behaves, just speculation. |
It's mostly to fix deadlock bugs involving this thread waiting forever to close. It's less of a performance benefit (though that could be possible) but more so to simplify the thread communication within the audio pipeline. |
|
So I tested this PR. Final feedback is this seems good, did Peki test that too ? There could be differences with a computer that can handle heavy workload. |
I don't think Peki has tested this yet, but they're probably busy with other PRs so it's fine. Thank you for testing this for me 👍 |
Sorry, just realized that I didn't answer this question @Rossmaxx. What happens is that the user selects their desired buffer size and audio device to use, and then when LMMS starts, the audio device thread starts, which periodically calls There is one thread requesting data periodically. That's it. There are other worker threads that do the actual processing, but this is the only thread requesting data (if not that thread then the export thread). To compare this to before, there was an additional thread, but this was removed, as it was mostly unnecessary and causing issues. |
0615733 to
78c0b80
Compare
|
I could test this, if it's ready to be tested, or needs WIP testing. @sakertooth ? |
There were merge conflicts, so I'm still working on this. I'll let you know if its ready 👍 |
9a6b783 to
215475e
Compare
|
Should be ready @bratpeki. |
|
Please request a review so I see it on the GitHub UI :) |
|
Okay, so, how do I test this? |
See if there's any funny business going on when playing demos/exporting on various audio devices. There shouldn't be any audio glitches, crashes, deadlocks, things of that nature (except for soundio which I believe was already broken in |
Most devices (even low-level ones like ALSA and OSS) already provide sample formats that allow you to ignore endianness, with some even handling the conversions internally.
ce30e59 to
8ffa18a
Compare
|
Tested again, @rdrpenguin04. Everything works well! |
+ Remove output buffer variables
…ed before destruction + Remove m_stopped variable in JACK
Removes the FIFO thread, which was a thread used in the audio engine that wrote chunks of rendered audio buffers to a circular buffer, while the audio callback thread would read from that. Instead, the audio callback is the one rendering the buffers directly and doing any chunking as necessary.
The functionality this thread brought allowed for buffers to be "written ahead" of the audio callback, meaning that the FIFO thread would be rendering buffers as fast it can, stopping when it can't write any more buffers, while the audio callback would be reading them at a fixed interval. However:
This PR also greatly simplifies the transmission of buffers between the engine and the audio device.
AudioDevice::nextBufferis a new function that handles and correctly processes the chunks of audio returned by the audio engine, and also manages both interleaved and non-interleaved outputs. This removes a lot of repetitive code in each audio device that originally was handling their configuration on their own.This PR also makes ALSA use floating-point audio instead of int16.