summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2017-11-24 10:36:01 +0200
committerSebastian Dröge <sebastian@centricular.com>2017-12-01 10:07:57 +0200
commit1547ea59fe4511aa71faa8fcfa3b33e9d35ad847 (patch)
tree7bf70f23918f74447fa906adfdee2426f64ece61
parentbde900dc6e75b30c771d0fa1ed1a1096e7b57f91 (diff)
downloadgstreamer-plugins-good-1547ea59fe4511aa71faa8fcfa3b33e9d35ad847.tar.gz
flacparse: Request at least the full header size when parsing headers
Otherwise baseparse will incrementally send us bigger buffers until the full header size is reached, which is not only pointless but also means that baseparse will reallocate and copy into a bigger buffer for every input buffers. In pull mode that's done in 64kb increments, in push mode usually in much smaller increments, causing a lot of overhead for example when parsing high-quality coverart.
-rw-r--r--gst/audioparsers/gstflacparse.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gst/audioparsers/gstflacparse.c b/gst/audioparsers/gstflacparse.c
index a22242980..b1f729cbb 100644
--- a/gst/audioparsers/gstflacparse.c
+++ b/gst/audioparsers/gstflacparse.c
@@ -793,6 +793,7 @@ gst_flac_parse_handle_frame (GstBaseParse * parse,
GST_DEBUG_OBJECT (flacparse, "Found metadata block of size %u", size);
framesize = size;
+ gst_base_parse_set_min_frame_size (GST_BASE_PARSE (flacparse), framesize);
goto cleanup;
}
@@ -1605,6 +1606,9 @@ gst_flac_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame,
if (res != GST_FLOW_OK)
goto cleanup;
+ } else {
+ /* Header length */
+ gst_base_parse_set_min_frame_size (GST_BASE_PARSE (flacparse), 4);
}
/* DROPPED because we pushed already or will push all headers manually */