cudaupload,cudadownload: Don't simplify caps in transform_caps

The simplified caps might not be a subset of filter caps
and basetransform will complain about it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2883>
This commit is contained in:
Seungha Yang 2022-08-14 21:18:24 +09:00 committed by GStreamer Marge Bot
parent 9b4fafb882
commit 812bb14f28

View file

@ -206,33 +206,27 @@ static GstCaps *
create_transform_caps (GstCaps * caps, gboolean to_cuda) create_transform_caps (GstCaps * caps, gboolean to_cuda)
{ {
GstCaps *ret = NULL; GstCaps *ret = NULL;
GstCaps *new_caps = NULL;
if (to_cuda) { if (to_cuda) {
GstCaps *sys_caps = gst_caps_simplify (_set_caps_features (caps, /* SRC -> SINK of cudadownload or SINK -> SRC of cudaupload */
GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY)); ret = gst_caps_copy (caps);
GstCaps *new_caps;
ret = gst_caps_copy (sys_caps);
#ifdef HAVE_NVCODEC_NVMM #ifdef HAVE_NVCODEC_NVMM
if (gst_cuda_nvmm_init_once ()) { if (gst_cuda_nvmm_init_once ()) {
new_caps = _set_caps_features (sys_caps, new_caps = _set_caps_features (caps,
GST_CAPS_FEATURE_MEMORY_CUDA_NVMM_MEMORY); GST_CAPS_FEATURE_MEMORY_CUDA_NVMM_MEMORY);
ret = gst_caps_merge (ret, new_caps); ret = gst_caps_merge (ret, new_caps);
} }
#endif #endif
new_caps = _set_caps_features (sys_caps, new_caps = _set_caps_features (caps, GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY);
GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY);
ret = gst_caps_merge (ret, new_caps); ret = gst_caps_merge (ret, new_caps);
ret = gst_caps_make_writable (ret); ret = gst_caps_make_writable (ret);
_remove_field (ret, "texture-target"); _remove_field (ret, "texture-target");
gst_caps_unref (sys_caps);
} else { } else {
GstCaps *new_caps; /* SINK -> SRC of cudadownload or SRC -> SINK of cudaupload */
ret = gst_caps_ref (caps); ret = gst_caps_ref (caps);
#ifdef HAVE_NVCODEC_NVMM #ifdef HAVE_NVCODEC_NVMM
@ -253,8 +247,8 @@ create_transform_caps (GstCaps * caps, gboolean to_cuda)
#endif #endif
new_caps = _set_caps_features (caps, GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY); new_caps = _set_caps_features (caps, GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY);
ret = gst_caps_merge (ret, new_caps); ret = gst_caps_merge (ret, new_caps);
ret = gst_caps_make_writable (ret); ret = gst_caps_make_writable (ret);
_remove_field (ret, "texture-target"); _remove_field (ret, "texture-target");
} }