From 34933b7e1d682e67702999270cd3ceec0e167316 Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Thu, 2 Jul 2026 17:52:27 -0400 Subject: Update deps, build fixes, cleanup Signed-off-by: Andrew Opalach --- src/buffer/audio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/buffer/audio.c') diff --git a/src/buffer/audio.c b/src/buffer/audio.c index 7c10dda..a815c66 100644 --- a/src/buffer/audio.c +++ b/src/buffer/audio.c @@ -145,8 +145,8 @@ static bool push_internal(struct camu_audio_buffer *buf, f64 pts, u8 **data, s32 } } - if (base_pts == -1.0) { - // We want this push() to set the pts even if sample_count = 0. + if (base_pts == -1.0) { // This push() has to set buf->pts even if sample_count = 0. + al_assert(!buf->buffered); atomic_store(f64)(&buf->pts, pts, AL_ATOMIC_RELEASE); } @@ -478,8 +478,8 @@ ptrdiff_t camu_audio_buffer_read(struct camu_audio_buffer *buf, u8 *data, ptrdif } out: - // We aren't safe to increment buf->pts from a different thread. - // For that we could accumulate the difference and atomic_add here instead. + // Updating buf->pts from the read() thread has to be done in a single step. + // atomic_add() at the points where base_pts is incremented would be incorrect. atomic_store(f64)(&buf->pts, base_pts, AL_ATOMIC_RELEASE); // To signal EOF, return less then req. -- cgit v1.2.3-101-g0448