summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.co.uk>2015-07-28 11:20:40 -0400
committerNicolas Dufresne <nicolas.dufresne@collabora.co.uk>2015-07-28 11:20:40 -0400
commit47e436916d73704ecc5f189df89a7de085bcb869 (patch)
tree9ef98638dbba9960a7a0d91ab32279bf93973f64 /tests
parent3d9d4869f4c904b67a3dc6354ea2456309a41b8e (diff)
downloadgstreamer-plugins-bad-47e436916d73704ecc5f189df89a7de085bcb869.tar.gz
glcolorconvert-test: Test notify function for setup_wrapped
gst_gl_memory_setup_wrapped() now takes a destroy notify function. This destroy notify is called to track the memory life time, hence will notify each time a memory get destroyed. This test check that the callback count is correct.
Diffstat (limited to 'tests')
-rw-r--r--tests/check/libs/gstglcolorconvert.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/check/libs/gstglcolorconvert.c b/tests/check/libs/gstglcolorconvert.c
index 9f710748d..3e3007789 100644
--- a/tests/check/libs/gstglcolorconvert.c
+++ b/tests/check/libs/gstglcolorconvert.c
@@ -107,9 +107,17 @@ _video_info_plane_size (GstVideoInfo * info, guint plane)
}
static void
+_frame_unref (gpointer user_data)
+{
+ gint *ref_count = user_data;
+ g_atomic_int_add (ref_count, -1);
+}
+
+static void
check_conversion (TestFrame * frames, guint size)
{
gint i, j, k, l;
+ gint ref_count = 0;
for (i = 0; i < size; i++) {
GstBuffer *inbuf;
@@ -132,9 +140,10 @@ check_conversion (TestFrame * frames, guint size)
}
/* create GL buffer */
+ ref_count += GST_VIDEO_INFO_N_PLANES (&in_info);
inbuf = gst_buffer_new ();
fail_unless (gst_gl_memory_setup_wrapped (context, &in_info, NULL,
- (gpointer *) in_data, in_mem, NULL, NULL));
+ (gpointer *) in_data, in_mem, &ref_count, _frame_unref));
for (j = 0; j < GST_VIDEO_INFO_N_PLANES (&in_info); j++) {
gst_buffer_append_memory (inbuf, (GstMemory *) in_mem[j]);
@@ -201,6 +210,8 @@ check_conversion (TestFrame * frames, guint size)
gst_caps_unref (in_caps);
gst_video_frame_unmap (&in_frame);
gst_buffer_unref (inbuf);
+
+ fail_unless_equals_int (ref_count, 0);
}
}