]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
fecdec: Add some more documentation, minor improvements.
authorAndre Noll <maan@systemlinux.org>
Sun, 1 Mar 2009 21:08:23 +0000 (22:08 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 1 Mar 2009 21:08:23 +0000 (22:08 +0100)
fecdec_filter.c

index 5c01a0395e79139a0bbd09633f127b06321d5268..6ca0b037da0f55be826137facc4632415648329c 100644 (file)
@@ -162,6 +162,7 @@ static struct fecdec_group *free_oldest_group(struct private_fecdec_data *pfd)
        return oldest;
 }
 
+/* returns 1 if the group was found, 0 if not, negative on errors */
 static int get_group(struct fec_header *h, struct private_fecdec_data *pfd,
                struct fecdec_group **result)
 {
@@ -180,18 +181,26 @@ static int get_group(struct fec_header *h, struct private_fecdec_data *pfd,
        if (fg)
                goto success;
        fg = free_oldest_group(pfd);
+       ret = 0;
 success:
        fg->h = *h;
        *result = fg;
-       return 1;
+       return ret;
 }
 
+/*
+ * returns 1 if slice was added, zero otherwise (because the group was already
+ * complete). In any case the number of received slices is being increased by
+ * one.
+ */
 static int add_slice(char *buf, struct fecdec_group *fg)
 {
        int r, slice_num;
 
-       if (group_complete(fg))
+       if (group_complete(fg)) {
+               fg->num_received_slices++;
                return 0;
+       }
        slice_num = fg->h.slice_num;
        if (fg->num_slices == 0) {
                fg->num_slices = fg->h.slices_per_group;
@@ -263,6 +272,7 @@ static int read_fec_header(char *buf, size_t len, struct fec_header *h)
        return 1;
 }
 
+/* returns 1 if we used the buffer, 0 if we didn't, negative on errors */
 static int dispatch_slice(char *buf, size_t len, struct fec_header *h,
                struct filter_node *fn)
 {