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:18:23 +0000
commit61484db43e78c6afdc29bfd4b4d5a7e5ab57dcbc (patch)
tree21423f1442fb95732f49e31454b4f5bcda32a239
parent104aed5f424a1e2a71df1a2e1b9fd308520cf7a7 (diff)
downloadgstreamer-plugins-good-61484db43e78c6afdc29bfd4b4d5a7e5ab57dcbc.tar.gz
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;
}