mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
baseparse: prevent infinite loop when draining
This commit is contained in:
parent
1f2a0d3b3d
commit
222322e7f3
3 changed files with 24 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -895,6 +895,8 @@ gst_base_parse_drain (GstBaseParse * parse)
|
|||
{
|
||||
guint avail;
|
||||
|
||||
GST_DEBUG_OBJECT (parse, "draining");
|
||||
|
||||
for (;;) {
|
||||
avail = gst_adapter_available (parse->priv->adapter);
|
||||
if (!avail)
|
||||
|
@ -904,6 +906,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue