summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Alexander Steffens (heftig) <jsteffens@make.tv>2018-01-18 14:23:07 +0100
committerTim-Philipp Müller <tim@centricular.com>2018-01-18 19:09:19 +0000
commite273e5f7a6295425fe9749724ff5b95c751842ed (patch)
tree92a78e2f078704ce08871eaae4dedd29e1f29275
parentc0195300919af46964884de6b4bbd5df7fb8c211 (diff)
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
-rw-r--r--gst/audioparsers/gstaacparse.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gst/audioparsers/gstaacparse.c b/gst/audioparsers/gstaacparse.c
index c9ce30443..3c7c7165c 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;
}