summaryrefslogtreecommitdiff
path: root/src/buffer
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer')
-rw-r--r--src/buffer/clock.c5
-rw-r--r--src/buffer/clock.h1
-rw-r--r--src/buffer/video.c5
3 files changed, 9 insertions, 2 deletions
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;