From: Andre Noll Date: Sun, 1 Mar 2009 21:08:23 +0000 (+0100) Subject: fecdec: Add some more documentation, minor improvements. X-Git-Tag: v0.3.4~57^2~2 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=30496a3da233a6cfb0b1005b808e8d1064cb91ff;p=paraslash.git fecdec: Add some more documentation, minor improvements. --- diff --git a/fecdec_filter.c b/fecdec_filter.c index 5c01a039..6ca0b037 100644 --- a/fecdec_filter.c +++ b/fecdec_filter.c @@ -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) {