gl: download: Fix the wrong transformed result from src direction in transform_caps().

The current manner in transform_caps() for src direction is not very correct. For example,
when the src caps is:
  video/x-raw(memory:DMABuf); video/x-raw; video/x-raw(memory:GLMemory)
this function returns:
  video/x-raw(memory:DMABuf); video/x-raw; video/x-raw(memory:GLMemory)
as the sink caps. This is not correct, because DMABuf feature is not even in the sink pad's
caps template. The correct answer should be:
  video/x-raw(memory:GLMemory); video/x-raw
only.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1058>
This commit is contained in:
He Junyan 2021-03-01 23:33:29 +08:00 committed by GStreamer Marge Bot
parent ccebcaa586
commit 2f3033cebe

View file

@ -209,8 +209,11 @@ gst_gl_download_element_transform_caps (GstBaseTransform * bt,
GstCaps *result, *tmp;
if (direction == GST_PAD_SRC) {
tmp = _set_caps_features (caps, GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
tmp = gst_caps_merge (gst_caps_ref (caps), tmp);
GstCaps *sys_caps = gst_caps_simplify (_set_caps_features (caps,
GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY));
tmp = _set_caps_features (sys_caps, GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
tmp = gst_caps_merge (tmp, sys_caps);
} else {
GstCaps *newcaps;
tmp = gst_caps_ref (caps);