gstreamer-encoder: Add video metadata for DMA-BUF

Include video metadata when using DMA-BUF to provide stride and
offset. Without this metadata, GStreamer may incorrectly interpret
the buffer layout, leading to corrupted image output—especially
when the framebuffer includes padding.
This commit is contained in:
Michael Scherle 2025-06-11 11:47:30 +02:00
parent d973f638a5
commit 960e600759

View File

@ -1876,6 +1876,15 @@ spice_gst_encoder_encode_dmabuf(VideoEncoder *video_encoder,
gst_buffer_append_memory(buffer, mem);
}
gst_buffer_add_video_meta_full(buffer,
GST_VIDEO_FRAME_FLAG_NONE,
encoder->format->gst_format,
dmabuf_data->width,
dmabuf_data->height,
dmabuf_data->num_planes,
dmabuf_data->offset,
dmabuf_data->stride);
gst_mini_object_weak_ref(GST_MINI_OBJECT(buffer),
(GstMiniObjectNotify)spice_gst_mem_free_cb,
dmabuf_data);