summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabien Dessenne <fabien.dessenne@st.com>2017-02-22 04:35:26 -0500
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2017-02-22 04:36:01 -0500
commitfb2e63c468321a1691e06c5aad22df7559e1bd54 (patch)
treefea58317d22ebd914e50f590cf58612ae3c8c6cb
parent2bf5a6958185603217140f043924467394046f04 (diff)
downloadgstreamer-plugins-bad-fb2e63c468321a1691e06c5aad22df7559e1bd54.tar.gz
waylandsink: consider buffer size when copying to wl shm pool
When the sink receives a buffer that is neither a wl_shm one nor a dmabuf one, this buffer is copied to an internal wl_shm buffer before being sent to the display. In that case, the actual size of the received buffer (which may differ from the one negotiated in the caps) must be used. https://bugzilla.gnome.org/show_bug.cgi?id=777841
-rw-r--r--ext/wayland/gstwaylandsink.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c
index 4b39ae1f7..85497f933 100644
--- a/ext/wayland/gstwaylandsink.c
+++ b/ext/wayland/gstwaylandsink.c
@@ -625,6 +625,9 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer)
GstMemory *mem;
struct wl_buffer *wbuf = NULL;
+ /* FIXME check all memory when introducing DMA-Buf */
+ mem = gst_buffer_peek_memory (buffer, 0);
+
/* update video info from video meta */
vmeta = gst_buffer_get_video_meta (buffer);
if (vmeta) {
@@ -634,14 +637,13 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer)
sink->video_info.offset[i] = vmeta->offset[i];
sink->video_info.stride[i] = vmeta->stride[i];
}
+
+ sink->video_info.size = mem->size;
}
GST_LOG_OBJECT (sink, "buffer %p does not have a wl_buffer from our "
"display, creating it", buffer);
- /* FIXME check all memory when introducing DMA-Buf */
- mem = gst_buffer_peek_memory (buffer, 0);
-
if (gst_is_wl_shm_memory (mem)) {
wbuf = gst_wl_shm_memory_construct_wl_buffer (mem, sink->display,
&sink->video_info);
@@ -666,11 +668,11 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer)
if (!gst_buffer_pool_is_active (sink->pool)) {
GstStructure *config;
GstCaps *caps;
- guint size = sink->video_info.size;
config = gst_buffer_pool_get_config (sink->pool);
- gst_buffer_pool_config_get_params (config, &caps, &size, NULL, NULL);
- gst_buffer_pool_config_set_params (config, caps, size, 2, 0);
+ gst_buffer_pool_config_get_params (config, &caps, NULL, NULL, NULL);
+ gst_buffer_pool_config_set_params (config, caps, sink->video_info.size,
+ 2, 0);
/* This is a video pool, it should not fail with basic setings */
if (!gst_buffer_pool_set_config (sink->pool, config) ||