summaryrefslogtreecommitdiff
path: root/src/buffer
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2024-12-02 19:46:55 -0500
committerAndrew Opalach <andrew@akon.city> 2024-12-02 19:46:55 -0500
commit61d2d6fd165ebfc3d3985e89000964e9b11c5157 (patch)
treedb50b4a265f85c2bef7b41f2810bf2faf0e02ba9 /src/buffer
parent01ab651a6c4a7894eef972f5236996754b0967bb (diff)
downloadcamu-61d2d6fd165ebfc3d3985e89000964e9b11c5157.tar.gz
camu-61d2d6fd165ebfc3d3985e89000964e9b11c5157.tar.bz2
camu-61d2d6fd165ebfc3d3985e89000964e9b11c5157.zip
Explicitly track sink-side entry ended state
The server/list-side of this change is not done so there are likely bugs in the set command logic. It works mostly fine for now though. Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/buffer')
-rw-r--r--src/buffer/audio.c2
-rw-r--r--src/buffer/clock.c13
-rw-r--r--src/buffer/clock.h2
-rw-r--r--src/buffer/video.c1
4 files changed, 3 insertions, 15 deletions
diff --git a/src/buffer/audio.c b/src/buffer/audio.c
index ac698bb..89f1b70 100644
--- a/src/buffer/audio.c
+++ b/src/buffer/audio.c
@@ -211,6 +211,7 @@ void camu_audio_buffer_unpause(struct camu_audio_buffer *buf)
// flush() always comes from the same thread as push().
void camu_audio_buffer_flush(struct camu_audio_buffer *buf)
{
+ al_log_debug("audio_buffer", "Flush requested.");
if (buf->fmt.resampler_needed) {
s32 sample_count = buf->resamp->flush(buf->resamp);
if (sample_count > 0) {
@@ -226,7 +227,6 @@ void camu_audio_buffer_flush(struct camu_audio_buffer *buf)
buf->buffered = true;
}
al_atomic_store(u8)(&buf->flow, FLUSHED, AL_ATOMIC_RELAXED);
- al_log_debug("audio_buffer", "Flush requested.");
}
// Not thread-safe, must be called while the buffer is not being read from or written to.
diff --git a/src/buffer/clock.c b/src/buffer/clock.c
index cee0ec7..e1813f7 100644
--- a/src/buffer/clock.c
+++ b/src/buffer/clock.c
@@ -5,7 +5,6 @@
#define RUNNING 0.0
#define PAUSED -DBL_MAX
-#define ENDED DBL_MAX
void camu_clock_init(struct camu_clock *clock, void (*callback)(void *, u8), void *userdata)
{
@@ -75,16 +74,6 @@ bool camu_clock_is_paused(struct camu_clock *clock)
return al_atomic_load(f64)(&clock->pause, AL_ATOMIC_RELAXED) == PAUSED;
}
-void camu_clock_end(struct camu_clock *clock)
-{
- al_atomic_store(f64)(&clock->pause, ENDED, AL_ATOMIC_RELAXED);
-}
-
-bool camu_clock_is_ended(struct camu_clock *clock)
-{
- return al_atomic_load(f64)(&clock->pause, AL_ATOMIC_RELAXED) == ENDED;
-}
-
f64 camu_clock_get_base_pts(struct camu_clock *clock)
{
return clock->base;
@@ -93,7 +82,7 @@ f64 camu_clock_get_base_pts(struct camu_clock *clock)
f64 camu_clock_get_pts(struct camu_clock *clock, f64 offset)
{
f64 pause = al_atomic_load(f64)(&clock->pause, AL_ATOMIC_ACQUIRE);
- if (pause == PAUSED || pause == ENDED) return -1.0;
+ if (pause == PAUSED) return -1.0;
f64 current = aki_get_tick();
f64 tick = al_atomic_load(f64)(&clock->tick, AL_ATOMIC_RELAXED);
if (tick == -1.0) {
diff --git a/src/buffer/clock.h b/src/buffer/clock.h
index 17edb0d..64f4ddb 100644
--- a/src/buffer/clock.h
+++ b/src/buffer/clock.h
@@ -44,8 +44,6 @@ 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_paused(struct camu_clock *clock);
-void camu_clock_end(struct camu_clock *clock);
-bool camu_clock_is_ended(struct camu_clock *clock);
f64 camu_clock_get_base_pts(struct camu_clock *clock);
f64 camu_clock_get_pts(struct camu_clock *clock, f64 offset);
diff --git a/src/buffer/video.c b/src/buffer/video.c
index 30e19c7..92bcb2d 100644
--- a/src/buffer/video.c
+++ b/src/buffer/video.c
@@ -202,6 +202,7 @@ void camu_video_buffer_push_subtitle(struct camu_video_buffer *buf, AVPacket *pk
// flush() always comes from the same thread as push().
void camu_video_buffer_flush(struct camu_video_buffer *buf)
{
+ al_log_debug("video_buffer", "Flush requested.");
buf->queue->flush(buf->queue);
if (!buf->buffered) {
f64 have = buf->queue->count(buf->queue) * buf->avg_frame_duration;