mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-01-11 16:55:33 +00:00
gstreamer-encoder: Fix DMA-BUF file descriptor duplication and improve logging format
This commit is contained in:
parent
564b3bd5db
commit
b2c1763197
@ -1807,7 +1807,7 @@ static void red_marshall_gl_draw_stream(DisplayChannelClient *dcc,
|
||||
delete dmabuf_data;
|
||||
return;
|
||||
}
|
||||
dmabuf_data->drm_dma_buf_fd[i] = scanout->fd[i];
|
||||
dmabuf_data->drm_dma_buf_fd[i] = dup(scanout->fd[i]);
|
||||
dmabuf_data->stride[i] = (int)scanout->stride[i];
|
||||
dmabuf_data->offset[i] = (size_t)scanout->offset[i];
|
||||
}
|
||||
|
||||
@ -991,7 +991,7 @@ static const gchar *get_encode_gpu(){
|
||||
|
||||
static gchar *find_best_hw_plugin(const gchar *codec_name)
|
||||
{
|
||||
char plugins[][20] = {"msdk", "va", "vaapi"};
|
||||
char plugins[][20] = {"va","msdk", "vaapi"};
|
||||
gchar *feature_name;
|
||||
int i;
|
||||
const gchar *encode_gpu = get_encode_gpu();
|
||||
@ -1006,7 +1006,7 @@ static gchar *find_best_hw_plugin(const gchar *codec_name)
|
||||
return feature_name;
|
||||
}
|
||||
g_free(feature_name);
|
||||
if(i == 1 && codec_name){
|
||||
if(codec_name){
|
||||
feature_name = g_strconcat(plugins[i], codec_name, "lpenc", NULL);
|
||||
if (gst_features_lookup(feature_name)) {
|
||||
return feature_name;
|
||||
@ -1723,10 +1723,11 @@ spice_gst_encoder_configure_pipeline(SpiceGstEncoder *encoder,
|
||||
encoder->spice_format != spice_format ||
|
||||
encoder->drm_format != drm_format) && (width > 0 && height > 0)) {
|
||||
spice_debug("video format change: width %d -> %d, height %d -> %d,"
|
||||
"spice format %d -> %d, drm format %u -> %u",
|
||||
"spice format %d -> %d, drm format %u -> %u, gst-format %s -> %s",
|
||||
encoder->width, width, encoder->height, height,
|
||||
encoder->spice_format, spice_format,
|
||||
encoder->drm_format, drm_format);
|
||||
encoder->drm_format, drm_format, gst_video_format_to_string(encoder->format->gst_format),
|
||||
gst_video_format_to_string(format->gst_format));
|
||||
|
||||
encoder->format = format;
|
||||
encoder->spice_format = spice_format;
|
||||
@ -1865,17 +1866,15 @@ spice_gst_encoder_encode_dmabuf(VideoEncoder *video_encoder,
|
||||
for (int i = 0; i < dmabuf_data->num_planes; i++) {
|
||||
gsize size = dmabuf_data->stride[i] * dmabuf_data->height;
|
||||
GstMemory *mem
|
||||
= gst_dmabuf_allocator_alloc_with_flags(encoder->allocator,
|
||||
= gst_dmabuf_allocator_alloc(encoder->allocator,
|
||||
dmabuf_data->drm_dma_buf_fd[i],
|
||||
size,
|
||||
GST_FD_MEMORY_FLAG_DONT_CLOSE);
|
||||
size);
|
||||
if (!mem) {
|
||||
gst_buffer_unref(buffer);
|
||||
return rc;
|
||||
}
|
||||
gst_buffer_append_memory(buffer, mem);
|
||||
}
|
||||
|
||||
gst_buffer_add_video_meta_full(buffer,
|
||||
GST_VIDEO_FRAME_FLAG_NONE,
|
||||
encoder->format->gst_format,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user