]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Fixes 4.1-rc1
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Wed, 5 Oct 2022 09:15:45 +0000 (10:15 +0100)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Wed, 5 Oct 2022 09:15:45 +0000 (10:15 +0100)
Makefile.am
audio_alsa.c

index b681ed3e6657c93f29089c2c3a59a7bb7ccac024..1dc654cc8f6288485945a199d5f313031941e84f 100644 (file)
@@ -267,9 +267,13 @@ if INSTALL_SYSTEMV
 
 INSTALL_SYSTEMV_TARGET = install-systemv-local
 
+# watch out -- shairport-sync is created during the ./configure step and
+# will be stored in a scripts folder in the _build_ folder
+# which will be the source folder if you're not using a separate build folder
+
 $(INSTALL_SYSTEMV_TARGET): scripts/shairport-sync $(INSTALL_USER_TARGET)
        install -d $(DESTDIR)$(sysconfdir)/init.d
-       [ -e $(DESTDIR)$(sysconfdir)/init.d/shairport-sync ] || install -m 0644 $(top_srcdir)/scripts/shairport-sync $(DESTDIR)$(sysconfdir)/init.d
+       [ -e $(DESTDIR)$(sysconfdir)/init.d/shairport-sync ] || install -m 0755 scripts/shairport-sync $(DESTDIR)$(sysconfdir)/init.d
 
 endif # INSTALL_SYSTEMV
 
@@ -283,9 +287,13 @@ endif # USE_AVAHI
 
 INSTALL_SYSTEMD_TARGET = install-systemd-local
 
+# watch out -- shairport-sync.service is created during the ./configure step and
+# will be stored in a scripts folder in the _build_ folder
+# which will be the source folder if you're not using a separate build folder
+
 $(INSTALL_SYSTEMD_TARGET): scripts/$(SYSTEMD_SERVICE) $(INSTALL_USER_TARGET)
        install -d $(DESTDIR)$(systemdsystemunitdir)
-       [ -e $(DESTDIR)$(systemdsystemunitdir)/shairport-sync.service ] || install -m 0644 $(top_srcdir)/scripts/$(SYSTEMD_SERVICE) $(DESTDIR)$(systemdsystemunitdir)/shairport-sync.service
+       [ -e $(DESTDIR)$(systemdsystemunitdir)/shairport-sync.service ] || install -m 0644 scripts/$(SYSTEMD_SERVICE) $(DESTDIR)$(systemdsystemunitdir)/shairport-sync.service
 
 endif # INSTALL_SYSTEMD
 
index fc53ee65edef8fb6c5c1d2cbc5e6d8650ece0687..62db843fc17bad80db2e50387b8daae52d167044 100644 (file)
@@ -1850,7 +1850,8 @@ static int do_close() {
     // debug(1,"alsa: do_close() -- closing the output device");
     if ((derr = snd_pcm_drop(alsa_handle)))
       debug(1, "Error %d (\"%s\") dropping output device.", derr, snd_strerror(derr));
-    usleep(5000); // this make the function pthread cancellable
+    usleep(10000); // wait for the hardware to do its trick. BTW, this make the function pthread
+                   // cancellable
     if ((derr = snd_pcm_hw_free(alsa_handle)))
       debug(1, "Error %d (\"%s\") freeing the output device hardware.", derr, snd_strerror(derr));
     debug(2, "alsa: do_close() -- closing alsa handle");
@@ -2061,9 +2062,12 @@ static void *alsa_buffer_monitor_thread_code(__attribute__((unused)) void *arg)
   int error_count = 0;
   int error_detected = 0;
   int okb = -1;
-  while (error_detected ==
-         0) { // if too many play errors occur early on, we will turn off the disable stanby mode
+  // if too many play errors occur early on, we will turn off the disable standby mode
+  while (error_detected == 0) {
+    int keep_dac_busy_has_just_gone_off = 0;
     if (okb != config.keep_dac_busy) {
+      if ((okb != 0) && (config.keep_dac_busy == 0))
+        keep_dac_busy_has_just_gone_off = 1;
       debug(2, "keep_dac_busy is now \"%s\"", config.keep_dac_busy == 0 ? "no" : "yes");
       okb = config.keep_dac_busy;
     }
@@ -2081,7 +2085,7 @@ static void *alsa_buffer_monitor_thread_code(__attribute__((unused)) void *arg)
       if (do_open(1) == 0) // no automatic setup of rate and speed if necessary
         debug(2, "alsa: alsa_buffer_monitor_thread_code() -- output device opened; "
                  "alsa_backend_state => abm_connected");
-    } else if ((alsa_backend_state == abm_connected) && (config.keep_dac_busy == 0)) {
+    } else if ((alsa_backend_state != abm_disconnected) && (keep_dac_busy_has_just_gone_off != 0)) {
       stall_monitor_start_time = 0;
       // frame_index = 0;
       // measurement_data_is_valid = 0;