Bug fix, docker-compose updates, statistics readoout improvement.

This commit is contained in:
Mike Brady
2026-07-02 14:17:53 +01:00
4 changed files with 43 additions and 7 deletions
+15 -4
View File
@@ -151,7 +151,6 @@ void *rtp_buffered_audio_processor(void *arg) {
debug(1, "cannot allocate an audio buffer of %zu bytes!", buffered_audio->buffer_max_size);
pthread_cleanup_push(malloc_cleanup, &buffered_audio->buffer);
// pthread_mutex_lock(&conn->buffered_audio_mutex);
buffered_audio->toq = buffered_audio->buffer;
buffered_audio->eoq = buffered_audio->buffer;
@@ -161,10 +160,20 @@ void *rtp_buffered_audio_processor(void *arg) {
"ap2_buf_rdr_%d", conn->connection_number);
pthread_cleanup_push(thread_cleanup, buffered_reader_thread);
const size_t buffer_packet_size = 16 * 1024; // it looks as if 4096 is the largest size (?)
uint8_t *packet = malloc(buffer_packet_size);
if (packet == NULL)
debug(1, "cannot allocate an audio packet buffer of %zu bytes!", buffer_packet_size);
pthread_cleanup_push(malloc_cleanup, &packet);
const size_t leading_free_space_length =
256; // leave this many bytes free to make room for prefixes that might be added later
uint8_t packet[32 * 1024];
unsigned char m[32 * 1024 + leading_free_space_length];
unsigned char *m = malloc(buffer_packet_size + leading_free_space_length);
if (m == NULL)
debug(1, "cannot allocate an audio m buffer of %zu bytes!", buffer_packet_size + leading_free_space_length);
pthread_cleanup_push(malloc_cleanup, &m);
// unsigned char m[32 * 1024 + leading_free_space_length];
unsigned char *payload_pointer = NULL;
unsigned long long payload_length = 0;
@@ -365,7 +374,7 @@ void *rtp_buffered_audio_processor(void *arg) {
unsigned int f = 0;
for (f = 0; f < MAX_DEFERRED_FLUSH_REQUESTS; f++) {
if ((conn->ap2_deferred_flush_requests[f].inUse != 0) &&
(conn->ap2_deferred_flush_requests[f].active = 0)) {
(conn->ap2_deferred_flush_requests[f].active == 0)) {
debug(1,
"deferred flush cancelled by an immediate flush: flushFromTS: %12u, "
"flushFromSeq: %12u, "
@@ -690,6 +699,8 @@ void *rtp_buffered_audio_processor(void *arg) {
} while (finished == 0);
// debug(1, "Connection %d: rtp_buffered_audio_processor PID %d exiting", conn->connection_number,
// syscall(SYS_gettid));
pthread_cleanup_pop(1); // m
pthread_cleanup_pop(1); // packet
pthread_cleanup_pop(1); // buffered_tcp_reader thread creation
pthread_cleanup_pop(1); // buffer malloc
pthread_cleanup_pop(1); // not_full_cv
+19
View File
@@ -120,6 +120,25 @@ WORKDIR /
##### DEV #####
FROM shairport-sync AS dev
RUN apk add bash
RUN apk add gdb
RUN apk add valgrind
RUN ulimit -c unlimited
WORKDIR /shairport-sync/build
# Rebuild with no optimisation and debug symbols in place
RUN CFLAGS="-O0 -g" CXXFLAGS="-O0 -g" ../configure --sysconfdir=/etc --with-alsa --with-pulseaudio --with-soxr --with-avahi --with-ssl=openssl \
--with-airplay-2 --with-metadata --with-dummy --with-pipe --with-dbus-interface \
--with-stdout --with-mpris-interface --with-mqtt-client \
--with-convolution --with-pipewire
RUN make clean
RUN make
RUN DESTDIR=install make install
WORKDIR /
RUN addgroup shairport-sync && \
adduser -D shairport-sync -G shairport-sync && \
+4 -2
View File
@@ -5,20 +5,22 @@ services:
image: mikebrady/shairport-sync:latest
network_mode: host # Required for AirPlay 2
restart: unless-stopped
cap_add:
- SYS_NICE
# environment:
# PULSE_SERVER: unix:/tmp/pulseaudio.socket # Path for PulseAudio socket
# PULSE_COOKIE: /tmp/pulseaudio.cookie # Path for PulseAudio cookie
# XDG_RUNTIME_DIR: /tmp # Path for pipewire
# ENABLE_AVAHI: 0 # Disable DBus and Avahi daemon inside the container
devices:
- "/dev/snd" # ALSA device, omit if using PulseAudio
- "/dev/snd" # For access to ALSA devices-- unnecessary unless you are outputting to an ALSA hardware device
# volumes:
# - ./volumes/shairport-sync/shairport-sync.conf:/etc/shairport-sync.conf # Customised Shairport Sync configuration file.
# - /run/user/1000/pulse/native:/tmp/pulseaudio.socket # PulseAudio socket when using that backend
# - /run/user/1000/pipewire-0:/tmp/pipewire-0 # Pipewire socket when using pipewire
# - /var/run/dbus:/var/run/dbus # DBus when ENABLE_AVAHI set to 0
# - /var/run/avahi-daemon:/var/run/avahi-daemon # Avahi socket when ENABLE_AVAHI set to 0
# command: -o pw # You can specify the desired output with command:
# command: -o pipewire # Add any options for Shairport Sync here, e.g. output backend PipeWire
logging:
options:
max-size: "200k"
+5 -1
View File
@@ -4093,7 +4093,11 @@ void *player_thread_func(void *arg) {
statistics_item(" Late", "%*" PRIu64 "", 6, conn->late_packets);
statistics_item("Too Late", "%*" PRIu64 "", 8, conn->too_late_packets);
statistics_item("Resend Reqs", "%*" PRIu64 "", 11, conn->resend_requests);
statistics_item("Min DAC Queue", "%*" PRIu64 "", 13, minimum_dac_queue_size);
if (minimum_dac_queue_size == UINT64_MAX) {
statistics_item("Min DAC Queue", " n/a"); // same size as below, right justified
} else {
statistics_item("Min DAC Queue", "%*" PRIu64 "", 13, minimum_dac_queue_size);
}
statistics_item("Min Buffers", "%*" PRIu32 "", 11, minimum_buffer_occupancy);
statistics_item("Max Buffers", "%*" PRIu32 "", 11, maximum_buffer_occupancy);
#ifdef CONFIG_AIRPLAY_2