X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=audiod.c;h=395a14d3c582e63480b677840dca6aafb5b5f111;hp=2b6f1e69637d1b851926d25b277c90c6d6f5df9a;hb=4c2b2a8a9db9e45f4555a6dc9f57f2fb3a998a6c;hpb=299df142bb50bacebc0b3050768f941bc95b5b6f diff --git a/audiod.c b/audiod.c index 2b6f1e69..395a14d3 100644 --- a/audiod.c +++ b/audiod.c @@ -5,6 +5,7 @@ */ /** \file audiod.c the paraslash's audio daemon */ +#include #include #include #include @@ -19,7 +20,6 @@ #include "ggo.h" #include "recv.h" #include "filter.h" -#include "grab_client.cmdline.h" #include "grab_client.h" #include "client.cmdline.h" #include "client.h" @@ -162,7 +162,7 @@ struct command_task { * \return The audio format number on success, -E_UNSUPPORTED_AUDIO_FORMAT if * \a name is not a supported audio format. */ -int get_audio_format_num(char *name) +int get_audio_format_num(const char *name) { int i; @@ -386,8 +386,8 @@ static void open_filters(int slot_num) s->fc->inbufp = &s->receiver_node->buf; s->fc->in_loaded = &s->receiver_node->loaded; s->fc->input_error = &s->receiver_node->task.error; - s->fc->task.pre_select = filter_pre_select; - s->fc->task.post_select = NULL; + s->fc->task.pre_select = NULL; + s->fc->task.post_select = filter_post_select; s->fc->task.error = 0; s->fc->num_filters = nf; @@ -445,7 +445,7 @@ static void open_writers(int slot_num) stat_task->server_stream_start : *now; s->offset_seconds = stat_task->offset_seconds; s->seconds_total = stat_task->length_seconds; - activate_inactive_grab_clients(slot_num, s->format, s->fc); + activate_inactive_grab_clients(s->format, s->fc); } static int open_receiver(int format) @@ -902,8 +902,15 @@ static void command_post_select(struct sched *s, struct task *t) { int ret; struct command_task *ct = container_of(t, struct command_task, task); + static struct timeval last_status_dump; + struct timeval tmp; + + tv_add(&last_status_dump, &(struct timeval){0, 500 * 1000}, &tmp); + if (tv_diff(&tmp, now, NULL) < 0) { + audiod_status_dump(); + last_status_dump = *now; + } - audiod_status_dump(); if (!FD_ISSET(ct->fd, &s->rfds)) return; ret = handle_connect(ct->fd); @@ -1196,9 +1203,12 @@ int main(int argc, char *argv[]) drop_privileges_or_die(conf.user_arg, conf.group_arg); parse_config_or_die(); init_colors_or_die(); + init_random_seed_or_die(); daemon_set_flag(DF_LOG_TIME); daemon_set_flag(DF_LOG_HOSTNAME); daemon_set_flag(DF_LOG_LL); + if (conf.log_timing_given) + daemon_set_flag(DF_LOG_TIMING); if (conf.logfile_given) { daemon_set_logfile(conf.logfile_arg); daemon_open_log_or_die(); @@ -1227,7 +1237,7 @@ int main(int argc, char *argv[]) register_task(&cmd_task->task); register_task(&stat_task->task); s.default_timeout.tv_sec = 0; - s.default_timeout.tv_usec = 99 * 1000; + s.default_timeout.tv_usec = 999 * 1000; ret = schedule(&s); PARA_EMERG_LOG("%s\n", para_strerror(-ret));