Revert "glupload: try to use the last method after reconfigure"

This reverts commit c1053e17d58c44f5509aaf9949c02b82332cb193.
This commit is contained in:
Nicolas Dufresne 2018-09-13 20:02:37 -04:00
parent 46f47416fe
commit 25df27698f

View File

@ -103,9 +103,6 @@ struct _GstGLUploadPrivate
const UploadMethod *method; const UploadMethod *method;
gpointer method_impl; gpointer method_impl;
int method_i; int method_i;
/* saved method for reconfigure */
int saved_method_i;
}; };
#define DEBUG_INIT \ #define DEBUG_INIT \
@ -1898,29 +1895,14 @@ gst_gl_upload_get_caps (GstGLUpload * upload, GstCaps ** in_caps,
} }
static gboolean static gboolean
_upload_find_method (GstGLUpload * upload, gpointer last_impl) _upload_find_method (GstGLUpload * upload)
{ {
gint method_i; gint method_i;
/* start with the last used method after explicitly reconfiguring to if (upload->priv->method_i >= G_N_ELEMENTS (upload_methods))
* 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; return FALSE;
method_i = upload->priv->method_i;
upload->priv->method = upload_methods[method_i]; upload->priv->method = upload_methods[method_i];
upload->priv->method_impl = upload->priv->upload_impl[method_i]; upload->priv->method_impl = upload->priv->upload_impl[method_i];
@ -1949,7 +1931,6 @@ gst_gl_upload_perform_with_buffer (GstGLUpload * upload, GstBuffer * buffer,
{ {
GstGLUploadReturn ret = GST_GL_UPLOAD_ERROR; GstGLUploadReturn ret = GST_GL_UPLOAD_ERROR;
GstBuffer *outbuf; 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_GL_UPLOAD (upload), FALSE);
g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE); g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE);
@ -1959,7 +1940,7 @@ gst_gl_upload_perform_with_buffer (GstGLUpload * upload, GstBuffer * buffer,
#define NEXT_METHOD \ #define NEXT_METHOD \
do { \ do { \
if (!_upload_find_method (upload, last_impl)) { \ if (!_upload_find_method (upload)) { \
GST_OBJECT_UNLOCK (upload); \ GST_OBJECT_UNLOCK (upload); \
return FALSE; \ return FALSE; \
} \ } \
@ -1967,7 +1948,7 @@ do { \
} while (0) } while (0)
if (!upload->priv->method_impl) if (!upload->priv->method_impl)
_upload_find_method (upload, last_impl); _upload_find_method (upload);
restart: restart:
if (!upload->priv->method->accept (upload->priv->method_impl, buffer, if (!upload->priv->method->accept (upload->priv->method_impl, buffer,
@ -2011,9 +1992,6 @@ restart:
GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1); GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
*outbuf_ptr = outbuf; *outbuf_ptr = outbuf;
if (ret == GST_GL_UPLOAD_RECONFIGURE)
upload->priv->saved_method_i = upload->priv->method_i - 1;
GST_OBJECT_UNLOCK (upload); GST_OBJECT_UNLOCK (upload);
return ret; return ret;