From 2603d23e12dc5c2c5d9eb284e3bdc940963936c8 Mon Sep 17 00:00:00 2001 From: Nick Steel Date: Tue, 11 Aug 2015 00:08:36 +0100 Subject: [PATCH 1/2] Use DESTDIR when checking systemv script exists --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index c6f6ed13..0a4239a0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -58,7 +58,7 @@ if INSTALL_CONFIG_FILES endif if INSTALL_SYSTEMV [ -e $(DESTDIR)/etc/init.d ] || mkdir -p $(DESTDIR)/etc/init.d - [ -f /etc/init.d/shairport-sync ] || cp scripts/shairport-sync $(DESTDIR)/etc/init.d/ + [ -f $(DESTDIR)/etc/init.d/shairport-sync ] || cp scripts/shairport-sync $(DESTDIR)/etc/init.d/ update-rc.d shairport-sync defaults 90 10 endif if INSTALL_SYSTEMD From 970300733105e5c67418bf6871f199a5baa627e9 Mon Sep 17 00:00:00 2001 From: Mke Brady Date: Wed, 12 Aug 2015 20:25:04 +0100 Subject: [PATCH 2/2] Don't start stuffing in the first five seconds. Allow 1:300 stuffing after 30 seconds. --- player.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/player.c b/player.c index 63c20df5..7c269652 100644 --- a/player.c +++ b/player.c @@ -130,7 +130,7 @@ static pthread_mutex_t ab_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t flush_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_cond_t flowcontrol; -static int64_t first_packet_time_to_play; // nanoseconds +static int64_t first_packet_time_to_play, time_since_play_started; // nanoseconds static audio_parameters audio_information; @@ -441,6 +441,7 @@ static abuf_t *buffer_get_frame(void) { ab_resync(); first_packet_timestamp = 0; first_packet_time_to_play = 0; + time_since_play_started = 0; flush_requested = 0; } pthread_mutex_unlock(&flush_mutex); @@ -559,6 +560,7 @@ static abuf_t *buffer_get_frame(void) { ab_resync(); first_packet_timestamp = 0; first_packet_time_to_play = 0; + time_since_play_started = 0; } else { if (config.output->delay) { dac_delay = config.output->delay(); @@ -1013,20 +1015,20 @@ static void *player_thread_func(void *arg) { // calculate the time elapsed since the play session started. - uint64_t time_since_play_started = local_time_now - first_packet_time_to_play; - if ((local_time_now) && (first_packet_time_to_play)) { - uint64_t t = tens_of_seconds; - tens_of_seconds = (time_since_play_started / 10)>>32; - // if (tens_of_seconds!=t) - // debug(1,"%llu seconds of play have elapsed.",tens_of_seconds*10); - } - if (amount_to_stuff) { - uint32_t x = random() % 1000; - if (x > 352) - amount_to_stuff = 0; - } + if ((local_time_now) && (first_packet_time_to_play) && (local_time_now >= first_packet_time_to_play)) { + int64_t tp = (local_time_now - first_packet_time_to_play)>>32; // seconds + + if (tp<5) + amount_to_stuff = 0; // wait at least five seconds + else if (tp<30) { + if ((random() % 1000) > 352) // keep it to about 1:1000 for the first thirty seconds + amount_to_stuff = 0; + } + } + } + if ((amount_to_stuff == 0) && (fix_volume == 0x10000)) { // if no stuffing needed and no volume adjustment, then // don't send to stuff_buffer_* and don't copy to outbuf; just send directly to the