X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=audiod.c;h=5e8cf2bccdeda933f10a291f3f176c62aeca7640;hp=c93a05fe275186ec2b1275c770ec95f239041350;hb=bdbc160e9444faa1d236d69a8315f31acf910084;hpb=86733a1bedc2e9358c9ac06ff8368217de3243e3 diff --git a/audiod.c b/audiod.c index c93a05fe..5e8cf2bc 100644 --- a/audiod.c +++ b/audiod.c @@ -494,26 +494,16 @@ static void close_receiver(int slot_num) s->receiver_node = NULL; set_restart_barrier(s->format, NULL); } -static void close_writer(int slot_num) -{ - struct slot_info *s = &slot[slot_num]; - if (s->wng) { - PARA_INFO_LOG("slot %d: closing writer node group\n", - slot_num); - wng_close(s->wng); - s->wng = NULL; - } - if (s->fc) - *s->fc->output_eof = 1; /* FIXME */ -} - static void kill_all_decoders(void) { int i; - FOR_EACH_SLOT(i) - close_writer(i); + FOR_EACH_SLOT(i) { + struct slot_info *s = &slot[i]; + if (s->receiver_node) + s->receiver_node->eof = 1; + } } static void check_sigchld(void) @@ -777,16 +767,14 @@ static void open_receiver(int format) register_task(&rn->task); } -static int is_frozen(int format) +static int is_frozen(int format, struct timeval *now) { - struct timeval now; struct audio_format_info *a = &afi[format]; - gettimeofday(&now, NULL); - return (tv_diff(&now, &a->restart_barrier, NULL) > 0)? 0 : 1; + return (tv_diff(now, &a->restart_barrier, NULL) > 0)? 0 : 1; } -static void start_current_receiver(void) +static void start_current_receiver(struct timeval *now) { int i; @@ -795,7 +783,7 @@ static void start_current_receiver(void) i = get_audio_format_num(af_status); if (i < 0) return; - if ((decoder_running(i) & 1) || is_frozen(i)) + if ((decoder_running(i) & 1) || is_frozen(i, now)) return; open_receiver(i); } @@ -940,14 +928,14 @@ static void close_decoder_if_idle(int slot_num) clear_slot(slot_num); } -static void audiod_pre_select(__a_unused struct sched *s, __a_unused struct task *t) +static void audiod_pre_select(struct sched *s, __a_unused struct task *t) { int i; if (audiod_status != AUDIOD_ON) kill_all_decoders(); else if (playing) - start_current_receiver(); + start_current_receiver(&s->now); check_timeouts(); FOR_EACH_SLOT(i) { struct receiver_node *rn;