mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 17:51:16 +00:00
glupload: make directviv upload manner only consider system memory
The current _directviv_upload_transform_caps() only simply apply "memory:GLMemory" to all input caps to transform the output caps. This is not precise and may cause problem. For example, if the input caps include: video/x-raw(memory:DMABuf), width=(int)1920, height=(int)1080, \ interlace-mode=(string)progressive, multiview-mode=(string)mono, \ framerate=(fraction)30/1, drm-format=(string)NV12:0x0100000000000002 it will be changed as video/x-raw(memory:GLMemory), width=(int)1920, height=(int)1080, \ interlace-mode=(string)progressive, multiview-mode=(string)mono, \ framerate=(fraction)30/1, drm-format=(string)NV12:0x0100000000000002 For GLMemory kind caps, no drm-format should appear. So we should let it only transforms which it can recognize. And in _directviv_upload_accept(), we should only accept the system memory as input caps. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3524>
This commit is contained in:
parent
b9c97ba76d
commit
122ffa56ed
1 changed files with 22 additions and 2 deletions
|
@ -2325,10 +2325,20 @@ _directviv_upload_transform_caps (gpointer impl, GstGLContext * context,
|
|||
|
||||
if (direction == GST_PAD_SINK) {
|
||||
GstCaps *tmp;
|
||||
GstCapsFeatures *filter_features;
|
||||
|
||||
ret =
|
||||
_set_caps_features_with_passthrough (caps,
|
||||
filter_features =
|
||||
gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY);
|
||||
if (!_filter_caps_with_features (caps, filter_features, &tmp)) {
|
||||
gst_caps_features_free (filter_features);
|
||||
gst_caps_features_free (passthrough);
|
||||
return NULL;
|
||||
}
|
||||
gst_caps_features_free (filter_features);
|
||||
|
||||
ret = _set_caps_features_with_passthrough (tmp,
|
||||
GST_CAPS_FEATURE_MEMORY_GL_MEMORY, passthrough);
|
||||
gst_caps_unref (tmp);
|
||||
|
||||
gst_caps_set_simple (ret, "format", G_TYPE_STRING, "RGBA", NULL);
|
||||
tmp = _caps_intersect_texture_target (ret, 1 << GST_GL_TEXTURE_TARGET_2D);
|
||||
|
@ -2373,6 +2383,16 @@ _directviv_upload_accept (gpointer impl, GstBuffer * buffer, GstCaps * in_caps,
|
|||
if (!directviv->TexDirectInvalidateVIV || !directviv->TexDirectVIVMap)
|
||||
return FALSE;
|
||||
|
||||
features =
|
||||
gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY);
|
||||
/* Also consider the omited system memory feature cases, such as
|
||||
video/x-raw(meta:GstVideoOverlayComposition) */
|
||||
if (!_filter_caps_with_features (in_caps, features, NULL)) {
|
||||
gst_caps_features_free (features);
|
||||
return FALSE;
|
||||
}
|
||||
gst_caps_features_free (features);
|
||||
|
||||
features = gst_caps_get_features (out_caps, 0);
|
||||
if (!gst_caps_features_contains (features, GST_CAPS_FEATURE_MEMORY_GL_MEMORY))
|
||||
return FALSE;
|
||||
|
|
Loading…
Reference in a new issue