basesrc: Clear submitted buffer lists consistently with buffers

And handle the case of a NULL buffer being returned cleanly, which is
valid as long as a buffer list is returned instead. Previously this
would cause an assertion because of calling gst_buffer_unref() with
NULL.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6462>
This commit is contained in:
Sebastian Dröge 2024-03-27 17:05:09 +02:00 committed by GStreamer Marge Bot
parent 17b0b949a4
commit 3eedd8221c

View file

@ -2599,7 +2599,8 @@ again:
wait_ret = gst_base_src_wait_playing_unlocked (src);
if (wait_ret != GST_FLOW_OK) {
if (ret == GST_FLOW_OK && own_res_buf)
gst_buffer_unref (res_buf);
gst_clear_buffer (&res_buf);
gst_clear_buffer_list (&src->priv->pending_bufferlist);
ret = wait_ret;
goto stopped;
}
@ -2612,7 +2613,8 @@ again:
if (G_UNLIKELY (g_atomic_int_get (&src->priv->has_pending_eos))) {
if (ret == GST_FLOW_OK) {
if (own_res_buf)
gst_buffer_unref (res_buf);
gst_clear_buffer (&res_buf);
gst_clear_buffer_list (&src->priv->pending_bufferlist);
}
src->priv->forced_eos = TRUE;
goto eos;