X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=audiod.c;h=40603c4eff782b0f945ccab6f5193e99f78b7462;hp=88411af46616879040a8691308ed4ca639fc5475;hb=d6e0177297fc95e508be8c40cdecd3be7397cc03;hpb=85094cd802bdb606d4e2bf7ed66dec51db2a0953 diff --git a/audiod.c b/audiod.c index 88411af4..40603c4e 100644 --- a/audiod.c +++ b/audiod.c @@ -1,10 +1,10 @@ /* - * Copyright (C) 2005-2011 Andre Noll + * Copyright (C) 2005-2012 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ -/** \file audiod.c the paraslash's audio daemon */ +/** \file audiod.c The paraslash's audio daemon. */ #include #include #include @@ -77,6 +77,12 @@ enum vss_status_flags { VSS_STATUS_FLAG_PLAYING = 2, }; +/** + * The scheduler instance of para_audiod. + * + * This is needed also in audiod_command.c (for the tasks command), so it can + * not be made static. + */ struct sched sched = {.max_fileno = 0}; /** @@ -244,7 +250,7 @@ char *get_time_string(int slot_num) */ length = stat_task->length_seconds; tmp = &stat_task->server_stream_start; - if (s && s->wns) { /* writer active in this slot */ + if (s && s->wns && s->wns[0].btrn) { /* writer active in this slot */ btr_get_node_start(s->wns[0].btrn, &wstime); if (wstime.tv_sec != 0) { /* writer wrote something */ if (s->server_stream_start.tv_sec == 0) { @@ -261,7 +267,7 @@ char *get_time_string(int slot_num) tv_diff(tmp, &stat_task->sa_time_diff, &sss); else tv_add(tmp, &stat_task->sa_time_diff, &sss); - if (!s || !s->wns) { + if (!s || !s->wns || !s->wns[0].btrn) { struct timeval diff; tv_diff(now, &sss, &diff); seconds = diff.tv_sec + stat_task->offset_seconds; @@ -270,11 +276,14 @@ char *get_time_string(int slot_num) tv_diff(now, &wstime, &wtime); //PARA_CRIT_LOG("offset %d\n", s->offset_seconds); seconds = s->offset_seconds; - btr_get_node_start(s->receiver_node->btrn, &rstime); - ret = tv_diff(&rstime, &sss, &rskip); - if (ret > 0) { /* audiod was started in the middle of the stream */ - tv_add(&wtime, &rskip, &sum); - seconds += sum.tv_sec; + if (s->receiver_node->btrn) { + btr_get_node_start(s->receiver_node->btrn, &rstime); + ret = tv_diff(&rstime, &sss, &rskip); + if (ret > 0) { /* audiod was started in the middle of the stream */ + tv_add(&wtime, &rskip, &sum); + seconds += sum.tv_sec; + } else + seconds += wtime.tv_sec; } else seconds += wtime.tv_sec; out: @@ -918,8 +927,6 @@ static int parse_filter_args(void) { int i, j, ret, af_mask; - if (!conf.no_default_filters_given) - return init_default_filters(); for (i = 0; i < conf.filter_given; i++) { char *arg; ret = parse_stream_command(conf.filter_arg[i], &arg); @@ -1159,7 +1166,7 @@ static void status_pre_select(struct sched *s, struct task *t) if (must_start_decoder()) goto min_delay; - ret = btr_node_status(st->btrn, 0, BTR_NT_LEAF); + ret = btr_node_status(st->btrn, st->min_iqs, BTR_NT_LEAF); if (ret > 0) goto min_delay; if (st->ct && audiod_status == AUDIOD_OFF)