summaryrefslogtreecommitdiff
path: root/src/buffer/audio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer/audio.c')
-rw-r--r--src/buffer/audio.c8
1 files changed, 4 insertions, 4 deletions
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.