demo: Strictly round up the number of samples to send

This avoids getting stuck when the time limit is less than
half of the sampling interval.
This commit is contained in:
Daniel Elstner 2015-09-22 16:12:01 +02:00
parent 98c01fe127
commit 36cbd69e12
1 changed files with 1 additions and 1 deletions

View File

@ -770,7 +770,7 @@ static int prepare_data(int fd, int revents, void *cb_data)
todo_us = MAX(0, elapsed_us - devc->spent_us);
/* How many samples are outstanding since the last round? */
samples_todo = (todo_us * devc->cur_samplerate + G_USEC_PER_SEC / 2)
samples_todo = (todo_us * devc->cur_samplerate + G_USEC_PER_SEC - 1)
/ G_USEC_PER_SEC;
if (devc->limit_samples > 0) {
if (devc->limit_samples < devc->sent_samples)