diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2018-07-04 09:29:57 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2018-10-30 12:25:08 +0100 |
commit | b006ef97fc62a1b9016077e6d744a7dbe6dbe7dd (patch) | |
tree | 80292badec01579ddbc33c6aa19aec7e723e0388 | |
parent | f349cdccf5e1538f3eb9caa31458b53fdd81671b (diff) | |
download | gst-plugins-base-b006ef97fc62a1b9016077e6d744a7dbe6dbe7dd.tar.gz gst-plugins-base-b006ef97fc62a1b9016077e6d744a7dbe6dbe7dd.tar.xz |
gluploadelement: try to avoid dropping buffers
Without this, a buffer is dropped if glupload indicates that it is
necessary to reconfigure.
Avoid this by explicitly reconfiguring immediately and uploading the buffer
again.
https://bugzilla.gnome.org/show_bug.cgi?id=783521
-rw-r--r-- | ext/gl/gstgluploadelement.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/ext/gl/gstgluploadelement.c b/ext/gl/gstgluploadelement.c index 1998c7732..eaaeaed33 100644 --- a/ext/gl/gstgluploadelement.c +++ b/ext/gl/gstgluploadelement.c @@ -232,9 +232,21 @@ gst_gl_upload_element_prepare_output_buffer (GstBaseTransform * bt, if (!upload->upload) return GST_FLOW_NOT_NEGOTIATED; +again: ret = gst_gl_upload_perform_with_buffer (upload->upload, buffer, outbuf); if (ret == GST_GL_UPLOAD_RECONFIGURE) { - gst_base_transform_reconfigure_src (bt); + GstPad *sinkpad = GST_BASE_TRANSFORM_SINK_PAD (bt); + GstCaps *incaps = gst_pad_get_current_caps (sinkpad); + GST_DEBUG_OBJECT (bt, + "Failed to upload with curren caps -- reconfiguring."); + /* Note: gst_base_transform_reconfigure_src() cannot be used here. + * Reconfiguring must be synchronous to avoid dropping the current + * buffer */ + gst_pad_send_event (sinkpad, gst_event_new_caps (incaps)); + if (!gst_pad_needs_reconfigure (GST_BASE_TRANSFORM_SRC_PAD (bt))) { + GST_DEBUG_OBJECT (bt, "Retry uploading with new caps"); + goto again; + } return GST_FLOW_OK; } |