Permalink
Browse files

macaudio: Reduce buffers to a sane value and print when we get underruns

  • Loading branch information...
1 parent 5efa687 commit 77efa3728efe30758ab797c9ab8340f106e7fefd @andoma committed Nov 15, 2012
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/audio2/mac_audio.c
View
@@ -6,7 +6,7 @@
#include "audio.h"
#include "media.h"
-#define NUM_BUFS 1000
+#define NUM_BUFS 3
typedef struct decoder {
audio_decoder_t ad;
@@ -35,6 +35,13 @@ return_buf(void *aux, AudioQueueRef aq, AudioQueueBufferRef buf)
d->buffers[i].avail = 1;
hts_cond_signal(&mp->mp_audio.mq_avail);
hts_mutex_unlock(&mp->mp_mutex);
+ int tavail = 0;
+ for(i = 0; i < NUM_BUFS; i++) {
+ if(d->buffers[i].avail)
+ tavail++;
+ }
+ if(tavail == NUM_BUFS)
+ printf("Underrun!\n");
return;
}
}

0 comments on commit 77efa37

Please sign in to comment.