if (ret == 0)
return;
- if (!pad)
- return sched_min_delay(s);
- if (ret < 0)
- return sched_request_barrier_or_min_delay(&pad->drain_barrier, s);
+ if (!pad) {
+ sched_min_delay(s);
+ return;
+ }
+ if (ret < 0) {
+ sched_request_barrier_or_min_delay(&pad->drain_barrier, s);
+ return;
+ }
/*
* Data is available to be written to the alsa handle. Compute number
* of milliseconds until next buffer underrun would occur.
* \param barrier Absolute time before select() should return.
* \param s Pointer to the scheduler struct.
*
- * If \a barrier is in the past, this function does nothing.
+ * \return If \a barrier is in the past, this function does nothing and returns
+ * zero. Otherwise it returns one.
*
* \sa sched_request_barrier_or_min_delay().
*/
-void sched_request_barrier(struct timeval *barrier, struct sched *s)
+int sched_request_barrier(struct timeval *barrier, struct sched *s)
{
struct timeval diff;
if (tv_diff(now, barrier, &diff) > 0)
- return;
+ return 0;
sched_request_timeout(&diff, s);
+ return 1;
}
/**
* \param barrier Absolute time before select() should return.
* \param s Pointer to the scheduler struct.
*
- * If \a barrier is in the past, this function requests a minimal timeout.
+ * If \a barrier is in the past, this function requests a minimal timeout and
+ * returns zero. Otherwise it returns one.
*
* \sa sched_min_delay(), sched_request_barrier().
*/
-void sched_request_barrier_or_min_delay(struct timeval *barrier, struct sched *s)
+int sched_request_barrier_or_min_delay(struct timeval *barrier, struct sched *s)
{
struct timeval diff;
- if (tv_diff(now, barrier, &diff) > 0)
- return sched_min_delay(s);
+ if (tv_diff(now, barrier, &diff) > 0) {
+ sched_min_delay(s);
+ return 0;
+ }
sched_request_timeout(&diff, s);
+ return 1;
}
void sched_min_delay(struct sched *s);
void sched_request_timeout(struct timeval *to, struct sched *s);
void sched_request_timeout_ms(long unsigned ms, struct sched *s);
-void sched_request_barrier(struct timeval *barrier, struct sched *s);
-void sched_request_barrier_or_min_delay(struct timeval *barrier, struct sched *s);
+int sched_request_barrier(struct timeval *barrier, struct sched *s);
+int sched_request_barrier_or_min_delay(struct timeval *barrier, struct sched *s);