From 812bb14f28cde5e466711c52a70d8797a370a61f Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Sun, 14 Aug 2022 21:18:24 +0900 Subject: [PATCH] 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: --- .../sys/nvcodec/gstcudamemorycopy.c | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/nvcodec/gstcudamemorycopy.c b/subprojects/gst-plugins-bad/sys/nvcodec/gstcudamemorycopy.c index dbcfe4c7e8..b766ec3b88 100644 --- a/subprojects/gst-plugins-bad/sys/nvcodec/gstcudamemorycopy.c +++ b/subprojects/gst-plugins-bad/sys/nvcodec/gstcudamemorycopy.c @@ -206,33 +206,27 @@ static GstCaps * create_transform_caps (GstCaps * caps, gboolean to_cuda) { GstCaps *ret = NULL; + GstCaps *new_caps = NULL; if (to_cuda) { - GstCaps *sys_caps = gst_caps_simplify (_set_caps_features (caps, - GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY)); - GstCaps *new_caps; - - ret = gst_caps_copy (sys_caps); + /* SRC -> SINK of cudadownload or SINK -> SRC of cudaupload */ + ret = gst_caps_copy (caps); #ifdef HAVE_NVCODEC_NVMM 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); ret = gst_caps_merge (ret, new_caps); } #endif - new_caps = _set_caps_features (sys_caps, - GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY); + new_caps = _set_caps_features (caps, GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY); ret = gst_caps_merge (ret, new_caps); ret = gst_caps_make_writable (ret); _remove_field (ret, "texture-target"); - - gst_caps_unref (sys_caps); } else { - GstCaps *new_caps; - + /* SINK -> SRC of cudadownload or SRC -> SINK of cudaupload */ ret = gst_caps_ref (caps); #ifdef HAVE_NVCODEC_NVMM @@ -253,8 +247,8 @@ create_transform_caps (GstCaps * caps, gboolean to_cuda) #endif new_caps = _set_caps_features (caps, GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY); - ret = gst_caps_merge (ret, new_caps); + ret = gst_caps_make_writable (ret); _remove_field (ret, "texture-target"); }