]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - fecdec_filter.c
fecdec: Minor cleanups.
[paraslash.git] / fecdec_filter.c
index 8b326de5d9862ef88a9817f25962f2ff93fccd44..5c01a0395e79139a0bbd09633f127b06321d5268 100644 (file)
@@ -28,7 +28,7 @@
 #define NUM_FEC_GROUPS 3
 
 /** Size of the output buffer of the fecdec filter. */
-#define FECDEC_OUTBUF_SIZE 81920
+#define FECDEC_OUTBUF_SIZE (128 * 1024)
 
 /** Data read from the header of a slice. */
 struct fec_header {
@@ -112,7 +112,10 @@ static int find_group(struct fec_header *h,
        FOR_EACH_FECDEC_GROUP(fg, pfd) {
                if (fg->h.group_num != h->group_num)
                        continue;
-               /* FIXME: Add some more sanity checks here */
+               if (fg->h.slices_per_group != h->slices_per_group)
+                       continue;
+               if (fg->h.data_slices_per_group != h->data_slices_per_group)
+                       continue;
                *result = fg;
                return 1;
        }
@@ -172,14 +175,13 @@ static int get_group(struct fec_header *h, struct private_fecdec_data *pfd,
        /* group not found */
        fg = find_unused_group(pfd);
        if (fg)
-               goto update_header;
+               goto success;
        fg = try_to_free_group(pfd);
        if (fg)
-               goto update_header;
+               goto success;
        fg = free_oldest_group(pfd);
-update_header:
-       fg->h = *h;
 success:
+       fg->h = *h;
        *result = fg;
        return 1;
 }
@@ -278,7 +280,6 @@ static int dispatch_slice(char *buf, size_t len, struct fec_header *h,
                        h->slice_num);
                return 1;
        }
-       fg->h = *h;
        ret = add_slice(buf, fg);
        if (ret < 0)
                return ret;