mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-23 15:48:23 +00:00
msdk: adjust the stride align
GstAllocationParams::align is set to 31 in msdkdec/msdken/msdkvpp, hence
the stride align should be greater than or equal to 31, otherwise it
will result in issue
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/861
(msdk: "GStreamer-CRITICAL: gst_buffer_resize_range failed" SPAM),
In addition, the stride should match the pitch alignment in the media driver,
otherwise it will result in some issues when a buffer is shared between
different elements, e.g. the NV12 issue mentioned in commit 3f2314a
, which
can be reproduced by `gst-launch-1.0 vidoetestsrc ! msdkvpp !
video/x-raw\(memory:DMABuf\),format=NV12 ! glimagesink`
Fixed https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/861
This commit is contained in:
parent
f1aefb77e6
commit
8daac1c09a
1 changed files with 9 additions and 1 deletions
|
@ -219,6 +219,7 @@ gst_msdk_set_video_alignment (GstVideoInfo * info, guint alloc_w, guint alloc_h,
|
|||
GstVideoAlignment * alignment)
|
||||
{
|
||||
guint i, width, height;
|
||||
guint stride_align = 127; /* 128-byte alignment */
|
||||
|
||||
width = GST_VIDEO_INFO_WIDTH (info);
|
||||
height = GST_VIDEO_INFO_HEIGHT (info);
|
||||
|
@ -232,9 +233,16 @@ gst_msdk_set_video_alignment (GstVideoInfo * info, guint alloc_w, guint alloc_h,
|
|||
if (alloc_h == 0)
|
||||
alloc_h = height;
|
||||
|
||||
/* PitchAlignment is set to 64 bytes in the media driver for the following formats */
|
||||
if (GST_VIDEO_INFO_FORMAT (info) == GST_VIDEO_FORMAT_BGRA ||
|
||||
GST_VIDEO_INFO_FORMAT (info) == GST_VIDEO_FORMAT_BGRx ||
|
||||
GST_VIDEO_INFO_FORMAT (info) == GST_VIDEO_FORMAT_BGR10A2_LE ||
|
||||
GST_VIDEO_INFO_FORMAT (info) == GST_VIDEO_FORMAT_RGB16)
|
||||
stride_align = 63; /* 64-byte alignment */
|
||||
|
||||
gst_video_alignment_reset (alignment);
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (info); i++)
|
||||
alignment->stride_align[i] = 15; /* 16-byte alignment */
|
||||
alignment->stride_align[i] = stride_align;
|
||||
|
||||
alignment->padding_right = GST_ROUND_UP_16 (alloc_w) - width;
|
||||
alignment->padding_bottom = GST_ROUND_UP_32 (alloc_h) - height;
|
||||
|
|
Loading…
Reference in a new issue