From e59019f183e080486fda280868cf4669955148c2 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 11 Jan 2009 17:07:36 +0100 Subject: [PATCH] vss barrier fixes. This fixes some problems with --announce_time and --autoplay_delay. --- vss.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/vss.c b/vss.c index 48bfa7d7..1bd74de6 100644 --- a/vss.c +++ b/vss.c @@ -236,6 +236,8 @@ struct timeval *vss_chunk_time(void) static int need_to_request_new_audio_file(struct vss_task *vsst) { + struct timeval diff; + if (vsst->map) /* have audio file */ return 0; if (!vss_playing()) /* don't need one */ @@ -244,6 +246,9 @@ static int need_to_request_new_audio_file(struct vss_task *vsst) return 0; if (vsst->afsss == AFS_SOCKET_AFD_PENDING) /* already requested one */ return 0; + if (chk_barrier("autoplay_delay", &vsst->autoplay_barrier, + &diff, 1) < 0) + return 0; return 1; } @@ -280,6 +285,7 @@ static void vss_pre_select(struct sched *s, struct task *t) tv_add(&mmd->afd.afhi.eof_tv, now, &vsst->eof_barrier); mmd->chunks_sent = 0; } else if (vss_repos()) { + tv_add(now, &vsst->announce_tv, &vsst->data_send_barrier); tv_add(&mmd->afd.afhi.eof_tv, now, &vsst->eof_barrier); mmd->chunks_sent = 0; mmd->current_chunk = mmd->repos_request; @@ -463,7 +469,8 @@ static void vss_post_select(struct sched *s, struct task *t) continue; senders[i].post_select(&s->rfds, &s->wfds); } - if (vss_playing() && !(mmd->vss_status_flags & VSS_PLAYING)) + if ((vss_playing() && !(mmd->vss_status_flags & VSS_PLAYING)) || + (vss_next() && vss_playing())) tv_add(now, &vsst->announce_tv, &vsst->data_send_barrier); vss_send_chunk(vsst); } @@ -505,6 +512,8 @@ void init_vss_task(int afs_socket) mmd->new_vss_status_flags |= VSS_PLAYING; ms2tv(autoplay_delay, &tmp); tv_add(now, &tmp, &vsst->autoplay_barrier); + tv_add(&vsst->autoplay_barrier, &vsst->announce_tv, + &vsst->data_send_barrier); } register_task(&vsst->task); } -- 2.39.5