Commit 2e278aeb authored by Tim-Philipp Müller's avatar Tim-Philipp Müller 🐠 Committed by Sebastian Dröge

baseparse: fix draining with less data than min frame size available

baseparse would pass whatever is left in the adapter to the
subclass when draining, even if it's less than the minimum
frame size required. This is bogus, baseparse should just
discard that data then. The original intention of that code
seems to have been that if we have more data available than
the minimum required we should pass all of the data available
and not just the minimum required, which does make sense, so
we'll continue to do that in the case that more data is available.

Fixes assertions in rawvideoparse on EOS after not-negotiated with
fakesrc sizetype=random ! queue ! rawvideoparse format=rgb ! appsink caps=video/x-raw,format=I420

https://bugzilla.gnome.org/show_bug.cgi?id=773666
parent 287645c2
......@@ -3184,9 +3184,17 @@ gst_base_parse_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
av = gst_adapter_available (parse->priv->adapter);
if (G_UNLIKELY (parse->priv->drain)) {
min_size = av;
GST_DEBUG_OBJECT (parse, "draining, data left: %d", min_size);
if (G_UNLIKELY (!min_size)) {
GST_DEBUG_OBJECT (parse, "draining, data left: %u, min %u", av, min_size);
/* pass all available data to subclass, not just the minimum,
* but never pass less than the minimum required to the subclass */
if (av >= min_size) {
min_size = av;
if (G_UNLIKELY (!min_size))
goto done;
} else if (av > 0) {
GST_DEBUG_OBJECT (parse, "draining, but not enough data available, "
"discarding %u bytes", av);
gst_adapter_clear (parse->priv->adapter);
goto done;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment