glupload: handle upload methods with different caps
authorMichael Olbrich <m.olbrich@pengutronix.de>
Wed, 4 Jul 2018 07:21:00 +0000 (09:21 +0200)
committerNicolas Dufresne <nicolas.dufresne@collabora.com>
Tue, 11 Sep 2018 03:03:03 +0000 (23:03 -0400)
If a upload method is selected then use it exclusively in transform_caps().
Also, reconfigure if the current caps don't match the current upload
method.

https://bugzilla.gnome.org/show_bug.cgi?id=783521

gst-libs/gst/gl/gstglupload.c

index d609c8a..605ae88 100644 (file)
@@ -1662,6 +1662,10 @@ gst_gl_upload_transform_caps (GstGLUpload * upload, GstGLContext * context,
   GstCaps *result, *tmp;
   gint i;
 
+  if (upload->priv->method)
+    return upload->priv->method->transform_caps (upload->priv->method_impl,
+        context, direction, caps);
+
   tmp = gst_caps_new_empty ();
 
   for (i = 0; i < G_N_ELEMENTS (upload_methods); i++) {
@@ -1849,6 +1853,15 @@ restart:
     }
     goto restart;
   } else if (ret == GST_GL_UPLOAD_DONE || ret == GST_GL_UPLOAD_RECONFIGURE) {
+    if (last_impl != upload->priv->method_impl) {
+      GstCaps *caps = gst_gl_upload_transform_caps (upload, upload->context,
+          GST_PAD_SINK, upload->priv->in_caps, NULL);
+      if (!gst_caps_is_equal (upload->priv->out_caps, caps)) {
+        gst_buffer_replace (&outbuf, NULL);
+        ret = GST_GL_UPLOAD_RECONFIGURE;
+      }
+      gst_caps_unref (caps);
+    }
     /* we are done */
   } else {
     upload->priv->method_impl = NULL;