Browse Source

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
tags/1.9.7
sletz 14 years ago
parent
commit
7dfb47b067
5 changed files with 24 additions and 14 deletions
  1. +4
    -0
      ChangeLog
  2. +11
    -11
      common/JackAudioDriver.cpp
  3. +3
    -1
      linux/alsa/JackAlsaDriver.cpp
  4. +3
    -1
      linux/firewire/JackFFADODriver.cpp
  5. +3
    -1
      linux/freebob/JackFreebobDriver.cpp

+ 4
- 0
ChangeLog View File

@@ -33,6 +33,10 @@ David Garcia Garzon
Jackdmp changes log 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> 2010-10-30 Stephane Letz <letz@grame.fr>


* Correct JackServer::Open to avoid a race when control API is used on OSX. * Correct JackServer::Open to avoid a race when control API is used on OSX.


+ 11
- 11
common/JackAudioDriver.cpp View File

@@ -215,14 +215,14 @@ int JackAudioDriver::ProcessAsync()
{ {
// Read input buffers for the current cycle // Read input buffers for the current cycle
if (Read() < 0) { 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 // Write output buffers from the previous cycle
if (Write() < 0) { 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) { if (fIsMaster) {
@@ -244,9 +244,9 @@ output buffers computed at the *current cycle* are used.
int JackAudioDriver::ProcessSync() int JackAudioDriver::ProcessSync()
{ {
// Read input buffers for the current cycle // 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) { if (fIsMaster) {
@@ -255,10 +255,10 @@ int JackAudioDriver::ProcessSync()
fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable); 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 // Keep end cycle time


+ 3
- 1
linux/alsa/JackAlsaDriver.cpp View File

@@ -2316,6 +2316,8 @@ int JackAlsaDriver::Read()
jack_nframes_t nframes; jack_nframes_t nframes;
fDelayedUsecs = 0.f; fDelayedUsecs = 0.f;


retry:

nframes = alsa_driver_wait((alsa_driver_t *)fDriver, -1, &wait_status, &fDelayedUsecs); nframes = alsa_driver_wait((alsa_driver_t *)fDriver, -1, &wait_status, &fDelayedUsecs);
if (wait_status < 0) if (wait_status < 0)
@@ -2327,7 +2329,7 @@ int JackAlsaDriver::Read()
*/ */
jack_log("ALSA XRun wait_status = %d", wait_status); jack_log("ALSA XRun wait_status = %d", wait_status);
NotifyXRun(fBeginDateUst, fDelayedUsecs); NotifyXRun(fBeginDateUst, fDelayedUsecs);
return -1;
goto retry; /* recoverable error*/
} }


if (nframes != fEngineControl->fBufferSize) if (nframes != fEngineControl->fBufferSize)


+ 3
- 1
linux/firewire/JackFFADODriver.cpp View File

@@ -664,6 +664,8 @@ int JackFFADODriver::Read()
int wait_status = 0; int wait_status = 0;
fDelayedUsecs = 0.f; fDelayedUsecs = 0.f;


retry:

jack_nframes_t nframes = ffado_driver_wait(driver, -1, &wait_status, jack_nframes_t nframes = ffado_driver_wait(driver, -1, &wait_status,
&fDelayedUsecs); &fDelayedUsecs);


@@ -678,7 +680,7 @@ int JackFFADODriver::Read()
*/ */
jack_log("FFADO XRun"); jack_log("FFADO XRun");
NotifyXRun(fBeginDateUst, fDelayedUsecs); NotifyXRun(fBeginDateUst, fDelayedUsecs);
return -1;
goto retry; /* recoverable error*/
} }


if (nframes != fEngineControl->fBufferSize) if (nframes != fEngineControl->fBufferSize)


+ 3
- 1
linux/freebob/JackFreebobDriver.cpp View File

@@ -854,6 +854,8 @@ int JackFreebobDriver::Read()
int wait_status = 0; int wait_status = 0;
fDelayedUsecs = 0.f; fDelayedUsecs = 0.f;


retry:

jack_nframes_t nframes = freebob_driver_wait (driver, -1, &wait_status, jack_nframes_t nframes = freebob_driver_wait (driver, -1, &wait_status,
&fDelayedUsecs); &fDelayedUsecs);


@@ -868,7 +870,7 @@ int JackFreebobDriver::Read()
*/ */
jack_log("FreeBoB XRun"); jack_log("FreeBoB XRun");
NotifyXRun(fBeginDateUst, fDelayedUsecs); NotifyXRun(fBeginDateUst, fDelayedUsecs);
return -1;
goto retry; /* recoverable error*/
} }


if (nframes != fEngineControl->fBufferSize) if (nframes != fEngineControl->fBufferSize)


Loading…
Cancel
Save