const UploadMethod *method;
gpointer method_impl;
int method_i;
+
+ /* saved method for reconfigure */
+ int saved_method_i;
};
#define DEBUG_INIT \
}
static gboolean
-_upload_find_method (GstGLUpload * upload)
+_upload_find_method (GstGLUpload * upload, gpointer last_impl)
{
gint method_i;
- if (upload->priv->method_i >= G_N_ELEMENTS (upload_methods))
- return FALSE;
+ /* start with the last used method after explicitly reconfiguring to
+ * negotiate caps for this method */
+ if (upload->priv->method_i == 0) {
+ upload->priv->method_i = upload->priv->saved_method_i;
+ upload->priv->saved_method_i = 0;
+ }
+
+ if (upload->priv->method_i >= G_N_ELEMENTS (upload_methods)) {
+ if (last_impl)
+ upload->priv->method_i = 0;
+ else
+ return FALSE;
+ }
method_i = upload->priv->method_i;
+
+ if (last_impl == upload->priv->upload_impl[method_i])
+ return FALSE;
+
upload->priv->method = upload_methods[method_i];
upload->priv->method_impl = upload->priv->upload_impl[method_i];
{
GstGLUploadReturn ret = GST_GL_UPLOAD_ERROR;
GstBuffer *outbuf;
+ gpointer last_impl = upload->priv->method_impl;
g_return_val_if_fail (GST_IS_GL_UPLOAD (upload), FALSE);
g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE);
#define NEXT_METHOD \
do { \
- if (!_upload_find_method (upload)) { \
+ if (!_upload_find_method (upload, last_impl)) { \
GST_OBJECT_UNLOCK (upload); \
return FALSE; \
} \
} while (0)
if (!upload->priv->method_impl)
- _upload_find_method (upload);
+ _upload_find_method (upload, last_impl);
restart:
if (!upload->priv->method->accept (upload->priv->method_impl, buffer,
GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
*outbuf_ptr = outbuf;
+ if (ret == GST_GL_UPLOAD_RECONFIGURE)
+ upload->priv->saved_method_i = upload->priv->method_i - 1;
+
GST_OBJECT_UNLOCK (upload);
return ret;