vss: Handle empty chunk groups gracefully.
authorAndre Noll <maan@tuebingen.mpg.de>
Mon, 20 Sep 2021 17:15:12 +0000 (19:15 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 29 Sep 2021 17:03:37 +0000 (19:03 +0200)
The assertion in compute_group_size() triggers if the stream is
positioned right at the end of the file when the next chunk group
starts. This was observed with an mp3 file and the udp sender when
pausing and restarting the stream at the end of the file.

Fix this braino by returning EOF instead of aborting if the next
chunk group happens to be empty.

vss.c

diff --git a/vss.c b/vss.c
index 9857d92dcd7e0e32721aaca15a86fc27fc061292..101fdb8818b4fe8ca794bda2cd71a385b093df02 100644 (file)
--- a/vss.c
+++ b/vss.c
@@ -416,7 +416,8 @@ static int compute_group_size(struct vss_task *vsst, struct fec_group *g,
                g->bytes += len;
                g->num_chunks++;
        }
-       assert(g->num_chunks);
+       if (g->num_chunks == 0)
+               return -E_EOF;
        PARA_DEBUG_LOG("group #%u: %u chunks, %u bytes total\n", g->num,
                g->num_chunks, g->bytes);
        return 1;