]> git.tue.mpg.de Git - paraslash.git/commitdiff
vss barrier fixes.
authorAndre Noll <maan@systemlinux.org>
Sun, 11 Jan 2009 16:07:36 +0000 (17:07 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 11 Jan 2009 16:07:36 +0000 (17:07 +0100)
This fixes some problems with --announce_time and --autoplay_delay.

vss.c

diff --git a/vss.c b/vss.c
index 48bfa7d75c60049b87f3bdd09906cfcb17527aac..1bd74de69f6d83f0f4e2ef2b28fe3c657d107f17 100644 (file)
--- 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);
 }