much work on the player and hunting for a bug, which first seemed to be in ffmpeg-decoder, but eventually was found in a race condition in audio-placed-player.rkt and an allocation problem in libao-async-ffi-racket.rkt

This commit is contained in:
2026-05-15 22:11:25 +02:00
parent 3c18e75cf6
commit c9a91bf2be
11 changed files with 534 additions and 340 deletions
+4 -3
View File
@@ -225,12 +225,13 @@
)
(define (needed-bytes h)
(define (needed-bytes h elem-buflen)
(let ((req-bytes (/ (ao-handle-dev-bits-per-sample h) 8))
(rate-s (ao-handle-dev-rate h))
(channels (ao-handle-dev-channels h))
)
(/ (* req-bytes rate-s channels ao-buf-ms) 1000)
(let ((needed-for-ao (/ (* req-bytes rate-s channels ao-buf-ms) 1000)))
(max needed-for-ao elem-buflen))
)
)
@@ -256,7 +257,7 @@
(begin
(set-ao-handle-current-elem! h elem)
(set! cb elem)
(let* ((ns (needed-bytes h))
(let* ((ns (needed-bytes h (queue-elem-buflen elem)))
(new-buf (alloc-buf h ns)))
(m-memcpy new-buf (queue-elem-buf cb) (queue-elem-buflen cb))
(reuse-buf h (queue-elem-buf cb))