From d81c406f62e996840d86333b81c41d0ae4aff347 Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Sat, 7 Dec 2024 23:47:36 -0500 Subject: Synced list reference 1 This marks a point where the list behavior is at least moderately robust for the skip operation. It includes fixes for multiple deep-rooted issues found by testing with input simulation. Signed-off-by: Andrew Opalach --- src/buffer/clock.c | 5 +++++ src/buffer/clock.h | 1 + src/buffer/video.c | 5 +++-- 3 files changed, 9 insertions(+), 2 deletions(-) (limited to 'src/buffer') diff --git a/src/buffer/clock.c b/src/buffer/clock.c index e1813f7..705a525 100644 --- a/src/buffer/clock.c +++ b/src/buffer/clock.c @@ -69,6 +69,11 @@ void camu_clock_resume(struct camu_clock *clock, u64 target) clock->paused_at = -1.0; } +bool camu_clock_is_armed(struct camu_clock *clock) +{ + return al_atomic_load(f64)(&clock->pause, AL_ATOMIC_RELAXED) != RUNNING; +} + bool camu_clock_is_paused(struct camu_clock *clock) { return al_atomic_load(f64)(&clock->pause, AL_ATOMIC_RELAXED) == PAUSED; diff --git a/src/buffer/clock.h b/src/buffer/clock.h index 64f4ddb..aae87cc 100644 --- a/src/buffer/clock.h +++ b/src/buffer/clock.h @@ -43,6 +43,7 @@ void camu_clock_offset(struct camu_clock *clock, f64 amount); void camu_clock_pause(struct camu_clock *clock, u64 ts); void camu_clock_resume(struct camu_clock *clock, u64 ts); +bool camu_clock_is_armed(struct camu_clock *clock); bool camu_clock_is_paused(struct camu_clock *clock); f64 camu_clock_get_base_pts(struct camu_clock *clock); diff --git a/src/buffer/video.c b/src/buffer/video.c index ba43685..2879082 100644 --- a/src/buffer/video.c +++ b/src/buffer/video.c @@ -20,8 +20,9 @@ bool camu_video_buffer_init(struct camu_video_buffer *buf, struct camu_clock *cl buf->clock = clock; buf->latency = 0.0; al_atomic_store(f64)(&buf->pts, -1.0, AL_ATOMIC_RELAXED); - // Defaulting single_frame to true can simplify non-configured buffers in sink. - buf->single_frame = true; + // The least confusing behavior for single_frame is that it can't be + // set unless the buffer is not empty. + buf->single_frame = false; buf->avg_frame_duration = 0.0; buf->queue = NULL; buf->buffered = false; -- cgit v1.2.3-101-g0448