summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2016-05-27 12:49:32 +0100
committerTim-Philipp Müller <tim@centricular.com>2016-05-27 12:58:37 +0100
commiteaf329d39bef5acdad7748f74b81c7ad2856ae00 (patch)
treefc3ce5f2a7ce5ce1903ac1169be88fbc65753707
parent3c50fd7669c989086cc1850a812e61bdcd666481 (diff)
tests: add unit test for JPEG-2000 rtp payloader leak
https://bugzilla.gnome.org/show_bug.cgi?id=766870
-rw-r--r--tests/check/pipelines/simple-launch-lines.c26
-rw-r--r--tests/files/Makefile.am1
-rw-r--r--tests/files/gradient.j2kbin0 -> 1679 bytes
3 files changed, 27 insertions, 0 deletions
diff --git a/tests/check/pipelines/simple-launch-lines.c b/tests/check/pipelines/simple-launch-lines.c
index 84d0f213f..e074e4944 100644
--- a/tests/check/pipelines/simple-launch-lines.c
+++ b/tests/check/pipelines/simple-launch-lines.c
@@ -213,6 +213,32 @@ GST_START_TEST (test_rtp_payloaders)
GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
GST_MESSAGE_UNKNOWN, target_state);
+#define J2K_TEST_FILE_PATH GST_TEST_FILES_PATH G_DIR_SEPARATOR_S "gradient.j2k"
+#define J2KCAPS "image/x-jpc,colorspace=sYUV,num-components=3,width=720,height=576,pixel-aspect-ratio=1/1,framerate=30/1"
+ {
+ GstElement *pipeline, *src;
+ GstFlowReturn flow = GST_FLOW_OK;
+ GstBuffer *buf;
+ gchar *data;
+ gsize len;
+
+ s = "appsrc caps=" J2KCAPS " name=src ! rtpj2kpay ! rtpj2kdepay ! fakesink";
+
+ fail_unless (g_file_get_contents (J2K_TEST_FILE_PATH, &data, &len, NULL));
+ buf = gst_buffer_new_wrapped (data, len);
+ pipeline = setup_pipeline (s);
+ src = gst_bin_get_by_name (GST_BIN (pipeline), "src");
+ g_object_set (src, "format", GST_FORMAT_TIME, NULL);
+ g_signal_emit_by_name (src, "push-buffer", buf, &flow);
+ gst_buffer_unref (buf);
+ fail_unless_equals_int (flow, GST_FLOW_OK);
+ g_signal_emit_by_name (src, "end-of-stream", &flow);
+ gst_object_unref (src);
+ run_pipeline (pipeline, s,
+ GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
+ GST_MESSAGE_UNKNOWN, target_state);
+ }
+
/*s = FAKESRC " ! ! rtpac3depay ! " FAKESINK */
/*s = FAKESRC " ! ! asteriskh263 ! " FAKESINK; */
/*s = FAKESRC " ! ! rtpmpvdepay ! " FAKESINK; */
diff --git a/tests/files/Makefile.am b/tests/files/Makefile.am
index 4872dcb07..bd3282b91 100644
--- a/tests/files/Makefile.am
+++ b/tests/files/Makefile.am
@@ -1,6 +1,7 @@
EXTRA_DIST = \
audiotestsrc.flac \
+ gradient.j2k \
id3-407349-1.tag \
id3-407349-2.tag \
id3-447000-wcop.tag \
diff --git a/tests/files/gradient.j2k b/tests/files/gradient.j2k
new file mode 100644
index 000000000..ad2c94a62
--- /dev/null
+++ b/tests/files/gradient.j2k
Binary files differ