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 052f9f2146
commit be8aeaafd2

View File

@ -1805,6 +1805,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,