Audio bundle re-unpacks whenever its contents change; the DirectAudio sink logs the buffer it asked for and what the relay settled at

The unpack check compared a hand-bumped stamp only. Two sink changes shipped without a bump, so a
device that had run the earlier build kept the old module: the 40 ms ring floor and the 24 ms
device buffer never reached the AYN Thor they were for. The stamp now carries a CRC-32 of
pulseaudio.tzst. The sink's connect line names the buffer it asked for, and one line ten seconds
in reports the relay's device buffer, ring target and underruns.
This commit is contained in:
The412Banner committed 2026-09-23 11:50:24 -04:00
1 parent 4c43fe3502
commit 8dd0043072
2 files changed
+29 -6

No files matched your search

+10 -2
View File
@@ -102,6 +102,7 @@ struct userdata {
pa_usec_t offline_at;
pa_usec_t stats_at;
uint32_t underruns_reported;
pa_usec_t settled_at;
};
static void disconnect_relay(struct userdata *u) {
@@ -189,9 +190,10 @@ static int connect_relay(struct userdata *u) {
if (u->ring->rate != u->ss.rate)
pa_log("directaudio-sink: the relay's ring runs at %u Hz, the sink at %u; expect resampling artefacts", u->ring->rate, u->ss.rate);
u->stats_at = pa_rtclock_now();
u->settled_at = u->stats_at + 10 * PA_USEC_PER_SEC;
u->underruns_reported = u->ring->underruns;
pa_log("directaudio-sink: connected to the relay: %d Hz, burst %d, device buffer %d frames, ring %d frames, target %d",
ack.rate, ack.burst, ack.buf_frames, ack.out_cap_frames, (int) u->ring->target_frames);
pa_log("directaudio-sink: connected to the relay: %d Hz, burst %d, device buffer %d frames (asked %u ms), ring %d frames, target %d",
ack.rate, ack.burst, ack.buf_frames, u->buffer_ms, ack.out_cap_frames, (int) u->ring->target_frames);
return 0;
fail:
@@ -262,6 +264,12 @@ static int service_ring(struct userdata *u) {
if (want > 0)
produce(u, want);
}
/* Once, ten seconds in: what the relay's buffer has settled at, so a session log shows it. */
if (u->settled_at && pa_rtclock_now() >= u->settled_at) {
pa_log("directaudio-sink: after 10 s: device buffer %d frames, ring target %d, relay underruns %u",
(int) r->hw_buf_frames, (int) r->target_frames, r->underruns);
u->settled_at = 0;
}
if (r->underruns != u->underruns_reported && pa_rtclock_now() - u->stats_at >= STATS_EVERY_USEC) {
pa_log("directaudio-sink: relay reports %u underrun(s), target %d frames, device buffer %d", r->underruns, (int) r->target_frames, (int) r->hw_buf_frames);
u->underruns_reported = r->underruns;