Browse Source

Try writing 5 times before aborting

pull/11/head
Jeanine Adkisson GitHub 4 years ago
parent
commit
d6fb8be60e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 6 deletions
  1. +10
    -6
      alsa_in.c

+ 10
- 6
alsa_in.c View File

@@ -21,6 +21,8 @@


#include <samplerate.h> #include <samplerate.h>


#define XRUN_ABORT_COUNT 5

// Here are the lists of the jack ports... // Here are the lists of the jack ports...


JSList *capture_ports = NULL; JSList *capture_ports = NULL;
@@ -434,15 +436,17 @@ int process (jack_nframes_t nframes, void *arg) {
resample_mean = 0.9999 * resample_mean + 0.0001 * current_resample_factor; resample_mean = 0.9999 * resample_mean + 0.0001 * current_resample_factor;


// get the data... // get the data...
int loop_count = 0;
again: again:
err = snd_pcm_readi(alsa_handle, outbuf, rlen); err = snd_pcm_readi(alsa_handle, outbuf, rlen);
if( err < 0 ) { 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);
}
goto again;
printf( "err = %d\n", err );
if (xrun_recovery(alsa_handle, err) < 0 && loop_count > XRUN_ABORT_COUNT) {
printf("Write error: %s\n", snd_strerror(err));
exit(EXIT_FAILURE);
}
loop_count++;
goto again;
} }
if( err != rlen ) { if( err != rlen ) {
//printf( "read = %d\n", rlen ); //printf( "read = %d\n", rlen );


Loading…
Cancel
Save