Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/GStreamer/gst-plugins-good.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorStian Selnes <stian@pexip.com>2018-02-28 17:46:51 +0300
committerSebastian Dröge <sebastian@centricular.com>2020-06-02 23:59:20 +0300
commit44e4de43dafc550a01c7ba677bd398e135dc550c (patch)
tree4c2833e7b8e5038f4e3f8bead582fa77547107a9 /tests
parent1b8df15b7888b6a476f71a8d6906330eb7751ffd (diff)
vpxdec: Check that output width and height != 0
For VP8 it's possible to signal width or height to be 0, but it does not make sense to do so. For VP9 it's impossible. Hence, we most likely have a corrupt stream. Trying to negotiate caps downstream with either width or height as 0 will fail with something like gst_video_decoder_negotiate_default: assertion 'GST_VIDEO_INFO_WIDTH (&state->info) != 0' failed Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/610>
Diffstat (limited to 'tests')
-rw-r--r--tests/check/elements/vp8dec.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/check/elements/vp8dec.c b/tests/check/elements/vp8dec.c
index 0ebd70ac2..4ff92c7c1 100644
--- a/tests/check/elements/vp8dec.c
+++ b/tests/check/elements/vp8dec.c
@@ -19,6 +19,8 @@
*/
#include <gst/check/gstcheck.h>
+#include <gst/check/gstharness.h>
+#include <gst/video/video.h>
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
@@ -248,6 +250,38 @@ GST_START_TEST (test_decode_caps_change)
GST_END_TEST;
+GST_START_TEST (test_decode_invalid_resolution)
+{
+ GstHarness *h;
+
+ guint8 invalid_width[] = {
+ 0x50, 0x48, 0x00, 0x9d, 0x01, 0x2a, 0x00, 0x00, 0x11, 0x44, 0x39, 0x63,
+ };
+ guint8 invalid_height[] = {
+ 0x50, 0x48, 0x00, 0x9d, 0x01, 0x2a, 0x11, 0x44, 0x00, 0x00, 0x39, 0x63,
+ };
+
+ h = gst_harness_new_parse ("vp8dec");
+ gst_harness_set_src_caps_str (h, "video/x-vp8");
+
+ fail_unless_equals_int (GST_FLOW_OK,
+ gst_harness_push (h,
+ gst_buffer_new_wrapped_full (GST_MEMORY_FLAG_READONLY, invalid_width,
+ sizeof (invalid_width), 0, sizeof (invalid_width), NULL, NULL)));
+ fail_unless (gst_harness_try_pull (h) == NULL);
+
+ fail_unless_equals_int (GST_FLOW_OK,
+ gst_harness_push (h,
+ gst_buffer_new_wrapped_full (GST_MEMORY_FLAG_READONLY, invalid_height,
+ sizeof (invalid_height), 0, sizeof (invalid_height), NULL,
+ NULL)));
+ fail_unless (gst_harness_try_pull (h) == NULL);
+
+ gst_harness_teardown (h);
+}
+
+GST_END_TEST;
+
static Suite *
vp8dec_suite (void)
@@ -259,6 +293,7 @@ vp8dec_suite (void)
tcase_add_test (tc_chain, test_decode_simple);
tcase_add_test (tc_chain, test_decode_caps_change);
+ tcase_add_test (tc_chain, test_decode_invalid_resolution);
return s;
}