audiod: Deprecate the --no_default_filters option.
[paraslash.git] / aacdec_filter.c
index 2dd68448b3b130172ba3417cb20eedcfc1fff262..a4414e8f49e0e3dea00b98ea60cec32eaa0235a5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2010 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2006-2012 Andre Noll <maan@systemlinux.org>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
@@ -11,7 +11,6 @@
 /** \file aacdec_filter.c paraslash's aac (m4a) decoder. */
 
 #include <regex.h>
-#include <stdbool.h>
 
 #include "para.h"
 #include "list.h"
@@ -89,7 +88,7 @@ static void aacdec_post_select(__a_unused struct sched *s, struct task *t)
        int i, ret;
        unsigned char *p, *inbuf, *outbuffer;
        char *btr_buf;
-       size_t len, skip, consumed, loaded, iqs;
+       size_t len, skip, consumed, loaded;
 
 next_buffer:
        t->error = 0;
@@ -100,9 +99,8 @@ next_buffer:
                return;
        btr_merge(btrn, fn->min_iqs);
        len = btr_next_buffer(btrn, (char **)&inbuf);
-       len = PARA_MAX(len, (size_t)8192);
+       len = PARA_MIN(len, (size_t)8192);
        consumed = 0;
-       iqs = btr_get_input_queue_size(btrn);
        if (!padd->initialized) {
                unsigned long rate = 0;
                unsigned char channels = 0;
@@ -168,13 +166,17 @@ next_buffer:
                ret = -E_AAC_DECODE;
                if (padd->error_count++ > MAX_ERRORS)
                        goto err;
-               PARA_ERROR_LOG("frame_error: %d (%s), consumed: %zu + %zd + %lu\n",
-                       err, NeAACDecGetErrorMessage(padd->frame_info.error),
+               /* Suppress non-fatal bitstream error message at BOF/EOF */
+               if (len < fn->min_iqs || padd->consumed_total == 0) {
+                       consumed = len;
+                       goto success;
+               }
+               PARA_ERROR_LOG("%s\n", NeAACDecGetErrorMessage(err));
+               PARA_ERROR_LOG("consumed: %zu + %zd + %lu\n",
                        padd->consumed_total, consumed,
                        padd->frame_info.bytesconsumed);
-               PARA_ERROR_LOG("%s\n", NeAACDecGetErrorMessage(
-                       padd->frame_info.error));
-               consumed++; /* catch 21 */
+               if (consumed < len)
+                       consumed++; /* catch 21 */
                goto success;
        }
        padd->error_count = 0;