Commit 5ca63b7f authored by Nicolas Dufresne's avatar Nicolas Dufresne

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
parent c53b2e37
...@@ -3479,6 +3479,12 @@ gst_base_sink_chain_unlocked (GstBaseSink * basesink, GstPad * pad, ...@@ -3479,6 +3479,12 @@ gst_base_sink_chain_unlocked (GstBaseSink * basesink, GstPad * pad,
if (G_UNLIKELY (late)) if (G_UNLIKELY (late))
goto dropped; 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 (!is_list) {
if (bclass->prepare) { if (bclass->prepare) {
ret = bclass->prepare (basesink, GST_BUFFER_CAST (obj)); ret = bclass->prepare (basesink, GST_BUFFER_CAST (obj));
...@@ -3639,6 +3645,11 @@ dropped: ...@@ -3639,6 +3645,11 @@ dropped:
} }
goto done; goto done;
} }
preroll_failed:
{
GST_DEBUG_OBJECT (basesink, "preroll failed: %s", gst_flow_get_name (ret));
return ret;
}
} }
/* with STREAM_LOCK /* with STREAM_LOCK
......
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