static struct status_task status_task_struct;
struct status_task *stat_task = &status_task_struct;
+static struct timeval initial_delay_barrier;
/**
* the task for handling audiod commands
break;
case SI_STREAM_START:
if (sscanf(line + ilen + 1, "%lu.%lu", &sec, &usec) == 2) {
+ struct timeval tmp, delay;
+ delay.tv_sec = conf.stream_delay_arg / 1000;
+ delay.tv_usec = (conf.stream_delay_arg % 1000) * 1000;
stat_task->server_stream_start.tv_sec = sec;
stat_task->server_stream_start.tv_usec = usec;
+ if (stat_task->sa_time_diff_sign < 0)
+ tv_add(&stat_task->server_stream_start,
+ &stat_task->sa_time_diff, &tmp);
+ else
+ tv_diff(&stat_task->server_stream_start,
+ &stat_task->sa_time_diff, &tmp);
+ tv_add(&tmp, &delay, &initial_delay_barrier);
}
break;
case SI_CURRENT_TIME:
FOR_EACH_SLOT(i) {
struct slot_info *sl = &slot[i];
struct audio_format_info *a;
+ struct timeval diff;
if (sl->format < 0)
continue;
s->timeout = min_delay;
continue;
}
- if (sl->fc && *sl->fc->out_loaded && !sl->wng) {
+ if (!sl->fc || !*sl->fc->out_loaded || sl->wng)
+ continue;
+ if (tv_diff(now, &initial_delay_barrier, &diff) > 0) {
+ PARA_INFO_LOG("barrier: %lu:%lu, now: %lu, %lu\n",
+ initial_delay_barrier.tv_sec,
+ initial_delay_barrier.tv_usec,
+ now->tv_sec, now->tv_usec);
open_writers(i);
s->timeout = min_delay;
+ continue;
+ }
+ PARA_INFO_LOG("inital delay: %lu ms left\n", tv2ms(&diff));
+ if (tv_diff(&s->timeout, &diff, NULL) > 0) {
+ s->timeout = diff;
}
}
}