]> git.tue.mpg.de Git - paraslash.git/commitdiff
vss: Update offset directly when setting the REPOS flag.
authorAndre Noll <maan@systemlinux.org>
Wed, 6 Jan 2010 23:45:25 +0000 (00:45 +0100)
committerAndre Noll <maan@systemlinux.org>
Wed, 6 Jan 2010 23:45:25 +0000 (00:45 +0100)
This way, the new offset is used during the next announce period.

vss.c

diff --git a/vss.c b/vss.c
index 0b6735ba11014356aa44feb28cdef7b52de1181f..fef61cbe4bc469e4884540a3be1f44038e29c423 100644 (file)
--- a/vss.c
+++ b/vss.c
@@ -636,7 +636,7 @@ static void vss_eof(struct vss_task *vsst)
        para_munmap(vsst->map, mmd->size);
        vsst->map = NULL;
        mmd->chunks_sent = 0;
-       mmd->offset = 0;
+       //mmd->offset = 0;
        mmd->afd.afhi.seconds_total = 0;
        mmd->afd.afhi.chunk_tv.tv_sec = 0;
        mmd->afd.afhi.chunk_tv.tv_usec = 0;
@@ -716,11 +716,14 @@ static void vss_pre_select(struct sched *s, struct task *t)
                        set_eof_barrier(vsst);
                mmd->chunks_sent = 0;
        } else if (vss_repos()) {
+               struct timeval offset;
                tv_add(now, &vsst->announce_tv, &vsst->data_send_barrier);
                set_eof_barrier(vsst);
                mmd->chunks_sent = 0;
                mmd->current_chunk = mmd->repos_request;
                mmd->new_vss_status_flags &= ~VSS_REPOS;
+               tv_scale(mmd->current_chunk, &mmd->afd.afhi.chunk_tv, &offset);
+               mmd->offset = tv2ms(&offset);
        }
        if (need_to_request_new_audio_file(vsst)) {
                PARA_DEBUG_LOG("ready and playing, but no audio file\n");
@@ -875,10 +878,7 @@ static void vss_send(struct vss_task *vsst)
                size_t len;
 
                if (!mmd->chunks_sent) {
-                       struct timeval tmp;
                        mmd->stream_start = *now;
-                       tv_scale(mmd->current_chunk, &mmd->afd.afhi.chunk_tv, &tmp);
-                       mmd->offset = tv2ms(&tmp);
                        mmd->events++;
                }
                /*