vaallocator: don't update size in info for single plane images
Don't update info's size with the VA image reported data size for single plane images, since drivers might allocate bigger space than the strictly required to store the image, but when we dump the buffer as is (using filesink, for example) the produced stream is corrupted. For multi-plane images video meta is required to read/write them. We updated info's size because gstreamer-vaapi did it too, but the reason to update it there was for uploading and rendering surfaces (commit c698a015). Furthermore, this patch adds an error message if the allocated data size for the image by the driver is lesser than the expected because it would be a buggy driver. Fixes: #2959 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5308>
This commit is contained in:
parent
b5de07a8c5
commit
4c5e17308e
@ -1296,7 +1296,11 @@ _update_info (GstVideoInfo * info, const VAImage * image)
|
||||
GST_VIDEO_INFO_PLANE_STRIDE (info, i) = image->pitches[i];
|
||||
}
|
||||
|
||||
GST_VIDEO_INFO_SIZE (info) = image->data_size;
|
||||
/* Don't update image size for one planed images since drivers might add extra
|
||||
* bits which will drop wrong raw images with filesink, for example. Multiple
|
||||
* plane images require video meta */
|
||||
if (image->num_planes > 1)
|
||||
GST_VIDEO_INFO_SIZE (info) = image->data_size;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
@ -1344,6 +1348,11 @@ _update_image_info (GstVaAllocator * va_allocator)
|
||||
|
||||
done:
|
||||
_update_info (&va_allocator->info, &image);
|
||||
if (GST_VIDEO_INFO_SIZE (&va_allocator->info) > image.data_size) {
|
||||
GST_WARNING_OBJECT (va_allocator,
|
||||
"image size is lesser than the minimum required");
|
||||
}
|
||||
|
||||
va_destroy_image (va_allocator->display, image.image_id);
|
||||
va_destroy_surfaces (va_allocator->display, &surface, 1);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user