Remove useless skip feature in audio buffer

After the refactor from the previous commit, sc_audiobuf_read() is never
called with a NULL destination (used to skip samples).
This commit is contained in:
Romain Vimont 2024-05-27 13:49:59 +02:00
parent a14b798185
commit c74b716e11

View file

@ -37,6 +37,7 @@ sc_audiobuf_read(struct sc_audiobuf *buf, void *to_, uint32_t samples_count) {
assert(samples_count);
uint8_t *to = to_;
assert(to);
// The tail cursor may be updated by the writer thread to drop samples
uint32_t tail = atomic_load_explicit(&buf->tail, memory_order_acquire);
@ -52,7 +53,6 @@ sc_audiobuf_read(struct sc_audiobuf *buf, void *to_, uint32_t samples_count) {
samples_count = can_read;
}
if (to) {
uint32_t right_count = buf->alloc_size - tail;
if (right_count > samples_count) {
right_count = samples_count;
@ -67,7 +67,6 @@ sc_audiobuf_read(struct sc_audiobuf *buf, void *to_, uint32_t samples_count) {
buf->data,
left_count * buf->sample_size);
}
}
uint32_t new_tail = (tail + samples_count) % buf->alloc_size;
atomic_store_explicit(&buf->tail, new_tail, memory_order_release);