vss: Honor header chunk when computing FEC group start.
authorAndre Noll <maan@systemlinux.org>
Sat, 19 Sep 2009 08:08:59 +0000 (10:08 +0200)
committerAndre Noll <maan@systemlinux.org>
Sat, 19 Sep 2009 08:08:59 +0000 (10:08 +0200)
The first chunk of an ogg vorbis file is the audio file header
which should not be included in the calculation of the FEC
group timing.

vss.c

diff --git a/vss.c b/vss.c
index babcd24..aae601d 100644 (file)
--- a/vss.c
+++ b/vss.c
@@ -354,7 +354,12 @@ static int setup_next_fec_group(struct fec_client *fc, struct vss_task *vsst)
                g->num_header_slices, data_slices
        );
        /* set group start */
-       tv_scale(g->first_chunk - fc->first_stream_chunk, chunk_tv, &tmp);
+       if (g->num != 0 && vsst->header_len != 0 && fc->first_stream_chunk == 0)
+               /* chunk #0 is the audio file header */
+               tv_scale(g->first_chunk - 1, chunk_tv, &tmp);
+       else
+               tv_scale(g->first_chunk - fc->first_stream_chunk,
+                       chunk_tv, &tmp);
        tv_add(&fc->stream_start, &tmp, &g->start);
        return 1;
 }