Reduce mixer and Bluetooth buffers from 500 ms to 200 ms
SBC medium, not the larger buffer, removed the headphone relay dropouts, so cut dmix, bluealsa-aplay and alsaloop buffers to 200 ms and the Shairport backend buffer to 0.15 s. Verified by listening (iPhone -> headphones, with AirPlay mixed in) with no RTP loss or underruns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -80,7 +80,7 @@ pcm.radxa_dmix {{
|
||||
channels 2
|
||||
period_time 0
|
||||
period_size {rate // 100}
|
||||
buffer_size {rate // 2}
|
||||
buffer_size {rate // 5}
|
||||
}}
|
||||
bindings {{ 0 0 1 1 }}
|
||||
}}
|
||||
@@ -105,7 +105,7 @@ def templates(c):
|
||||
name = {json.dumps(c['name'], ensure_ascii=False)};
|
||||
service_type = "airplay2";
|
||||
output_backend = "alsa";
|
||||
audio_backend_buffer_desired_length_in_seconds = 0.5;
|
||||
audio_backend_buffer_desired_length_in_seconds = 0.15;
|
||||
}};
|
||||
alsa = {{
|
||||
output_device = "radxa_mix";
|
||||
@@ -126,7 +126,7 @@ Group=audio
|
||||
PrivateUsers=false
|
||||
RemoveIPC=false
|
||||
ExecStart=
|
||||
ExecStart=/usr/bin/bluealsa-aplay -S --pcm=radxa_mix --volume=software --pcm-period-time=10000 --pcm-buffer-time=500000
|
||||
ExecStart=/usr/bin/bluealsa-aplay -S --pcm=radxa_mix --volume=software --pcm-period-time=10000 --pcm-buffer-time=200000
|
||||
''',
|
||||
'/etc/modules-load.d/radxa-audio-loopback.conf': 'snd-aloop\n',
|
||||
'/etc/modprobe.d/radxa-audio-loopback.conf': 'options snd-aloop pcm_substreams=1\n',
|
||||
@@ -143,7 +143,7 @@ StartLimitIntervalSec=0
|
||||
User=shairport-sync
|
||||
Group=audio
|
||||
ExecStartPre=-/usr/bin/bluetoothctl --timeout 8 connect {addr} a2dp-sink
|
||||
ExecStart=/usr/bin/alsaloop -C hw:Loopback,1,0 -P bluealsa:DEV={addr},PROFILE=a2dp -c 2 -r 48000 -f S16_LE -t 500000 -S 4 -A 2
|
||||
ExecStart=/usr/bin/alsaloop -C hw:Loopback,1,0 -P bluealsa:DEV={addr},PROFILE=a2dp -c 2 -r 48000 -f S16_LE -t 200000 -S 4 -A 2
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
TimeoutStartSec=30
|
||||
|
||||
Reference in New Issue
Block a user