Browse Source

[alsa_out] change xrun handling... gonna revert.

git-svn-id: svn+ssh://jackaudio.org/trunk/jack@3376 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.117.0
torben 17 years ago
parent
commit
7f955b1bc7
1 changed files with 6 additions and 7 deletions
  1. +6
    -7
      tools/alsa_out.c

+ 6
- 7
tools/alsa_out.c View File

@@ -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;


Loading…
Cancel
Save