From e273e5f7a6295425fe9749724ff5b95c751842ed Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Thu, 18 Jan 2018 14:23:07 +0100 Subject: [PATCH] aacparse: When parsing raw input, accept frames of any size Raw AAC streams might have very small frames, e.g. 6 byte frames when encoding silence. These frames are then smaller than aacparse's default min_frame_size of 10 bytes (ADTS_MAX_SIZE). When passthrough is disabled or aacparse has to output ADTS, GstBaseParse will concatenate these short frames to the following frame before handling them to aacparse, which processes each input buffer as a single frame, producing bad output. To avoid this problem, set the min_frame_size to 1 when receiving a raw stream. https://bugzilla.gnome.org/show_bug.cgi?id=792644 --- gst/audioparsers/gstaacparse.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gst/audioparsers/gstaacparse.c b/gst/audioparsers/gstaacparse.c index c9ce304..3c7c716 100644 --- a/gst/audioparsers/gstaacparse.c +++ b/gst/audioparsers/gstaacparse.c @@ -68,6 +68,7 @@ GST_DEBUG_CATEGORY_STATIC (aacparse_debug); #define ADIF_MAX_SIZE 40 /* Should be enough */ #define ADTS_MAX_SIZE 10 /* Should be enough */ #define LOAS_MAX_SIZE 3 /* Should be enough */ +#define RAW_MAX_SIZE 1 /* Correct framing is required */ #define ADTS_HEADERS_LENGTH 7UL /* Total byte-length of fixed and variable headers prepended during raw to ADTS @@ -334,6 +335,9 @@ gst_aac_parse_sink_setcaps (GstBaseParse * parse, GstCaps * caps) gst_aac_parse_set_src_caps (aacparse, caps); if (aacparse->header_type == aacparse->output_header_type) gst_base_parse_set_passthrough (parse, TRUE); + + /* input is already correctly framed */ + gst_base_parse_set_min_frame_size (parse, RAW_MAX_SIZE); } else { return FALSE; } -- 2.7.4