mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
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
This commit is contained in:
parent
b1efa8d499
commit
e2dffab9be
1 changed files with 6 additions and 5 deletions
|
@ -639,6 +639,8 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer)
|
|||
}
|
||||
|
||||
/* update video info from video meta */
|
||||
mem = gst_buffer_peek_memory (buffer, 0);
|
||||
|
||||
vmeta = gst_buffer_get_video_meta (buffer);
|
||||
if (vmeta) {
|
||||
gint i;
|
||||
|
@ -647,13 +649,12 @@ 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);
|
||||
|
||||
mem = gst_buffer_peek_memory (buffer, 0);
|
||||
|
||||
format = GST_VIDEO_INFO_FORMAT (&sink->video_info);
|
||||
if (gst_wl_display_check_format_for_dmabuf (sink->display, format)) {
|
||||
guint i, nb_dmabuf = 0;
|
||||
|
@ -687,11 +688,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) ||
|
||||
|
|
Loading…
Reference in a new issue