tests: fix remaining unit tests

This commit is contained in:
Wim Taymans 2011-03-28 15:51:46 +02:00 committed by Tim-Philipp Müller
parent 4674648248
commit fa48483c46

View file

@ -122,6 +122,11 @@ static int n_in_caps = 0;
static gboolean static gboolean
buffer_probe_cb (GstPad * pad, GstBuffer * buffer) buffer_probe_cb (GstPad * pad, GstBuffer * buffer)
{ {
guint8 *data;
gsize size;
data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_IN_CAPS)) { if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_IN_CAPS)) {
GstCaps *caps; GstCaps *caps;
GstStructure *s; GstStructure *s;
@ -143,22 +148,27 @@ buffer_probe_cb (GstPad * pad, GstBuffer * buffer)
for (i = 0; i < 3; ++i) { for (i = 0; i < 3; ++i) {
GValue *val; GValue *val;
guint8 *data2;
gsize size2;
val = &g_array_index (buffers, GValue, i); val = &g_array_index (buffers, GValue, i);
buf = g_value_peek_pointer (val); buf = g_value_peek_pointer (val);
fail_unless (GST_IS_BUFFER (buf)); fail_unless (GST_IS_BUFFER (buf));
if (GST_BUFFER_SIZE (buf) == GST_BUFFER_SIZE (buffer)) {
if (memcmp (GST_BUFFER_DATA (buf), GST_BUFFER_DATA (buffer), data2 = gst_buffer_map (buf, &size2, NULL, GST_MAP_READ);
GST_BUFFER_SIZE (buffer)) == 0) { if (size2 == size) {
if (memcmp (data2, data, size) == 0) {
found = TRUE; found = TRUE;
} }
} }
gst_buffer_unmap (buf, data2, size2);
} }
fail_unless (found, "Did not find incoming IN_CAPS buffer %p on caps", fail_unless (found, "Did not find incoming IN_CAPS buffer %p on caps",
buffer); buffer);
gst_caps_unref (caps); gst_caps_unref (caps);
} }
gst_buffer_unmap (buffer, data, size);
return TRUE; return TRUE;
} }