Commit 7dfb47b0 authored by sletz's avatar sletz
Browse files

Improve backend error handling: fatal error returned by Read/Write now cause a...

Improve backend error handling: fatal error returned by Read/Write now cause a Process failure (so a thread exit for blocking backends). Recoverable ones (XRuns..) are now treated internally in ALSA, FreeBob and FFADO backends.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4079 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 8ba6f045
......@@ -33,6 +33,10 @@ David Garcia Garzon
Jackdmp changes log
---------------------------
2010-11-03 Stephane Letz <letz@grame.fr>
* Improve backend error handling: fatal error returned by Read/Write now cause a Process failure (so a thread exit for blocking backends). Recoverable ones (XRuns..) are now treated internally in ALSA, FreeBob and FFADO backends.
2010-10-30 Stephane Letz <letz@grame.fr>
* Correct JackServer::Open to avoid a race when control API is used on OSX.
......
......@@ -215,14 +215,14 @@ int JackAudioDriver::ProcessAsync()
{
// Read input buffers for the current cycle
if (Read() < 0) {
jack_error("JackAudioDriver::ProcessAsync: read error, skip cycle");
return 0; // Skip cycle, but continue processing...
jack_error("JackAudioDriver::ProcessAsync: read error, stopping...");
return -1;
}
// Write output buffers from the previous cycle
if (Write() < 0) {
jack_error("JackAudioDriver::ProcessAsync: write error, skip cycle");
return 0; // Skip cycle, but continue processing...
jack_error("JackAudioDriver::ProcessAsync: write error, stopping...");
return -1;
}
if (fIsMaster) {
......@@ -244,9 +244,9 @@ output buffers computed at the *current cycle* are used.
int JackAudioDriver::ProcessSync()
{
// Read input buffers for the current cycle
if (Read() < 0) {
jack_error("JackAudioDriver::ProcessSync: read error, skip cycle");
return 0; // Skip cycle, but continue processing...
if (Read() < 0) {
jack_error("JackAudioDriver::ProcessSync: read error, stopping...");
return -1;
}
if (fIsMaster) {
......@@ -255,10 +255,10 @@ int JackAudioDriver::ProcessSync()
fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable);
}
// Write output buffers for the current cycle
if (Write() < 0) {
jack_error("JackAudioDriver::ProcessSync: write error, skip cycle");
return 0; // Skip cycle, but continue processing...
// Write output buffers from the previous cycle
if (Write() < 0) {
jack_error("JackAudioDriver::ProcessSync: write error, stopping...");
return -1;
}
// Keep end cycle time
......
......@@ -2316,6 +2316,8 @@ int JackAlsaDriver::Read()
jack_nframes_t nframes;
fDelayedUsecs = 0.f;
retry:
nframes = alsa_driver_wait((alsa_driver_t *)fDriver, -1, &wait_status, &fDelayedUsecs);
if (wait_status < 0)
......@@ -2327,7 +2329,7 @@ int JackAlsaDriver::Read()
*/
jack_log("ALSA XRun wait_status = %d", wait_status);
NotifyXRun(fBeginDateUst, fDelayedUsecs);
return -1;
goto retry; /* recoverable error*/
}
if (nframes != fEngineControl->fBufferSize)
......
......@@ -664,6 +664,8 @@ int JackFFADODriver::Read()
int wait_status = 0;
fDelayedUsecs = 0.f;
retry:
jack_nframes_t nframes = ffado_driver_wait(driver, -1, &wait_status,
&fDelayedUsecs);
......@@ -678,7 +680,7 @@ int JackFFADODriver::Read()
*/
jack_log("FFADO XRun");
NotifyXRun(fBeginDateUst, fDelayedUsecs);
return -1;
goto retry; /* recoverable error*/
}
if (nframes != fEngineControl->fBufferSize)
......
......@@ -854,6 +854,8 @@ int JackFreebobDriver::Read()
int wait_status = 0;
fDelayedUsecs = 0.f;
retry:
jack_nframes_t nframes = freebob_driver_wait (driver, -1, &wait_status,
&fDelayedUsecs);
......@@ -868,7 +870,7 @@ int JackFreebobDriver::Read()
*/
jack_log("FreeBoB XRun");
NotifyXRun(fBeginDateUst, fDelayedUsecs);
return -1;
goto retry; /* recoverable error*/
}
if (nframes != fEngineControl->fBufferSize)
......
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