basesink: Don't nest prepare/render calls

When the first buffer arrives, we endup calling:

  ->prepare()
    ->prepare()
    ->preroll()
  ->render()

This will likely confuse any element using this method. With this patch,
we ensure the preroll take place before the first render prepare() is
called. This will result in:

  ->prepare()
  ->preroll()
  ->prepare()
  ->render()

https://bugzilla.gnome.org/show_bug.cgi?id=772468
This commit is contained in:
Nicolas Dufresne 2016-10-05 14:26:11 -04:00
parent c53b2e3740
commit 5ca63b7f04

View file

@ -3479,6 +3479,12 @@ gst_base_sink_chain_unlocked (GstBaseSink * basesink, GstPad * pad,
if (G_UNLIKELY (late))
goto dropped;
/* We are about to prepare the first frame, make sure we have prerolled
* already. This prevent nesting prepare/render calls. */
ret = gst_base_sink_do_preroll (basesink, obj);
if (G_UNLIKELY (ret != GST_FLOW_OK))
goto preroll_failed;
if (!is_list) {
if (bclass->prepare) {
ret = bclass->prepare (basesink, GST_BUFFER_CAST (obj));
@ -3639,6 +3645,11 @@ dropped:
}
goto done;
}
preroll_failed:
{
GST_DEBUG_OBJECT (basesink, "preroll failed: %s", gst_flow_get_name (ret));
return ret;
}
}
/* with STREAM_LOCK