baseparse: prevent infinite loop when draining

This commit is contained in:
Mark Nauwelaerts 2009-08-07 13:07:17 +02:00 committed by Tim-Philipp Müller
parent d610cfbbc0
commit 19c47f9673

View file

@ -872,6 +872,8 @@ gst_base_parse_drain (GstBaseParse * parse)
{
guint avail;
GST_DEBUG_OBJECT (parse, "draining");
for (;;) {
avail = gst_adapter_available (parse->adapter);
if (!avail)
@ -881,6 +883,12 @@ gst_base_parse_drain (GstBaseParse * parse)
if (gst_base_parse_chain (parse->sinkpad, NULL) != GST_FLOW_OK) {
break;
}
/* nothing changed, maybe due to truncated frame; break infinite loop */
if (avail == gst_adapter_available (parse->adapter)) {
GST_DEBUG_OBJECT (parse, "no change during draining; flushing");
gst_adapter_clear (parse->adapter);
}
}
}