Commit 15950eb1 authored by Stephane Letz's avatar Stephane Letz
Browse files

Rework XRun handling.

parent ddb61e60
......@@ -265,7 +265,8 @@ JackClientControl* JackDriver::GetClientControl() const
void JackDriver::NotifyXRun(jack_time_t cur_cycle_begin, float delayed_usecs)
{
fEngine->NotifyXRun(cur_cycle_begin, delayed_usecs);
fEngineControl->NotifyXRun(cur_cycle_begin, delayed_usecs);
fEngine->NotifyDriverXRun();
}
void JackDriver::NotifyBufferSize(jack_nframes_t buffer_size)
......
......@@ -334,14 +334,13 @@ void JackEngine::NotifyRemoveClient(const char* name, int refnum)
}
// Coming from the driver
void JackEngine::NotifyXRun(jack_time_t callback_usecs, float delayed_usecs)
void JackEngine::NotifyDriverXRun()
{
// Use the audio thread => request thread communication channel
fEngineControl->NotifyXRun(callback_usecs, delayed_usecs);
fChannel.Notify(ALL_CLIENTS, kXRunCallback, 0);
}
void JackEngine::NotifyXRun(int refnum)
void JackEngine::NotifyClientXRun(int refnum)
{
if (refnum == ALL_CLIENTS) {
NotifyClients(kXRunCallback, false, "", 0, 0);
......
......@@ -142,9 +142,9 @@ class SERVER_EXPORT JackEngine : public JackLockAble
bool Process(jack_time_t cur_cycle_begin, jack_time_t prev_cycle_end);
// Notifications
void NotifyXRun(jack_time_t callback_usecs, float delayed_usecs);
void NotifyDriverXRun();
void NotifyClientXRun(int refnum);
void NotifyFailure(int code, const char* reason);
void NotifyXRun(int refnum);
void NotifyGraphReorder();
void NotifyBufferSize(jack_nframes_t buffer_size);
void NotifySampleRate(jack_nframes_t sample_rate);
......
......@@ -59,12 +59,13 @@ void jack_log_function(int level, const char *message)
static void jack_format_and_log(int level, const char *prefix, const char *fmt, va_list ap)
{
char buffer[300];
char buffer[256];
size_t len;
jack_log_function_t log_function;
if (prefix != NULL) {
len = strlen(prefix);
assert(len < 256);
memcpy(buffer, prefix, len);
} else {
len = 0;
......
......@@ -258,16 +258,18 @@ class SERVER_EXPORT JackLockedEngine
}
// Notifications
void NotifyXRun(jack_time_t cur_cycle_begin, float delayed_usecs)
void NotifyDriverXRun()
{
// RT : no lock
fEngine.NotifyXRun(cur_cycle_begin, delayed_usecs);
// Coming from the driver in RT : no lock
fEngine.NotifyDriverXRun();
}
void NotifyXRun(int refnum)
void NotifyClientXRun(int refnum)
{
// RT : no lock
fEngine.NotifyXRun(refnum);
TRY_CALL
JackLock lock(&fEngine);
fEngine.NotifyClientXRun(refnum);
CATCH_EXCEPTION
}
void NotifyGraphReorder()
......
......@@ -513,7 +513,7 @@ namespace Jack
return res;
} else if (res == NET_PACKET_ERROR) {
// Well not a real XRun...
JackServerGlobals::fInstance->GetEngine()->NotifyXRun(GetMicroSeconds(), 0);
JackServerGlobals::fInstance->GetEngine()->NotifyClientXRun(ALL_CLIENTS);
}
#ifdef JACK_MONITOR
......
......@@ -305,7 +305,7 @@ void JackServer::Notify(int refnum, int notify, int value)
break;
case kXRunCallback:
fEngine->NotifyXRun(refnum);
fEngine->NotifyClientXRun(refnum);
break;
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment