#pragma once #include #include "clock.h" enum { // Flowing. FLOWING, // Got request to flush. FLUSHED, // Flushed because of an error. FLUSHED_ERROR, // Realized flush. SIGNALED, // Errored. ERRORED }; //#define CAMU_BUFFER_SPORADIC_ERRORS #ifdef CAMU_BUFFER_SPORADIC_ERRORS #include #define ROLL_FOR_BUFFER_ERROR(buf) do { \ if (al_random_int(0, 254) == 72) { \ log_warn("Random buffer error proc."); \ atomic_store(u32)(&(buf)->flow, FLUSHED_ERROR, AL_ATOMIC_RELAXED); \ } \ } while (0) #endif static inline bool frame_is_late(struct camu_clock *clock, f64 base, f64 pts, f64 duration) { return pts + duration < ((base == -1.0) ? camu_clock_get_base_pts(clock) : base); }