static uint64_t measurement_time;
static uint64_t frames_played_at_measurement_time;
-static uint64_t most_recent_write_time;
+volatile uint64_t most_recent_write_time;
static uint64_t frames_sent_for_playing;
static uint64_t frame_index;
return response;
}
-static int play(void *buf, int samples) {
+int untimed_play(void *buf, int samples) {
+
// debug(3,"audio_alsa play called.");
int oldState;
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldState); // make this un-cancellable
debug(1, "empty buffer being passed to pcm_writei -- skipping it");
if ((samples != 0) && (buf != NULL)) {
// debug(3, "write %d frames.", samples);
- most_recent_write_time = get_absolute_time_in_fp();
err = alsa_pcm_write(alsa_handle, buf, samples);
stall_monitor_frame_count += samples;
pthread_setcancelstate(oldState, NULL);
}
+static int play(void *buf, int samples) {
+ most_recent_write_time = get_absolute_time_in_fp(); // this is to regulate access by the silence filler threrad
+ return untimed_play(buf,samples);
+}
+
static void stop(void) {
// debug(2,"audio_alsa stop called.");
// when we want to stop, we want the alsa device