summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2021-02-05 18:13:32 +0100
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2021-02-05 18:54:25 +0100
commit688ade3cfc272c0f6ef9eeb5d98f41da8d804fc1 (patch)
tree42e5b17a7b9e210609028ca7a4c258f18f254812 /sys
parentbcbe620006b4b27dcea468fe3b5dff4c2827a8c8 (diff)
downloadgstreamer-plugins-bad-688ade3cfc272c0f6ef9eeb5d98f41da8d804fc1.tar.gz
va: vpp: fix frame copy
There were two problems with frame copy: 1. The input video info are from the format color, not form the allocated VA surface, it's needed to update the sink video info according with the allocator's data. 2. The parameters of `gst_video_frame_copy()` were backwards. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2007>
Diffstat (limited to 'sys')
-rw-r--r--sys/va/gstvavpp.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/sys/va/gstvavpp.c b/sys/va/gstvavpp.c
index 1e71a1942..5a2075a0f 100644
--- a/sys/va/gstvavpp.c
+++ b/sys/va/gstvavpp.c
@@ -103,6 +103,7 @@ struct _GstVaVpp
gboolean negotiated;
GstBufferPool *sinkpad_pool;
+ GstVideoInfo sinkpad_info;
guint op_flags;
@@ -947,6 +948,7 @@ _get_sinkpad_pool (GstVaVpp * self)
{
GstAllocator *allocator;
GstAllocationParams params;
+ GstVideoInfo alloc_info;
guint size, usage_hint = VA_SURFACE_ATTRIB_USAGE_HINT_VPP_READ;
if (self->sinkpad_pool)
@@ -961,10 +963,20 @@ _get_sinkpad_pool (GstVaVpp * self)
self->sinkpad_pool = _create_sinkpad_bufferpool (self->incaps, size, 0, 0,
usage_hint, allocator, &params);
+ if (GST_IS_VA_DMABUF_ALLOCATOR (allocator)) {
+ if (!gst_va_dmabuf_allocator_get_format (allocator, &alloc_info, NULL))
+ alloc_info = self->in_info;
+ } else if (GST_IS_VA_ALLOCATOR (allocator)) {
+ if (!gst_va_allocator_get_format (allocator, &alloc_info, NULL))
+ alloc_info = self->in_info;
+ }
+
gst_object_unref (allocator);
- if (self->sinkpad_pool)
+ if (self->sinkpad_pool) {
+ self->sinkpad_info = alloc_info;
gst_buffer_pool_set_active (self->sinkpad_pool, TRUE);
+ }
return self->sinkpad_pool;
}
@@ -1014,12 +1026,13 @@ gst_va_vpp_import_input_buffer (GstVaVpp * self, GstBuffer * inbuf,
if (!gst_video_frame_map (&in_frame, &self->in_info, inbuf, GST_MAP_READ))
goto invalid_buffer;
- if (!gst_video_frame_map (&out_frame, &self->in_info, buffer, GST_MAP_WRITE)) {
+ if (!gst_video_frame_map (&out_frame, &self->sinkpad_info, buffer,
+ GST_MAP_WRITE)) {
gst_video_frame_unmap (&in_frame);
goto invalid_buffer;
}
- copied = gst_video_frame_copy (&in_frame, &out_frame);
+ copied = gst_video_frame_copy (&out_frame, &in_frame);
gst_video_frame_unmap (&out_frame);
gst_video_frame_unmap (&in_frame);