summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2016-09-29 14:34:18 -0400
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2016-11-03 15:37:46 -0400
commit3272f2002f2df203011a0253f9243b2cce705a31 (patch)
tree2fcaf4687a7c2ff2b078383a92ea67a928a0e5bb
parent81d1b207ad1303991c3dc645de3b399dcd8573f3 (diff)
waylandsink: Allow any kind of FD for shm memory
https://bugzilla.gnome.org/show_bug.cgi?id=711155
-rw-r--r--ext/wayland/gstwaylandsink.c2
-rw-r--r--ext/wayland/wlshmallocator.c12
2 files changed, 8 insertions, 6 deletions
diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c
index 4b39ae1f7..d4553c586 100644
--- a/ext/wayland/gstwaylandsink.c
+++ b/ext/wayland/gstwaylandsink.c
@@ -642,7 +642,7 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer)
/* FIXME check all memory when introducing DMA-Buf */
mem = gst_buffer_peek_memory (buffer, 0);
- if (gst_is_wl_shm_memory (mem)) {
+ if (gst_is_fd_memory (mem)) {
wbuf = gst_wl_shm_memory_construct_wl_buffer (mem, sink->display,
&sink->video_info);
}
diff --git a/ext/wayland/wlshmallocator.c b/ext/wayland/wlshmallocator.c
index 94fbbf102..c6dff395b 100644
--- a/ext/wayland/wlshmallocator.c
+++ b/ext/wayland/wlshmallocator.c
@@ -131,7 +131,7 @@ gst_wl_shm_memory_construct_wl_buffer (GstMemory * mem, GstWlDisplay * display,
const GstVideoInfo * info)
{
gint width, height, stride;
- gsize size;
+ gsize offset, size, memsize, maxsize;
enum wl_shm_format format;
struct wl_shm_pool *wl_pool;
struct wl_buffer *wbuffer;
@@ -142,16 +142,18 @@ gst_wl_shm_memory_construct_wl_buffer (GstMemory * mem, GstWlDisplay * display,
size = GST_VIDEO_INFO_SIZE (info);
format = gst_video_format_to_wl_shm_format (GST_VIDEO_INFO_FORMAT (info));
- g_return_val_if_fail (gst_is_wl_shm_memory (mem), NULL);
- g_return_val_if_fail (size <= mem->size, NULL);
+ memsize = gst_memory_get_sizes (mem, &offset, &maxsize);
+
+ g_return_val_if_fail (gst_is_fd_memory (mem), NULL);
+ g_return_val_if_fail (size <= memsize, NULL);
GST_DEBUG_OBJECT (mem->allocator, "Creating wl_buffer of size %"
G_GSSIZE_FORMAT " (%d x %d, stride %d), format %s", size, width, height,
stride, gst_wl_shm_format_to_string (format));
wl_pool = wl_shm_create_pool (display->shm, gst_fd_memory_get_fd (mem),
- mem->size);
- wbuffer = wl_shm_pool_create_buffer (wl_pool, 0, width, height, stride,
+ memsize);
+ wbuffer = wl_shm_pool_create_buffer (wl_pool, offset, width, height, stride,
format);
wl_shm_pool_destroy (wl_pool);