mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 11:32:38 +00:00
test: camerabin: Fix buffer size calculation
We were assunming that GStreamer size for RGB (24bit packed) data was width x height x 3, but GStreamer defaults to specific alignment. Use GstVideoInfo API in order to obtain the buffer size. This fixes failure seen when trying to merge: https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/998 which make us negoaite 1x1 instead of 16x16 in this test. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2297>
This commit is contained in:
parent
c442c9bd5e
commit
a01883013a
1 changed files with 5 additions and 1 deletions
|
@ -335,6 +335,7 @@ static GstFlowReturn
|
||||||
gst_test_video_src_alloc (GstPushSrc * src, GstBuffer ** buf)
|
gst_test_video_src_alloc (GstPushSrc * src, GstBuffer ** buf)
|
||||||
{
|
{
|
||||||
GstTestVideoSrc *self = GST_TEST_VIDEO_SRC (src);
|
GstTestVideoSrc *self = GST_TEST_VIDEO_SRC (src);
|
||||||
|
GstVideoInfo vinfo;
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
gsize data_size;
|
gsize data_size;
|
||||||
|
|
||||||
|
@ -344,7 +345,10 @@ gst_test_video_src_alloc (GstPushSrc * src, GstBuffer ** buf)
|
||||||
self->caps = NULL;
|
self->caps = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
data_size = self->width * self->height * 3; /* RGB size */
|
gst_video_info_set_format (&vinfo, GST_VIDEO_FORMAT_RGB, self->width,
|
||||||
|
self->height);
|
||||||
|
|
||||||
|
data_size = vinfo.size;
|
||||||
data = g_malloc (data_size);
|
data = g_malloc (data_size);
|
||||||
*buf = gst_buffer_new_wrapped (data, data_size);
|
*buf = gst_buffer_new_wrapped (data, data_size);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue