mp3dec: Try harder to recover from non-fatal errors.
authorAndre Noll <maan@systemlinux.org>
Sun, 10 May 2009 13:28:13 +0000 (15:28 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 10 May 2009 13:28:13 +0000 (15:28 +0200)
If there's still data left, try to decode the next header in the
same scheduler run. This avoids unnecessary copies of large parts
of the mp3 input buffer.

mp3dec_filter.c

index 90293f0..92da4a5 100644 (file)
@@ -84,8 +84,8 @@ next_frame:
 out:
        if (pmd->stream.next_frame) { /* we still have some data */
                size_t off = pmd->stream.bufend - pmd->stream.next_frame;
-//             PARA_INFO_LOG("off: %zd, rate: %u, returning %zd\n", off,
-//                     fn->fc->samplerate, copy - off);
+               if (fn->loaded + 16384 <= fn->bufsize && off > 2048)
+                       goto next_frame;
                return copy - off;
        }
        return copy;