diff options
| author | 2025-01-25 14:42:33 -0500 | |
|---|---|---|
| committer | 2025-01-25 14:42:33 -0500 | |
| commit | 390515d40c115217d27be3f74c38d4d3eefde02b (patch) | |
| tree | f670365698e845055ff13398076f71e4a5e8206f /src/buffer | |
| parent | f638237a6b4f3d3edf9bdd995c15df537f8d7e7c (diff) | |
| download | camu-390515d40c115217d27be3f74c38d4d3eefde02b.tar.gz camu-390515d40c115217d27be3f74c38d4d3eefde02b.tar.bz2 camu-390515d40c115217d27be3f74c38d4d3eefde02b.zip | |
Discard packet_stream queue on demote
- Cleanup some comments.
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/buffer')
| -rw-r--r-- | src/buffer/audio.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/buffer/audio.c b/src/buffer/audio.c index ce027af..2e65a97 100644 --- a/src/buffer/audio.c +++ b/src/buffer/audio.c @@ -166,7 +166,7 @@ static bool push_internal(struct camu_audio_buffer *buf, f64 pts, u8 **data, s32 peak += have; if (peak >= buf->mark.min) { // If this happens the writer of this buffer is taking way too long to stop. - al_log_warn("audio_buffer", "Overrun likely, discarding peak buffer."); + al_log_warn("audio_buffer", "Overrun likely, discarding peak buffer (audio will be desynced)."); camu_peak_buffer_flush(&buf->peak); peak = 0; } @@ -256,8 +256,8 @@ void camu_audio_buffer_unpause(struct camu_audio_buffer *buf) al_atomic_add(s32)(&buf->unpause, 1, AL_ATOMIC_RELAXED); } -// PAUSE_PAUSED signifies that the last read was silence. Meaning we can skip -// around in the buffer without worrying about pops. +// PAUSE_PAUSED signifies that the last read was silence. +// This means we can skip around in the buffer without worrying about pops. ptrdiff_t camu_audio_buffer_read(struct camu_audio_buffer *buf, u8 *data, ptrdiff_t req) { if (al_atomic_load(s32)(&buf->volume.set, AL_ATOMIC_ACQUIRE) > 0) { @@ -317,6 +317,9 @@ ptrdiff_t camu_audio_buffer_read(struct camu_audio_buffer *buf, u8 *data, ptrdif else have -= buf->fade.offset; #endif + // @NOTE: We are not safe to increment buf->pts from a different thread. + // We would need to accumulate the difference and do an atomic add instead + // of the load/store we do here. f64 base_pts = al_atomic_load(f64)(&buf->pts, AL_ATOMIC_ACQUIRE); // Unpause and possibly attempt syncing to the clock. if (UNLIKELY(buf->pause == PAUSE_PAUSED)) { |