]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
mutex lock was protecting the wrong variable, duh.
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Sat, 30 Sep 2023 14:41:40 +0000 (15:41 +0100)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Sat, 30 Sep 2023 14:41:40 +0000 (15:41 +0100)
audio_pa.c

index 1ba82b3434724e08ae8062562ed77c296ed17977..bd13cfefd5d057c4f598093702c93412abec7bfb 100644 (file)
@@ -262,10 +262,10 @@ static int play(void *buf, int samples, __attribute__((unused)) int sample_type,
   size_t space_to_end_of_buffer = audio_umb - audio_eoq;
   if (space_to_end_of_buffer >= bytes_to_transfer) {
     memcpy(audio_eoq, buf, bytes_to_transfer);
-    audio_occupancy += bytes_to_transfer;
     pthread_mutex_lock(&buffer_mutex);
-    audio_eoq += bytes_to_transfer;
+    audio_occupancy += bytes_to_transfer;
     pthread_mutex_unlock(&buffer_mutex);
+    audio_eoq += bytes_to_transfer;
   } else {
     memcpy(audio_eoq, buf, space_to_end_of_buffer);
     buf += space_to_end_of_buffer;