d3d11convert: Passthrough allocation query on same caps
authorSeungha Yang <seungha@centricular.com>
Mon, 28 Aug 2023 11:58:22 +0000 (20:58 +0900)
committerTim-Philipp Müller <tim@centricular.com>
Thu, 7 Sep 2023 15:36:25 +0000 (16:36 +0100)
Since d3d11convert and its variant elements does not enable basetransform's
passthrough, passthrough allocation query needs to be handled
manually in order to respect downstream element's min/max buffer
requirement.

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

subprojects/gst-plugins-bad/sys/d3d11/gstd3d11convert.cpp

index 27997bbecb83c2e9495df04d2e2bd8ef4f268dda..d4887e73f96aab610e4e0f233a11fe4e9f1cbd5e 100644 (file)
@@ -1189,6 +1189,7 @@ static gboolean
 gst_d3d11_base_convert_propose_allocation (GstBaseTransform * trans,
     GstQuery * decide_query, GstQuery * query)
 {
+  GstD3D11BaseConvert *self = GST_D3D11_BASE_CONVERT (trans);
   GstD3D11BaseFilter *filter = GST_D3D11_BASE_FILTER (trans);
   GstVideoInfo info;
   GstBufferPool *pool = NULL;
@@ -1205,8 +1206,18 @@ gst_d3d11_base_convert_propose_allocation (GstBaseTransform * trans,
   ID3D11Device *device_handle;
 
   if (!GST_BASE_TRANSFORM_CLASS (parent_class)->propose_allocation (trans,
-          decide_query, query))
+          decide_query, query)) {
     return FALSE;
+  }
+
+  if (self->same_caps) {
+    if (!gst_pad_peer_query (trans->srcpad, query))
+      return FALSE;
+
+    gst_query_add_allocation_meta (query,
+        GST_VIDEO_CROP_META_API_TYPE, nullptr);
+    return TRUE;
+  }
 
   gst_query_parse_allocation (query, &caps, NULL);