X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=audiod.c;h=32b6895dcf0da9393538e649f7241878b89e96c0;hb=7f361b9877e7448d509e8b2d0220c8e0e0c6bcb1;hp=db69cf141a3833a5227c12ccba3f81a9e357e3b3;hpb=63128eead92c4e07559b222e2d3d0999be8c82ff;p=paraslash.git diff --git a/audiod.c b/audiod.c index db69cf14..32b6895d 100644 --- a/audiod.c +++ b/audiod.c @@ -318,6 +318,7 @@ char *get_time_string(void) rskip; /* receiver start - sss */ int slot_num = get_play_time_slot_num(); struct slot_info *s = slot_num < 0? NULL : &slot[slot_num]; + bool writer_active = s && s->wns && s->wns[0].btrn; char *msg; if (audiod_status == AUDIOD_OFF) @@ -331,11 +332,11 @@ char *get_time_string(void) } /* * Valid status items and playing, set length and tmp to the stream - * start. We use the slot info and fall back to the info from current - * status items if no slot info is available. + * start. We use the writer start time from the slot info and fall back + * to the info from current status items if no writer is active yet. */ tmp = &stat_task->server_stream_start; - if (s && s->wns && s->wns[0].btrn) { /* writer active in this slot */ + if (writer_active) { 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) { @@ -352,7 +353,7 @@ char *get_time_string(void) tv_diff(tmp, &stat_task->sa_time_diff, &sss); else tv_add(tmp, &stat_task->sa_time_diff, &sss); - if (!s || !s->wns || !s->wns[0].btrn || wstime.tv_sec == 0) { + if (!writer_active) { struct timeval diff; tv_diff(now, &sss, &diff); seconds = diff.tv_sec + stat_task->offset_seconds;