download: only start a download transfer for sysmem caps features

This commit is contained in:
Matthew Waters 2015-07-07 22:35:47 +10:00
parent 57042af9d6
commit d5a39896dc
2 changed files with 21 additions and 10 deletions

View file

@ -32,8 +32,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_gl_download_element_debug);
G_DEFINE_TYPE_WITH_CODE (GstGLDownloadElement, gst_gl_download_element,
GST_TYPE_GL_BASE_FILTER,
GST_DEBUG_CATEGORY_INIT (gst_gl_download_element_debug, "gldownloadelement",
0, "download element");
);
0, "download element"););
static gboolean gst_gl_download_element_get_unit_size (GstBaseTransform * trans,
GstCaps * caps, gsize * size);
@ -161,18 +160,30 @@ static GstFlowReturn
gst_gl_download_element_prepare_output_buffer (GstBaseTransform * bt,
GstBuffer * inbuf, GstBuffer ** outbuf)
{
GstCaps *src_caps = gst_pad_get_current_caps (bt->srcpad);
GstCapsFeatures *features = NULL;
gint i, n;
*outbuf = inbuf;
if (src_caps)
features = gst_caps_get_features (src_caps, 0);
n = gst_buffer_n_memory (*outbuf);
for (i = 0; i < n; i++) {
GstMemory *mem = gst_buffer_peek_memory (*outbuf, i);
if (gst_is_gl_memory (mem))
gst_gl_memory_download_transfer ((GstGLMemory *) mem);
if (gst_is_gl_memory (mem)) {
if (!features || gst_caps_features_contains (features,
GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY)) {
gst_gl_memory_download_transfer ((GstGLMemory *) mem);
}
}
}
if (src_caps)
gst_caps_unref (src_caps);
return GST_FLOW_OK;
}

View file

@ -389,14 +389,14 @@ gst_gl_context_egl_create_context (GstGLContext * context,
gst_gl_context_egl_get_error_string ());
goto failure;
}
/* FIXME do we want a window vfunc ? */
#if GST_GL_HAVE_WINDOW_X11
if (GST_GL_IS_WINDOW_X11 (context->window)) {
gst_gl_window_x11_create_window ((GstGLWindowX11 *) context->window);
}
#endif
if (other_context == NULL) {
/* FIXME do we want a window vfunc ? */
#if GST_GL_HAVE_WINDOW_X11
if (GST_GL_IS_WINDOW_X11 (context->window)) {
gst_gl_window_x11_create_window ((GstGLWindowX11 *) context->window);
}
#endif
#if GST_GL_HAVE_WINDOW_WAYLAND
if (GST_GL_IS_WINDOW_WAYLAND_EGL (context->window)) {
gst_gl_window_wayland_egl_create_window ((GstGLWindowWaylandEGL *)