info("Playing...");
next_timestamp = pheap_first(&packets)->timestamp;
active = 1;
+ pthread_mutex_unlock(&lock);
backend->activate();
+ pthread_mutex_lock(&lock);
/* Wait until the buffer empties out */
while(nsamples >= minbuffer
|| (nsamples > 0
pthread_cond_wait(&cond, &lock);
}
/* Stop playing for a bit until the buffer re-fills */
+ pthread_mutex_unlock(&lock);
backend->deactivate();
+ pthread_mutex_lock(&lock);
active = 0;
/* Go back round */
}
* @param max_samples How many samples to supply
* @param userdata As passed to uaudio_open()
* @return Number of samples filled
+ *
+ * This function should not block if possible (better to fill the buffer with
+ * 0s) and should definitely not block indefinitely. This great caution with
+ * any locks or syscalls! In particular avoid it taking a lock that may be
+ * held while any of the @ref uaudio members are called.
+ *
+ * If it's more convenient, it's OK to return less than the maximum number of
+ * samples (including 0) provided you expect to be called again for more
+ * samples immediately.
*/
typedef size_t uaudio_callback(void *buffer,
size_t max_samples,