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 ...@@ -265,7 +265,8 @@ JackClientControl* JackDriver::GetClientControl() const
void JackDriver::NotifyXRun(jack_time_t cur_cycle_begin, float delayed_usecs) 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) void JackDriver::NotifyBufferSize(jack_nframes_t buffer_size)
......
...@@ -334,14 +334,13 @@ void JackEngine::NotifyRemoveClient(const char* name, int refnum) ...@@ -334,14 +334,13 @@ void JackEngine::NotifyRemoveClient(const char* name, int refnum)
} }
// Coming from the driver // 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 // Use the audio thread => request thread communication channel
fEngineControl->NotifyXRun(callback_usecs, delayed_usecs);
fChannel.Notify(ALL_CLIENTS, kXRunCallback, 0); fChannel.Notify(ALL_CLIENTS, kXRunCallback, 0);
} }
void JackEngine::NotifyXRun(int refnum) void JackEngine::NotifyClientXRun(int refnum)
{ {
if (refnum == ALL_CLIENTS) { if (refnum == ALL_CLIENTS) {
NotifyClients(kXRunCallback, false, "", 0, 0); NotifyClients(kXRunCallback, false, "", 0, 0);
......
...@@ -142,9 +142,9 @@ class SERVER_EXPORT JackEngine : public JackLockAble ...@@ -142,9 +142,9 @@ class SERVER_EXPORT JackEngine : public JackLockAble
bool Process(jack_time_t cur_cycle_begin, jack_time_t prev_cycle_end); bool Process(jack_time_t cur_cycle_begin, jack_time_t prev_cycle_end);
// Notifications // 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 NotifyFailure(int code, const char* reason);
void NotifyXRun(int refnum);
void NotifyGraphReorder(); void NotifyGraphReorder();
void NotifyBufferSize(jack_nframes_t buffer_size); void NotifyBufferSize(jack_nframes_t buffer_size);
void NotifySampleRate(jack_nframes_t sample_rate); void NotifySampleRate(jack_nframes_t sample_rate);
......
...@@ -59,12 +59,13 @@ void jack_log_function(int level, const char *message) ...@@ -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) 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; size_t len;
jack_log_function_t log_function; jack_log_function_t log_function;
if (prefix != NULL) { if (prefix != NULL) {
len = strlen(prefix); len = strlen(prefix);
assert(len < 256);
memcpy(buffer, prefix, len); memcpy(buffer, prefix, len);
} else { } else {
len = 0; len = 0;
......
...@@ -258,16 +258,18 @@ class SERVER_EXPORT JackLockedEngine ...@@ -258,16 +258,18 @@ class SERVER_EXPORT JackLockedEngine
} }
// Notifications // Notifications
void NotifyXRun(jack_time_t cur_cycle_begin, float delayed_usecs) void NotifyDriverXRun()
{ {
// RT : no lock // Coming from the driver in RT : no lock
fEngine.NotifyXRun(cur_cycle_begin, delayed_usecs); fEngine.NotifyDriverXRun();
} }
void NotifyXRun(int refnum) void NotifyClientXRun(int refnum)
{ {
// RT : no lock TRY_CALL
fEngine.NotifyXRun(refnum); JackLock lock(&fEngine);
fEngine.NotifyClientXRun(refnum);
CATCH_EXCEPTION
} }
void NotifyGraphReorder() void NotifyGraphReorder()
......
...@@ -513,7 +513,7 @@ namespace Jack ...@@ -513,7 +513,7 @@ namespace Jack
return res; return res;
} else if (res == NET_PACKET_ERROR) { } else if (res == NET_PACKET_ERROR) {
// Well not a real XRun... // Well not a real XRun...
JackServerGlobals::fInstance->GetEngine()->NotifyXRun(GetMicroSeconds(), 0); JackServerGlobals::fInstance->GetEngine()->NotifyClientXRun(ALL_CLIENTS);
} }
#ifdef JACK_MONITOR #ifdef JACK_MONITOR
......
...@@ -305,7 +305,7 @@ void JackServer::Notify(int refnum, int notify, int value) ...@@ -305,7 +305,7 @@ void JackServer::Notify(int refnum, int notify, int value)
break; break;
case kXRunCallback: case kXRunCallback:
fEngine->NotifyXRun(refnum); fEngine->NotifyClientXRun(refnum);
break; 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