diff --git a/ChangeLog b/ChangeLog index 07738fc3..c96d2f49 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,10 @@ Paul Davis Jackdmp changes log --------------------------- +2009-11-06 Stephane Letz + + * Correctly save and restore RT mode state in freewheel mode. + 2009-11-05 Stephane Letz * No reason to make jack_on_shutdown deprecated, so revert the incorrect change. diff --git a/common/JackEngine.cpp b/common/JackEngine.cpp index 83a22ad4..8e798e5e 100644 --- a/common/JackEngine.cpp +++ b/common/JackEngine.cpp @@ -305,7 +305,15 @@ void JackEngine::NotifyFailure(int code, const char* reason) void JackEngine::NotifyFreewheel(bool onoff) { - fEngineControl->fRealTime = !onoff; + if (onoff) { + // Save RT state + fEngineControl->fFWRealTime = fEngineControl->fRealTime; + fEngineControl->fRealTime = false; + } else { + // Restore RT state + fEngineControl->fRealTime = fEngineControl->fFWRealTime; + fEngineControl->fFWRealTime = false; + } NotifyClients((onoff ? kStartFreewheelCallback : kStopFreewheelCallback), true, "", 0, 0); } diff --git a/common/JackEngineControl.h b/common/JackEngineControl.h index 41c9c5b8..47c04d35 100644 --- a/common/JackEngineControl.h +++ b/common/JackEngineControl.h @@ -58,6 +58,7 @@ struct SERVER_EXPORT JackEngineControl : public JackShmMem float fXrunDelayedUsecs; bool fTimeOut; bool fRealTime; + bool fFWRealTime; // RT state saved and restored during Freewheel mode int fServerPriority; int fClientPriority; int fMaxClientPriority; @@ -100,6 +101,7 @@ struct SERVER_EXPORT JackEngineControl : public JackShmMem fTimeOut = (timeout > 0); fTimeOutUsecs = timeout * 1000; fRealTime = rt; + fFWRealTime = false; fServerPriority = priority; fClientPriority = (rt) ? priority - 5 : 0; fMaxClientPriority = (rt) ? priority - 1 : 0;