appsrc: Don't chain up BaseSrc::negotiate()

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/3757>
This commit is contained in:
Sebastian Dröge 2023-01-19 18:49:17 +02:00 committed by GStreamer Marge Bot
parent 2e574a80d9
commit 20d394cb21

View file

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