video-converter: Set TIME segment format on appsrc
authorJan Schmidt <jan@centricular.com>
Wed, 6 Nov 2024 07:51:21 +0000 (18:51 +1100)
committerBackport Bot <gitlab-backport-bot@gstreamer-foundation.org>
Wed, 6 Nov 2024 09:57:18 +0000 (09:57 +0000)
Combine the appsrc and appsink settings into one place and ensure that
the appsrc will output a TIME segment, to avoid incorrect segment format
criticals in some situations.

The D3D11 path was already setting the segment format correctly.

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

subprojects/gst-plugins-base/gst-libs/gst/video/convertframe.c

index fd14c6b4f4c7033ed72c92170dd23745ad70977a..7d46245cdd0eab6a85a21b5c2a0531722f8d39d8 100644 (file)
@@ -268,8 +268,11 @@ build_convert_frame_pipeline (GstElement ** src_element,
   if (dl)
     gst_bin_add (GST_BIN (pipeline), dl);
 
-  /* set caps */
-  g_object_set (src, "caps", from_caps, NULL);
+  /* set input and output caps */
+  g_object_set (src, "caps", from_caps, "emit-signals", TRUE,
+      "format", GST_FORMAT_TIME, NULL);
+  g_object_set (sink, "caps", to_caps, "emit-signals", TRUE, NULL);
+
   if (vcrop) {
     gst_video_info_from_caps (&info, from_caps);
     g_object_set (vcrop, "left", cmeta->x, NULL);
@@ -281,7 +284,6 @@ build_convert_frame_pipeline (GstElement ** src_element,
     GST_DEBUG ("crop meta [x,y,width,height]: %d %d %d %d", cmeta->x, cmeta->y,
         cmeta->width, cmeta->height);
   }
-  g_object_set (sink, "caps", to_caps, NULL);
 
   /* FIXME: linking is still way too expensive, profile this properly */
   if (vcrop) {
@@ -348,9 +350,6 @@ build_convert_frame_pipeline (GstElement ** src_element,
       goto link_failed;
   }
 
-  g_object_set (src, "emit-signals", TRUE, NULL);
-  g_object_set (sink, "emit-signals", TRUE, NULL);
-
   *src_element = src;
   *sink_element = sink;