diff options
Diffstat (limited to 'src/buffer')
| -rw-r--r-- | src/buffer/clock.c | 4 | ||||
| -rw-r--r-- | src/buffer/video.c | 4 | ||||
| -rw-r--r-- | src/buffer/video.h | 3 | ||||
| -rw-r--r-- | src/buffer/video_null.h | 4 | ||||
| -rw-r--r-- | src/buffer/volume.h | 4 |
5 files changed, 9 insertions, 10 deletions
diff --git a/src/buffer/clock.c b/src/buffer/clock.c index a1a1eab..6a30af9 100644 --- a/src/buffer/clock.c +++ b/src/buffer/clock.c @@ -1,4 +1,3 @@ -#include <al/lib.h> #include <nnwt/thread.h> #include "clock.h" @@ -46,7 +45,7 @@ void camu_clock_seek(struct camu_clock *clock, f64 base, u64 target) } } else { // The value of clock->pause cannot be touched here. A reconnecting entry - // may still be relying on a clock paused callback for sync. + // may be relying on a CLOCK_PAUSED callback for sync. clock->paused_at = 0.0; } } @@ -98,6 +97,7 @@ void camu_clock_resume(struct camu_clock *clock, u64 target) } al_atomic_store(f64)(&clock->pause, RUNNING, AL_ATOMIC_RELAXED); + clock->paused_at = -1.0; } diff --git a/src/buffer/video.c b/src/buffer/video.c index 54d83af..67b23f6 100644 --- a/src/buffer/video.c +++ b/src/buffer/video.c @@ -23,6 +23,7 @@ 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); + buf->reset_pts = -1.0; // The least confusing behavior for single_frame is that it can't be // set if the buffer is empty. buf->single_frame = false; @@ -211,7 +212,8 @@ void camu_video_buffer_flush(struct camu_video_buffer *buf) // Not thread-safe, must be called while the buffer is not being read from or written to. void camu_video_buffer_reset(struct camu_video_buffer *buf) { - al_atomic_store(f64)(&buf->pts, -1.0, AL_ATOMIC_RELAXED); + buf->reset_pts = al_atomic_load(f64)(&buf->pts, AL_ATOMIC_ACQUIRE); + al_atomic_store(f64)(&buf->pts, -1.0, AL_ATOMIC_RELEASE); if (buf->queue) buf->queue->reset(buf->queue); buf->buffered = false; al_atomic_store(u8)(&buf->flow, FLOWING, AL_ATOMIC_RELAXED); diff --git a/src/buffer/video.h b/src/buffer/video.h index 5bdf267..b3b03bb 100644 --- a/src/buffer/video.h +++ b/src/buffer/video.h @@ -15,8 +15,9 @@ struct camu_video_buffer { struct camu_codec_stream *stream; struct camu_clock *clock; - atomic(f64) pts; f64 latency; + atomic(f64) pts; + f64 reset_pts; bool single_frame; f64 avg_frame_duration; diff --git a/src/buffer/video_null.h b/src/buffer/video_null.h index 60e73f1..11dc49b 100644 --- a/src/buffer/video_null.h +++ b/src/buffer/video_null.h @@ -21,7 +21,7 @@ struct camu_renderer { u32 (*get_latency)(struct camu_renderer *); }; -AL_UNUSED_FUNCTION_PUSH +AL_IGNORE_WARNING("-Wunused-function") static bool camu_video_buffer_init(struct camu_video_buffer *buf, struct camu_clock *clock) { @@ -92,4 +92,4 @@ static void camu_video_buffer_free(struct camu_video_buffer *buf) (void)buf; } -AL_UNUSED_FUNCTION_POP +AL_IGNORE_WARNING_END diff --git a/src/buffer/volume.h b/src/buffer/volume.h index 6a8cf0a..87b1945 100644 --- a/src/buffer/volume.h +++ b/src/buffer/volume.h @@ -1,7 +1,5 @@ #include "../codec/codec.h" -AL_UNUSED_FUNCTION_PUSH - static inline f32 apply_volume_f32(f32 *data, size_t sample_count, s32 channel_count, f32 volume, f32 user, f32 step) { for (u32 i = 0; i < sample_count; i++) { @@ -62,5 +60,3 @@ static inline f32 apply_volume(u8 *data, size_t size, struct camu_audio_format * } return volume; } - -AL_UNUSED_FUNCTION_POP |