appsrc: Don't chain up `BaseSrc::negotiate()`
authorSebastian Dröge <sebastian@centricular.com>
Thu, 19 Jan 2023 16:49:17 +0000 (18:49 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 21 Feb 2023 13:57:06 +0000 (13:57 +0000)
If we have caps then we can only set exactly those caps, if we have no
caps yet then negotiating anything is not very meaningful because the
caps are defined by the application and not downstream.

Avoids, among other things, an unnecessary allocation query and spurious
useless caps being set before the first buffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4020>

subprojects/gst-plugins-base/gst-libs/gst/app/gstappsrc.c

index add6a28..913fd40 100644 (file)
@@ -1329,7 +1329,7 @@ gst_app_src_do_negotiate (GstBaseSrc * basesrc)
 {
   GstAppSrc *appsrc = GST_APP_SRC_CAST (basesrc);
   GstAppSrcPrivate *priv = appsrc->priv;
-  gboolean result;
+  gboolean result = TRUE;
   GstCaps *caps;
 
   GST_OBJECT_LOCK (basesrc);
@@ -1342,8 +1342,6 @@ gst_app_src_do_negotiate (GstBaseSrc * basesrc)
   if (caps) {
     result = gst_base_src_set_caps (basesrc, caps);
     gst_caps_unref (caps);
-  } else {
-    result = GST_BASE_SRC_CLASS (parent_class)->negotiate (basesrc);
   }
   g_mutex_lock (&priv->mutex);