Beispiel #1
0
static int snd_pcm_hw_clear_timer_queue(snd_pcm_hw_t *hw)
{
	if (hw->period_timer_need_poll) {
		while (poll(&hw->period_timer_pfd, 1, 0) > 0) {
			snd_timer_tread_t rbuf[4];
			snd_timer_read(hw->period_timer, rbuf, sizeof(rbuf));
		}
	} else {
		snd_timer_tread_t rbuf[4];
		snd_timer_read(hw->period_timer, rbuf, sizeof(rbuf));
	}
	return 0;
}
Beispiel #2
0
static void a2dp_timer(snd_async_handler_t *async)
{
	snd_timer_t *handle = snd_async_handler_get_timer(async);
	snd_timer_read_t tr;
	int i, ticks = 0;

	while (snd_timer_read(handle, &tr, sizeof(tr)) == sizeof(tr))
		ticks += tr.ticks;

	a2dp_lock();

	for (i = 0; i < MAX_CONNECTIONS; i++) {
		snd_pcm_a2dp_t *a2dp = connections[i];

		if (a2dp && a2dp->refcnt <= 0) {
			a2dp->timeout = ((a2dp->timeout * 1000) - ticks) / 1000;
			if (a2dp->timeout <= 0) {
				connections[i] = NULL;
				a2dp_free(a2dp);
			}
		}
	}

	a2dp_unlock();
}
Beispiel #3
0
 unsigned int  AlsaTimer::getTimerTicks(bool printTicks)
   {
   //if(TIMER_DEBUG)
   //  printf("AlsaTimer::getTimerTicks\n");
   snd_timer_read_t tr;
   tr.ticks = 0;
   while (snd_timer_read(handle, &tr, sizeof(tr)) == sizeof(tr)) {
             if (printTicks) {
                 printf("TIMER: resolution = %uns, ticks = %u\n",
                   tr.resolution, tr.ticks);
                 }
     }
   return tr.ticks;
   }