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:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user