]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Need to use an untimed play for the silence buffer filler.
authorMike Brady <mikebrady@eircom.net>
Mon, 17 Dec 2018 16:44:19 +0000 (16:44 +0000)
committerMike Brady <mikebrady@eircom.net>
Mon, 17 Dec 2018 16:44:19 +0000 (16:44 +0000)
audio_alsa.c

index 17fc672ae11a76c39c6662cb5188edd5c1bc6225..f9ce58405242df2d03325a07d152a50c06d6a08f 100644 (file)
@@ -133,7 +133,7 @@ static uint64_t frames_played_at_measurement_start_time;
 static uint64_t measurement_time;
 static uint64_t frames_played_at_measurement_time;
 
-static uint64_t most_recent_write_time;
+volatile uint64_t most_recent_write_time;
 
 static uint64_t frames_sent_for_playing;
 static uint64_t frame_index;
@@ -1135,7 +1135,8 @@ int get_rate_information(uint64_t *elapsed_time, uint64_t *frames_played) {
   return response;
 }
 
-static int play(void *buf, int samples) {
+int untimed_play(void *buf, int samples) {
+       
   // debug(3,"audio_alsa play called.");
   int oldState;
   pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldState); // make this un-cancellable
@@ -1178,7 +1179,6 @@ static int play(void *buf, int samples) {
         debug(1, "empty buffer being passed to pcm_writei -- skipping it");
       if ((samples != 0) && (buf != NULL)) {
         // debug(3, "write %d frames.", samples);
-                               most_recent_write_time = get_absolute_time_in_fp();
         err = alsa_pcm_write(alsa_handle, buf, samples);
 
         stall_monitor_frame_count += samples;
@@ -1283,6 +1283,11 @@ static void flush(void) {
   pthread_setcancelstate(oldState, NULL);
 }
 
+static int play(void *buf, int samples) {
+       most_recent_write_time = get_absolute_time_in_fp(); // this is to regulate access by the silence filler threrad
+       return untimed_play(buf,samples);
+}
+
 static void stop(void) {
   // debug(2,"audio_alsa stop called.");
   // when we want to stop, we want the alsa device