if (G_UNLIKELY (!wbuf))
goto no_wl_buffer_shm;
- gst_buffer_add_wl_buffer (to_render, wbuf, sink->display);
+ wlbuffer = gst_buffer_add_wl_buffer (to_render, wbuf, sink->display);
}
if (!gst_video_frame_map (&dst, &sink->video_info, to_render,
if (!wbuf)
goto no_wl_buffer;
- gst_buffer_add_wl_buffer (buffer, wbuf, sink->display);
+ wlbuffer = gst_buffer_add_wl_buffer (buffer, wbuf, sink->display);
to_render = buffer;
render:
/* drop double rendering */
- if (G_UNLIKELY (to_render == sink->last_buffer)) {
+ if (G_UNLIKELY (wlbuffer ==
+ gst_buffer_get_wl_buffer (sink->display, sink->last_buffer))) {
GST_LOG_OBJECT (sink, "Buffer already being rendered");
goto done;
}
GstWlBuffer *
gst_buffer_get_wl_buffer (GstWlDisplay * display, GstBuffer * gstbuffer)
{
- GstMemory *mem0 = gst_buffer_peek_memory (gstbuffer, 0);
- GstWlBuffer *wlbuf = gst_wl_display_lookup_buffer (display, mem0);
+ GstMemory *mem0;
+ GstWlBuffer *wlbuf;
+
+ if (!gstbuffer)
+ return NULL;
+
+ mem0 = gst_buffer_peek_memory (gstbuffer, 0);
+
+ wlbuf = gst_wl_display_lookup_buffer (display, mem0);
if (wlbuf)
wlbuf->current_gstbuffer = gstbuffer;
+
return wlbuf;
}