Browse Source

In synchronous mode, if the driver time out is reached, the server may get desynchronized (pending signal may arrive in later cycles), use a higher time out value use in driver, and warn the use of possible mis-behaviour in case of time out.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1303 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.60
sletz 19 years ago
parent
commit
95454b4ad9
8 changed files with 36 additions and 20 deletions
  1. +5
    -0
      ChangeLog
  2. +12
    -6
      common/JackAudioDriver.cpp
  3. +1
    -1
      common/JackConstants.h
  4. +9
    -6
      common/JackDriver.cpp
  5. +2
    -2
      common/JackDriver.h
  6. +4
    -2
      common/JackFreewheelDriver.cpp
  7. +2
    -2
      common/JackThreadedDriver.h
  8. +1
    -1
      windows/JackPortAudioDriver.cpp

+ 5
- 0
ChangeLog View File

@@ -1,6 +1,11 @@
---------------------------
Jackdmp changes log
---------------------------
2006-11-22 Stephane Letz <letz@grame.fr>
* In synchronous mode, if the driver time out is reached, the server may get desynchronized (pending signal may arrive in later cycles),
use a higher time out value use in driver, and warn the use of possible mis-behaviour in case of time out.

2006-11-08 Stephane Letz <letz@grame.fr>


+ 12
- 6
common/JackAudioDriver.cpp View File

@@ -189,14 +189,20 @@ int JackAudioDriver::ProcessSync()
return 0;
}

if (fIsMaster) {
if (fIsMaster) {

fEngine->Process(fLastWaitUst); // fLastWaitUst is set in the "low level" layer
fGraphManager->ResumeRefNum(fClientControl, fSynchroTable);
ProcessSlaves();
if (fGraphManager->SuspendRefNum(fClientControl, fSynchroTable, fEngineControl->fTimeOutUsecs) < 0)
jack_error("JackAudioDriver::ProcessSync SuspendRefNum error");
fGraphManager->ResumeRefNum(fClientControl, fSynchroTable);

if (ProcessSlaves() < 0)
jack_error("JackAudioDriver::ProcessSync ProcessSlaves error, engine may now behave abnormally!!");

if (fGraphManager->SuspendRefNum(fClientControl, fSynchroTable, fEngineControl->fTimeOutUsecs) < 0)
jack_error("JackAudioDriver::ProcessSync SuspendRefNum error, engine may now behave abnormally!!");
if (Write() < 0) // Write output buffers for the current cycle
jack_error("Process: write error");
jack_error("Process: write error");

} else {
fGraphManager->ResumeRefNum(fClientControl, fSynchroTable);
}


+ 1
- 1
common/JackConstants.h View File

@@ -19,7 +19,7 @@

#define PRINTDEBUG

#define VERSION "0.59"
#define VERSION "0.60"

#define FORK_SERVER 1



+ 9
- 6
common/JackDriver.cpp View File

@@ -132,8 +132,8 @@ int JackDriver::Open(jack_nframes_t nframes,
strcpy(fPlaybackDriverName, playback_driver_name);

fEngineControl->fPeriodUsecs = (jack_time_t)floor((((float)nframes) / (float)samplerate) * 1000000.0f);
if (fEngineControl->fTimeOutUsecs == 0) /* usecs; if zero, use 2 period size. */
fEngineControl->fTimeOutUsecs = (jack_time_t)(2.f * fEngineControl->fPeriodUsecs);
if (fEngineControl->fTimeOutUsecs == 0) /* usecs; if zero, use 10 period size. */
fEngineControl->fTimeOutUsecs = (jack_time_t)(10.f * fEngineControl->fPeriodUsecs);

fGraphManager->DirectConnect(fClientControl->fRefNum, fClientControl->fRefNum); // Connect driver to itself for sync

@@ -192,13 +192,16 @@ void JackDriverClient::RemoveSlave(JackDriverInterface* slave)
fSlaveList.remove(slave);
}

void JackDriverClient::ProcessSlaves()
{
int JackDriverClient::ProcessSlaves()
{
int res = 0;
list<JackDriverInterface*>::const_iterator it;
for (it = fSlaveList.begin(); it != fSlaveList.end(); it++) {
JackDriverInterface* slave = *it;
slave->Process();
}
if ((res = slave->Process()) < 0)
return res;
}
return res;
}

} // end of namespace

+ 2
- 2
common/JackDriver.h View File

@@ -78,7 +78,7 @@ class EXPORT JackDriverInterface
virtual bool GetMaster() = 0;
virtual void AddSlave(JackDriverInterface* slave) = 0;
virtual void RemoveSlave(JackDriverInterface* slave) = 0;
virtual void ProcessSlaves() = 0;
virtual int ProcessSlaves() = 0;

virtual bool IsRealTime() = 0;

@@ -112,7 +112,7 @@ class EXPORT JackDriverClient : public JackDriverClientInterface
virtual bool GetMaster();
virtual void AddSlave(JackDriverInterface* slave);
virtual void RemoveSlave(JackDriverInterface* slave);
virtual void ProcessSlaves();
virtual int ProcessSlaves();
};

/*!


+ 4
- 2
common/JackFreewheelDriver.cpp View File

@@ -37,8 +37,10 @@ int JackFreewheelDriver::Process()
} else {
fGraphManager->ResumeRefNum(fClientControl, fSynchroTable); // Signal all clients
if (fEngineControl->fSyncMode) {
if (fGraphManager->SuspendRefNum(fClientControl, fSynchroTable, fEngineControl->fTimeOutUsecs) < 0)
jack_error("JackFreewheelDriver::ProcessSync SuspendRefNum error");
if (fGraphManager->SuspendRefNum(fClientControl, fSynchroTable, fEngineControl->fTimeOutUsecs) < 0) {
jack_error("JackFreewheelDriver::ProcessSync SuspendRefNum error");
return -1;
}
}
}
return 0;


+ 2
- 2
common/JackThreadedDriver.h View File

@@ -117,9 +117,9 @@ class JackThreadedDriver : public JackDriverClientInterface, public JackRunnable
{
fDriver->RemoveSlave(slave);
}
virtual void ProcessSlaves()
virtual int ProcessSlaves()
{
fDriver->ProcessSlaves();
return fDriver->ProcessSlaves();
}

virtual void PrintState()


+ 1
- 1
windows/JackPortAudioDriver.cpp View File

@@ -223,7 +223,7 @@ int JackPortAudioDriver::Render(const void* inputBuffer, void* outputBuffer,
driver->fLastWaitUst = GetMicroSeconds(); // Take callback date here
driver->fInputBuffer = (float**)inputBuffer;
driver->fOutputBuffer = (float**)outputBuffer;
return driver->Process();
return (driver->Process() == 0) ? paContinue : paAbort;
}

int JackPortAudioDriver::Read()


Loading…
Cancel
Save