fecdec: Defer decoding until the next group after the first _usable_ fec group starts.
authorAndre Noll <maan@systemlinux.org>
Wed, 18 Nov 2009 18:23:45 +0000 (19:23 +0100)
committerAndre Noll <maan@systemlinux.org>
Wed, 18 Nov 2009 18:23:45 +0000 (19:23 +0100)
Commit faeabd31b4bea5c097acff4738a0626e3c84f1d9 (fecdec: Defer decoding until
the first slice of the second group arrives.) changed the fec decoder such that it does
not start to write the decoded output ASAP but waits until the next group starts.

This is generally a good idea, but the patch missed the fact that the first complete group
might be unusable in case of streams that carry an audio file header (currently only ogg
vorbis).

Fix this flaw by setting the completion status to GCS_FIRST_GROUP_COMPLETE only
if we received a complete group that is also usable.

fecdec_filter.c

index 41db249..18dcb34 100644 (file)
@@ -394,6 +394,10 @@ static int dispatch_slice(char *buf, size_t len, struct fec_header *h,
                return 1;
        if (group_complete(fg)) {
                if (pfd->completion_status == GCS_NO_COMPLETE_GROUP) {
+                       enum fec_group_usability u = group_is_usable(fg, pfd);
+                       assert(u != FEC_GROUP_USABLE_SKIP_HEADER);
+                       if (u == FEC_GROUP_UNUSABLE)
+                               return 1;
                        pfd->completion_status = GCS_FIRST_GROUP_COMPLETE;
                        pfd->first_complete_group = fg;
                        return 1;