]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Use type long for delay as it corresp[onds with the alsa type used
authorMike Brady <mikebrady@eircom.net>
Tue, 29 Mar 2016 12:04:34 +0000 (12:04 +0000)
committerMike Brady <mikebrady@eircom.net>
Tue, 29 Mar 2016 12:04:34 +0000 (12:04 +0000)
audio.h
audio_alsa.c

diff --git a/audio.h b/audio.h
index 54b04e954e71aeab01a7d1dfdf1bfe9e9bd09710..2fbd2e05922a416a12a256a05707468298deae9e 100644 (file)
--- a/audio.h
+++ b/audio.h
@@ -32,7 +32,7 @@ typedef struct {
   // almost certainly wrong if the buffer is empty, so put silent buffers into it to make it busy.
   // will change dynamically, so keep watching it. Implemented in ALSA only.
   // returns -1 if there's a problem
-  int32_t (*delay)();
+  long (*delay)(); // snd_pcm_sframes_t is a signed long
 
   // may be NULL, in which case soft volume is applied
   void (*volume)(double vol);
index e29450fc1469ef6b003d2a28473688303f0ff4e1..06cc1bd0d87dd2f4b1b4dff52396d309df984ab7 100644 (file)
@@ -42,7 +42,7 @@ static void start(int sample_rate);
 static void play(short buf[], int samples);
 static void stop(void);
 static void flush(void);
-static int32_t delay(void);
+static long delay(void);
 static void volume(double vol);
 static void linear_volume(double vol);
 static void parameters(audio_parameters *info);
@@ -413,13 +413,14 @@ static void start(int sample_rate) {
   desired_sample_rate = sample_rate; // must be a variable
 }
 
-static int32_t delay() {
+static long delay() {
   // debug(3,"audio_alsa delay called.");
   if (alsa_handle == NULL) {
     return 0;
   } else {
     pthread_mutex_lock(&alsa_mutex);
     snd_pcm_sframes_t current_avail, current_delay = 0;
+    //snd_pcm_sframes_t is a signed long -- hence the return of a "long"
     int derr, ignore;
     if (snd_pcm_state(alsa_handle) == SND_PCM_STATE_RUNNING) {
 //      derr = snd_pcm_avail_delay(alsa_handle, &current_avail, &current_delay);