tests: add unit test for JPEG-2000 rtp payloader leak
authorTim-Philipp Müller <tim@centricular.com>
Fri, 27 May 2016 11:49:32 +0000 (12:49 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Fri, 27 May 2016 11:58:37 +0000 (12:58 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=766870

tests/check/pipelines/simple-launch-lines.c
tests/files/Makefile.am
tests/files/gradient.j2k [new file with mode: 0644]

index 84d0f21..e074e49 100644 (file)
@@ -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; */
index 4872dcb..bd3282b 100644 (file)
@@ -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 (file)
index 0000000..ad2c94a
Binary files /dev/null and b/tests/files/gradient.j2k differ