From 0c034f38947880114f8f29cb167b4c1e655aa02c Mon Sep 17 00:00:00 2001 From: Zeeshan Ali Date: Mon, 2 Jul 2018 17:51:06 +0200 Subject: [PATCH] test: Ensure gst_video_info_set_format() calls succeed https://bugzilla.gnome.org/show_bug.cgi?id=796106 --- tests/check/libs/video.c | 51 ++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/tests/check/libs/video.c b/tests/check/libs/video.c index 3d94ff488e..2d3217de9c 100644 --- a/tests/check/libs/video.c +++ b/tests/check/libs/video.c @@ -437,7 +437,7 @@ GST_START_TEST (test_video_formats_pack_unpack) fail_unless (unpackinfo != NULL); gst_video_info_init (&vinfo); - gst_video_info_set_format (&vinfo, fmt, WIDTH, HEIGHT); + fail_unless (gst_video_info_set_format (&vinfo, fmt, WIDTH, HEIGHT)); vsize = GST_VIDEO_INFO_SIZE (&vinfo); vdata = g_malloc (vsize); memset (vdata, 0x99, vsize); @@ -533,7 +533,7 @@ GST_START_TEST (test_video_formats) GST_LOG ("%s, %dx%d", fourcc_list[i].fourcc, w, h); gst_video_info_init (&vinfo); - gst_video_info_set_format (&vinfo, fmt, w, h); + fail_unless (gst_video_info_set_format (&vinfo, fmt, w, h)); paintinfo.width = w; paintinfo.height = h; @@ -659,7 +659,8 @@ GST_START_TEST (test_video_formats_rgb) GstStructure *structure; gst_video_info_init (&vinfo); - gst_video_info_set_format (&vinfo, GST_VIDEO_FORMAT_RGB, 800, 600); + fail_unless (gst_video_info_set_format (&vinfo, GST_VIDEO_FORMAT_RGB, 800, + 600)); vinfo.par_n = 1; vinfo.par_d = 1; vinfo.fps_n = 0; @@ -695,7 +696,8 @@ GST_START_TEST (test_video_formats_rgba_large_dimension) GstStructure *structure; gst_video_info_init (&vinfo); - gst_video_info_set_format (&vinfo, GST_VIDEO_FORMAT_RGBA, 29700, 21000); + fail_unless (gst_video_info_set_format (&vinfo, GST_VIDEO_FORMAT_RGBA, 29700, + 21000)); vinfo.par_n = 1; vinfo.par_d = 1; vinfo.fps_n = 0; @@ -899,7 +901,8 @@ GST_START_TEST (test_parse_caps_multiview) GstCaps *caps; gst_video_info_init (&vinfo); - gst_video_info_set_format (&vinfo, GST_VIDEO_FORMAT_I420, 320, 240); + fail_unless (gst_video_info_set_format (&vinfo, GST_VIDEO_FORMAT_I420, + 320, 240)); GST_VIDEO_INFO_MULTIVIEW_MODE (&vinfo) = modes[i]; GST_VIDEO_INFO_MULTIVIEW_FLAGS (&vinfo) = flags[j]; @@ -1035,7 +1038,8 @@ GST_START_TEST (test_convert_frame) gst_buffer_unmap (from_buffer, &map); gst_video_info_init (&vinfo); - gst_video_info_set_format (&vinfo, GST_VIDEO_FORMAT_xRGB, 640, 480); + fail_unless (gst_video_info_set_format (&vinfo, GST_VIDEO_FORMAT_xRGB, 640, + 480)); vinfo.fps_n = 25; vinfo.fps_d = 1; vinfo.par_n = 1; @@ -1057,7 +1061,8 @@ GST_START_TEST (test_convert_frame) error = NULL; gst_caps_unref (to_caps); - gst_video_info_set_format (&vinfo, GST_VIDEO_FORMAT_I420, 240, 320); + fail_unless (gst_video_info_set_format (&vinfo, GST_VIDEO_FORMAT_I420, 240, + 320)); vinfo.fps_n = 25; vinfo.fps_d = 1; vinfo.par_n = 1; @@ -1121,7 +1126,8 @@ GST_START_TEST (test_convert_frame_async) gst_buffer_unmap (from_buffer, &map); gst_video_info_init (&vinfo); - gst_video_info_set_format (&vinfo, GST_VIDEO_FORMAT_xRGB, 640, 470); + fail_unless (gst_video_info_set_format (&vinfo, GST_VIDEO_FORMAT_xRGB, 640, + 470)); vinfo.par_n = 1; vinfo.par_d = 1; vinfo.fps_n = 25; @@ -1152,7 +1158,8 @@ GST_START_TEST (test_convert_frame_async) gst_caps_unref (to_caps); gst_video_info_init (&vinfo); - gst_video_info_set_format (&vinfo, GST_VIDEO_FORMAT_I420, 240, 320); + fail_unless (gst_video_info_set_format (&vinfo, GST_VIDEO_FORMAT_I420, 240, + 320)); vinfo.par_n = 1; vinfo.par_d = 2; vinfo.fps_n = 25; @@ -2132,7 +2139,7 @@ GST_START_TEST (test_video_pack_unpack2) pixels = make_pixels (depth, WIDTH, HEIGHT); stride = WIDTH * (depth >> 1); - gst_video_info_set_format (&info, format, WIDTH, HEIGHT); + fail_unless (gst_video_info_set_format (&info, format, WIDTH, HEIGHT)); buffer = gst_buffer_new_and_alloc (info.size); gst_video_frame_map (&frame, &info, buffer, GST_MAP_READWRITE); @@ -2356,7 +2363,7 @@ GST_START_TEST (test_video_color_convert) GstVideoFrame inframe; GstBuffer *inbuffer; - gst_video_info_set_format (&ininfo, infmt, WIDTH, HEIGHT); + fail_unless (gst_video_info_set_format (&ininfo, infmt, WIDTH, HEIGHT)); inbuffer = gst_buffer_new_and_alloc (ininfo.size); gst_buffer_memset (inbuffer, 0, 0, -1); gst_video_frame_map (&inframe, &ininfo, inbuffer, GST_MAP_READ); @@ -2370,7 +2377,7 @@ GST_START_TEST (test_video_color_convert) gint count; ConvertResult res; - gst_video_info_set_format (&outinfo, outfmt, WIDTH, HEIGHT); + fail_unless (gst_video_info_set_format (&outinfo, outfmt, WIDTH, HEIGHT)); outbuffer = gst_buffer_new_and_alloc (outinfo.size); gst_video_frame_map (&outframe, &outinfo, outbuffer, GST_MAP_WRITE); @@ -2455,13 +2462,15 @@ GST_START_TEST (test_video_size_convert) gint count, method; ConvertResult res; - gst_video_info_set_format (&ininfo, infmt, WIDTH_IN, HEIGHT_IN); + fail_unless (gst_video_info_set_format (&ininfo, infmt, WIDTH_IN, + HEIGHT_IN)); inbuffer = gst_buffer_new_and_alloc (ininfo.size); gst_buffer_memset (inbuffer, 0, 0, -1); gst_video_frame_map (&inframe, &ininfo, inbuffer, GST_MAP_READ); outfmt = infmt; - gst_video_info_set_format (&outinfo, outfmt, WIDTH_OUT, HEIGHT_OUT); + fail_unless (gst_video_info_set_format (&outinfo, outfmt, WIDTH_OUT, + HEIGHT_OUT)); outbuffer = gst_buffer_new_and_alloc (outinfo.size); gst_video_frame_map (&outframe, &outinfo, outbuffer, GST_MAP_WRITE); @@ -2530,12 +2539,14 @@ GST_START_TEST (test_video_convert) GstBuffer *inbuffer, *outbuffer; GstVideoConverter *convert; - gst_video_info_set_format (&ininfo, GST_VIDEO_FORMAT_ARGB, 320, 240); + fail_unless (gst_video_info_set_format (&ininfo, GST_VIDEO_FORMAT_ARGB, 320, + 240)); inbuffer = gst_buffer_new_and_alloc (ininfo.size); gst_buffer_memset (inbuffer, 0, 0, -1); gst_video_frame_map (&inframe, &ininfo, inbuffer, GST_MAP_READ); - gst_video_info_set_format (&outinfo, GST_VIDEO_FORMAT_BGRx, 400, 300); + fail_unless (gst_video_info_set_format (&outinfo, GST_VIDEO_FORMAT_BGRx, 400, + 300)); outbuffer = gst_buffer_new_and_alloc (outinfo.size); gst_video_frame_map (&outframe, &outinfo, outbuffer, GST_MAP_WRITE); @@ -2749,8 +2760,8 @@ test_overlay_blend_rect (gint x, gint y, gint width, gint height, gst_buffer_new_and_alloc (VIDEO_WIDTH * VIDEO_HEIGHT * sizeof (guint32)); gst_buffer_memset (pix, 0, 0, gst_buffer_get_size (pix)); gst_video_info_init (&vinfo); - gst_video_info_set_format (&vinfo, GST_VIDEO_OVERLAY_COMPOSITION_FORMAT_RGB, - VIDEO_WIDTH, VIDEO_HEIGHT); + fail_unless (gst_video_info_set_format (&vinfo, + GST_VIDEO_OVERLAY_COMPOSITION_FORMAT_RGB, VIDEO_WIDTH, VIDEO_HEIGHT)); gst_video_frame_map (video_frame, &vinfo, pix, GST_MAP_READWRITE); gst_buffer_unref (pix); pix = NULL; @@ -2848,8 +2859,8 @@ GST_START_TEST (test_overlay_composition_over_transparency) pix1 = gst_buffer_new_and_alloc (fwidth * sizeof (guint32) * height); gst_buffer_memset (pix1, 0, 0x00, gst_buffer_get_size (pix1)); gst_video_info_init (&vinfo); - gst_video_info_set_format (&vinfo, GST_VIDEO_OVERLAY_COMPOSITION_FORMAT_RGB, - fwidth, height); + fail_unless (gst_video_info_set_format (&vinfo, + GST_VIDEO_OVERLAY_COMPOSITION_FORMAT_RGB, fwidth, height)); gst_video_frame_map (&video_frame, &vinfo, pix1, GST_MAP_READWRITE); gst_buffer_unref (pix1);