Merge lp://staging/~mixxxdevelopers/mixxx/engine-control-refactor into lp://staging/~mixxxdevelopers/mixxx/trunk
Status: | Needs review |
---|---|
Proposed branch: | lp://staging/~mixxxdevelopers/mixxx/engine-control-refactor |
Merge into: | lp://staging/~mixxxdevelopers/mixxx/trunk |
Diff against target: |
6049 lines (+2116/-1120) 60 files modified
mixxx/build/depends.py (+4/-0) mixxx/src/basetrackplayer.cpp (+19/-12) mixxx/src/basetrackplayer.h (+1/-0) mixxx/src/cachingreader.cpp (+36/-15) mixxx/src/cachingreader.h (+9/-1) mixxx/src/engine/bpmcontrol.cpp (+39/-24) mixxx/src/engine/bpmcontrol.h (+30/-28) mixxx/src/engine/callbackcontrolmanager.cpp (+178/-0) mixxx/src/engine/callbackcontrolmanager.h (+159/-0) mixxx/src/engine/callbacktrackmanager.cpp (+150/-0) mixxx/src/engine/callbacktrackmanager.h (+121/-0) mixxx/src/engine/clockcontrol.cpp (+22/-12) mixxx/src/engine/clockcontrol.h (+9/-7) mixxx/src/engine/cuecontrol.cpp (+95/-151) mixxx/src/engine/cuecontrol.h (+38/-39) mixxx/src/engine/enginebuffer.cpp (+182/-120) mixxx/src/engine/enginebuffer.h (+56/-53) mixxx/src/engine/enginebufferscalest.cpp (+0/-16) mixxx/src/engine/enginebufferscalest.h (+0/-4) mixxx/src/engine/enginechannel.cpp (+13/-6) mixxx/src/engine/enginechannel.h (+10/-16) mixxx/src/engine/engineclipping.cpp (+16/-23) mixxx/src/engine/engineclipping.h (+13/-12) mixxx/src/engine/enginedeck.cpp (+26/-17) mixxx/src/engine/enginedeck.h (+11/-9) mixxx/src/engine/enginefilterblock.cpp (+68/-49) mixxx/src/engine/enginefilterblock.h (+21/-14) mixxx/src/engine/engineflanger.cpp (+30/-13) mixxx/src/engine/engineflanger.h (+5/-5) mixxx/src/engine/enginemaster.cpp (+71/-33) mixxx/src/engine/enginemaster.h (+26/-16) mixxx/src/engine/enginemicrophone.cpp (+14/-7) mixxx/src/engine/enginemicrophone.h (+10/-5) mixxx/src/engine/enginepassthrough.cpp (+27/-16) mixxx/src/engine/enginepassthrough.h (+12/-7) mixxx/src/engine/enginepregain.cpp (+44/-30) mixxx/src/engine/enginepregain.h (+18/-19) mixxx/src/engine/enginestate.h (+33/-0) mixxx/src/engine/enginevinylsoundemu.cpp (+26/-25) mixxx/src/engine/enginevinylsoundemu.h (+15/-11) mixxx/src/engine/enginevumeter.cpp (+22/-18) mixxx/src/engine/enginevumeter.h (+13/-10) mixxx/src/engine/engineworker.cpp (+2/-1) mixxx/src/engine/loopingcontrol.cpp (+74/-44) mixxx/src/engine/loopingcontrol.h (+31/-27) mixxx/src/engine/positionscratchcontroller.cpp (+26/-17) mixxx/src/engine/positionscratchcontroller.h (+6/-6) mixxx/src/engine/quantizecontrol.cpp (+31/-16) mixxx/src/engine/quantizecontrol.h (+10/-11) mixxx/src/engine/ratecontrol.cpp (+79/-68) mixxx/src/engine/ratecontrol.h (+28/-26) mixxx/src/engine/readaheadmanager.cpp (+0/-6) mixxx/src/engine/readaheadmanager.h (+0/-2) mixxx/src/engine/syncworker.cpp (+28/-0) mixxx/src/engine/syncworker.h (+24/-0) mixxx/src/engine/vinylcontrolcontrol.cpp (+70/-37) mixxx/src/engine/vinylcontrolcontrol.h (+10/-13) mixxx/src/mixxx.cpp (+2/-1) mixxx/src/trackinfoobject.h (+2/-1) mixxx/src/util.h (+1/-1) |
To merge this branch: | bzr merge lp://staging/~mixxxdevelopers/mixxx/engine-control-refactor |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mixxx Development Team | Pending | ||
Review via email: mp+114572@code.staging.launchpad.net |
Description of the change
Eliminate almost all use of mutexes within the engine.
This branch drastically refactors the use of the control system within the engine and eliminates a variety of threading issues that led to liberal use of mutexes within engine code. With every lock of a mutex comes the possibility of blocking the callback so this branch should reduce the probability of xruns occurring. As an added benefit it reduces the complexity of some engine logic.
The branch introduces a wrapper for ControlObjects called a 'CallbackControl'. This wrapper communicates with the control system in the GUI thread via a lock-free FIFO. When another part of Mixxx changes a control, the valueChanged() signal from a CallbackControl is not delivered until the start of the callback period (and in the callback thread). Similarly, any changes to CallbackControls by the engine are written to a lock-free FIFO and proxied to the ControlObjects they wrap by the SyncWorker that runs in the engine-worker thread pool after every callback.
Some EngineControls listen to signals from TrackInfoObjects (such as beatsChanged and cuesChanged signals). This was unsafe because it could execute engine code in a non-callback thread. This branch introduces a callback-safe CallbackTrackWa
CachingReader now delivers its signals in the callback thread instead of the engine worker thread pool. This prevents executing engine code in a non-callback thread.
Not all mutex locks are gone. There are still some (more subtle) ones remaining that will take a lot more work to get rid of.
* Every access of TrackInfoObject methods locks a mutex.
* Every access of a Beats class locks a mutex.
* EngineBuffer still broadcasts certain signals that result in a QueuedConnection to BaseTrackCache. This involves coordinating with the Qt event loop which I assume involves locking a mutex (maybe it uses a lock-free FIFO).
* Writing to the EngineSidechain
* Probably more that I've missed.
Unmerged revisions
- 2935. By RJ Skerry-Ryan
-
Merging from lp:mixxx.
- 2934. By RJ Skerry-Ryan
-
Merging from lp:mixxx.
- 2933. By RJ Skerry-Ryan
-
Merging from lp:mixxx.
- 2932. By RJ Skerry-Ryan
-
Add SyncWorker back in to sync CallbackControl updates from the CallbackControl
Manager after the callback runs. - 2931. By RJ Skerry-Ryan
-
Add missing createControls call.
- 2930. By RJ Skerry-Ryan
-
Delete merge detritus.
- 2929. By RJ Skerry-Ryan
-
Merging from lp:mixxx.
- 2928. By RJ Skerry-Ryan
-
Merging from lp:mixxx/1.11
- 2927. By RJ Skerry-Ryan
-
add comments to src/engine/
callbackcontrol manager. h - 2926. By RJ Skerry-Ryan
-
Change Q_ASSERT to qWarning in EnginePassthrough
(First commit to this branch was 10/2011.. it sure took long enough ;) )