From 7f955b1bc7e30cd317d76ad45afcb098a26b52f9 Mon Sep 17 00:00:00 2001 From: torben Date: Tue, 3 Mar 2009 02:37:58 +0000 Subject: [PATCH] [alsa_out] change xrun handling... gonna revert. git-svn-id: svn+ssh://jackaudio.org/trunk/jack@3376 0c269be4-1314-0410-8aa9-9f06e86f4224 --- tools/alsa_out.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tools/alsa_out.c b/tools/alsa_out.c index 2860147..3890069 100644 --- a/tools/alsa_out.c +++ b/tools/alsa_out.c @@ -87,15 +87,15 @@ snd_pcm_uframes_t real_period_size; // Alsa stuff... i dont want to touch this bullshit in the next years.... please... static int xrun_recovery(snd_pcm_t *handle, int err) { - //printf( "xrun !!!....\n" ); + printf( "xrun !!!.... %d\n", err ); if (err == -EPIPE) { /* under-run */ err = snd_pcm_prepare(handle); if (err < 0) printf("Can't recovery from underrun, prepare failed: %s\n", snd_strerror(err)); return 0; - } else if (err == -ESTRPIPE) { + } else if (err == -EAGAIN) { while ((err = snd_pcm_resume(handle)) == -EAGAIN) - sleep(1); /* wait until the suspend flag is released */ + usleep(100); /* wait until the suspend flag is released */ if (err < 0) { err = snd_pcm_prepare(handle); if (err < 0) @@ -396,15 +396,14 @@ int process (jack_nframes_t nframes, void *arg) { // now write the output... -again: err = snd_pcm_writei(alsa_handle, outbuf, src.output_frames_gen); + //err = snd_pcm_writei(alsa_handle, outbuf, src.output_frames_gen); if( err < 0 ) { printf( "err = %d\n", err ); if (xrun_recovery(alsa_handle, err) < 0) { - //printf("Write error: %s\n", snd_strerror(err)); - //exit(EXIT_FAILURE); + printf("Write error: %s\n", snd_strerror(err)); + exit(EXIT_FAILURE); } - goto again; } return 0;