Commit 2a91bbbc authored by Wim Taymans's avatar Wim Taymans
Browse files

tests: update some tests for new memory api

parent e83c5379
......@@ -114,15 +114,14 @@ create_buffer_rgb24_3x4 (void)
};
guint rowstride = GST_ROUND_UP_4 (WIDTH * 3);
GstBuffer *buf;
gpointer buf_data;
gsize size;
GstMapInfo info;
buf = gst_buffer_new_and_alloc (HEIGHT * rowstride);
buf_data = gst_buffer_map (buf, &size, NULL, GST_MAP_READWRITE);
fail_unless_equals_int (size, sizeof (rgb24_3x4_img));
memcpy (buf_data, rgb24_3x4_img, sizeof (rgb24_3x4_img));
gst_buffer_map (buf, &info, GST_MAP_READWRITE);
fail_unless_equals_int (info.size, sizeof (rgb24_3x4_img));
memcpy (info.data, rgb24_3x4_img, sizeof (rgb24_3x4_img));
gst_buffer_unmap (buf, buf_data, size);
gst_buffer_unmap (buf, &info);
return buf;
}
......@@ -144,15 +143,14 @@ create_buffer_rgba32_3x4 (void)
};
guint rowstride = WIDTH * 4;
GstBuffer *buf;
gpointer buf_data;
gsize size;
GstMapInfo map;
buf = gst_buffer_new_and_alloc (HEIGHT * rowstride);
buf_data = gst_buffer_map (buf, &size, NULL, GST_MAP_READWRITE);
fail_unless_equals_int (size, sizeof (rgba32_3x4_img));
memcpy (buf_data, rgba32_3x4_img, sizeof (rgba32_3x4_img));
gst_buffer_map (buf, &map, GST_MAP_READWRITE);
fail_unless_equals_int (map.size, sizeof (rgba32_3x4_img));
memcpy (map.data, rgba32_3x4_img, sizeof (rgba32_3x4_img));
gst_buffer_unmap (buf, buf_data, size);
gst_buffer_unmap (buf, &map);
return buf;
}
......@@ -212,8 +210,7 @@ GST_START_TEST (test_rgba32)
GstCaps *incaps;
guint8 *ayuv;
guint outlength;
gpointer buf_data;
gsize size;
GstMapInfo map;
incaps = create_caps_rgba32 ();
alphacolor = setup_alphacolor ();
......@@ -240,10 +237,10 @@ GST_START_TEST (test_rgba32)
ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
outlength = WIDTH * HEIGHT * 4; /* output is AYUV */
buf_data = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
fail_unless_equals_int (size, outlength);
gst_buffer_map (outbuffer, &map, GST_MAP_READ);
fail_unless_equals_int (map.size, outlength);
ayuv = buf_data;
ayuv = map.data;
/* check alpha values (0x00 = totally transparent, 0xff = totally opaque) */
fail_unless_ayuv_pixel_has_alpha (ayuv, 0, 0, 0xff);
......@@ -262,7 +259,7 @@ GST_START_TEST (test_rgba32)
/* we don't check the YUV data, because apparently results differ slightly
* depending on whether we run in valgrind or not */
gst_buffer_unmap (outbuffer, buf_data, size);
gst_buffer_unmap (outbuffer, &map);
buffers = g_list_remove (buffers, outbuffer);
gst_buffer_unref (outbuffer);
......
This diff is collapsed.
This diff is collapsed.
......@@ -88,12 +88,13 @@ on_handoff (GstElement * object, GstBuffer * buffer, GstPad * pad,
gpointer user_data)
{
if (!have_data) {
gsize size;
GstMapInfo map;
gdouble *data;
data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
gst_buffer_map (buffer, &map, GST_MAP_READ);
data = (gdouble *) map.data;
fail_unless (size > 5 * sizeof (gdouble));
fail_unless (map.size > 5 * sizeof (gdouble));
fail_unless (data[0] == 0.0);
fail_unless (data[1] == 0.0);
fail_unless (data[2] == 0.0);
......@@ -101,7 +102,7 @@ on_handoff (GstElement * object, GstBuffer * buffer, GstPad * pad,
fail_unless (data[4] == 0.0);
fail_unless (data[5] != 0.0);
gst_buffer_unmap (buffer, data, size);
gst_buffer_unmap (buffer, &map);
have_data = TRUE;
}
}
......
......@@ -98,12 +98,13 @@ on_handoff (GstElement * object, GstBuffer * buffer, GstPad * pad,
gpointer user_data)
{
if (!have_data) {
gsize size;
GstMapInfo map;
gdouble *data;
data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
gst_buffer_map (buffer, &map, GST_MAP_READ);
data = (gdouble *) map.data;
fail_unless (size > 5 * sizeof (gdouble));
fail_unless (map.size > 5 * sizeof (gdouble));
fail_unless (data[0] == 0.0);
fail_unless (data[1] == 0.0);
fail_unless (data[2] == 0.0);
......@@ -111,7 +112,7 @@ on_handoff (GstElement * object, GstBuffer * buffer, GstPad * pad,
fail_unless (data[4] == 0.0);
fail_unless (data[5] != 0.0);
gst_buffer_unmap (buffer, data, size);
gst_buffer_unmap (buffer, &map);
have_data = TRUE;
}
}
......
......@@ -96,6 +96,7 @@ GST_START_TEST (test_passthrough)
GstCaps *caps;
gint16 in[4] = { 16384, -256, 128, -512 };
gint16 *res;
GstMapInfo map;
invert = setup_invert ();
fail_unless (gst_element_set_state (invert,
......@@ -116,10 +117,11 @@ GST_START_TEST (test_passthrough)
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
gst_buffer_map (outbuffer, &map, GST_MAP_READ);
res = (gint16 *) map.data;
GST_INFO ("expected %+5d %+5d %+5d %+5d real %+5d %+5d %+5d %+5d",
in[0], in[1], in[2], in[3], res[0], res[1], res[2], res[3]);
gst_buffer_unmap (outbuffer, res, -1);
gst_buffer_unmap (outbuffer, &map);
fail_unless (gst_buffer_memcmp (outbuffer, 0, in, 8) == 0);
......@@ -137,6 +139,7 @@ GST_START_TEST (test_zero)
gint16 in[4] = { 16384, -256, 128, -512 };
gint16 out[4] = { 0, 0, 0, 0 };
gint16 *res;
GstMapInfo map;
invert = setup_invert ();
g_object_set (G_OBJECT (invert), "degree", 0.5, NULL);
......@@ -158,10 +161,11 @@ GST_START_TEST (test_zero)
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
gst_buffer_map (outbuffer, &map, GST_MAP_READ);
res = (gint16 *) map.data;
GST_INFO ("expected %+5d %+5d %+5d %+5d real %+5d %+5d %+5d %+5d",
out[0], out[1], out[2], out[3], res[0], res[1], res[2], res[3]);
gst_buffer_unmap (outbuffer, res, -1);
gst_buffer_unmap (outbuffer, &map);
fail_unless (gst_buffer_memcmp (outbuffer, 0, out, 8) == 0);
......@@ -179,6 +183,7 @@ GST_START_TEST (test_full_inverse)
gint16 in[4] = { 16384, -256, 128, -512 };
gint16 out[4] = { -16385, 255, -129, 511 };
gint16 *res;
GstMapInfo map;
invert = setup_invert ();
g_object_set (G_OBJECT (invert), "degree", 1.0, NULL);
......@@ -200,10 +205,11 @@ GST_START_TEST (test_full_inverse)
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
gst_buffer_map (outbuffer, &map, GST_MAP_READ);
res = (gint16 *) map.data;
GST_INFO ("expected %+5d %+5d %+5d %+5d real %+5d %+5d %+5d %+5d",
out[0], out[1], out[2], out[3], res[0], res[1], res[2], res[3]);
gst_buffer_unmap (outbuffer, res, -1);
gst_buffer_unmap (outbuffer, &map);
fail_unless (gst_buffer_memcmp (outbuffer, 0, out, 8) == 0);
......@@ -221,6 +227,7 @@ GST_START_TEST (test_25_inverse)
gint16 in[4] = { 16384, -256, 128, -512 };
gint16 out[4] = { 8191, -128, 63, -256 };
gint16 *res;
GstMapInfo map;
invert = setup_invert ();
g_object_set (G_OBJECT (invert), "degree", 0.25, NULL);
......@@ -242,10 +249,11 @@ GST_START_TEST (test_25_inverse)
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
gst_buffer_map (outbuffer, &map, GST_MAP_READ);
res = (gint16 *) map.data;
GST_INFO ("expected %+5d %+5d %+5d %+5d real %+5d %+5d %+5d %+5d",
out[0], out[1], out[2], out[3], res[0], res[1], res[2], res[3]);
gst_buffer_unmap (outbuffer, res, -1);
gst_buffer_unmap (outbuffer, &map);
fail_unless (gst_buffer_memcmp (outbuffer, 0, out, 8) == 0);
......
......@@ -102,6 +102,7 @@ GST_START_TEST (test_32_bp_0hz)
GstCaps *caps;
gfloat *in, *res, rms;
gint i;
GstMapInfo map;
GList *node;
audiowsincband = setup_audiowsincband ();
......@@ -120,10 +121,11 @@ GST_START_TEST (test_32_bp_0hz)
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
in = (gfloat *) map.data;
for (i = 0; i < 1024; i++)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, in, -1);
gst_buffer_unmap (inbuffer, &map);
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
gst_pad_set_caps (mysrcpad, caps);
......@@ -138,18 +140,20 @@ GST_START_TEST (test_32_bp_0hz)
for (node = buffers; node; node = node->next) {
gint buffer_length;
gsize size;
fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
buffer_length = size / sizeof (gfloat);
gst_buffer_map (outbuffer, &map, GST_MAP_READ);
res = (gfloat *) map.data;
buffer_length = map.size / sizeof (gfloat);
rms = 0.0;
for (i = 0; i < buffer_length; i++)
rms += res[i] * res[i];
rms = sqrt (rms / buffer_length);
fail_unless (rms <= 0.1);
gst_buffer_unmap (outbuffer, &map);
}
/* cleanup */
......@@ -168,6 +172,7 @@ GST_START_TEST (test_32_bp_11025hz)
GstCaps *caps;
gfloat *in, *res, rms;
gint i;
GstMapInfo map;
GList *node;
audiowsincband = setup_audiowsincband ();
......@@ -185,14 +190,15 @@ GST_START_TEST (test_32_bp_11025hz)
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
in = (gfloat *) map.data;
for (i = 0; i < 1024; i += 4) {
in[i] = 0.0;
in[i + 1] = 1.0;
in[i + 2] = 0.0;
in[i + 3] = -1.0;
}
gst_buffer_unmap (inbuffer, in, -1);
gst_buffer_unmap (inbuffer, &map);
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
gst_pad_set_caps (mysrcpad, caps);
......@@ -207,12 +213,12 @@ GST_START_TEST (test_32_bp_11025hz)
for (node = buffers; node; node = node->next) {
gint buffer_length;
gsize size;
fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
buffer_length = size / sizeof (gfloat);
gst_buffer_map (outbuffer, &map, GST_MAP_READ);
res = (gfloat *) map.data;
buffer_length = map.size / sizeof (gfloat);
rms = 0.0;
for (i = 0; i < buffer_length; i++)
rms += res[i] * res[i];
......@@ -237,6 +243,7 @@ GST_START_TEST (test_32_bp_22050hz)
GstCaps *caps;
gfloat *in, *res, rms;
gint i;
GstMapInfo map;
GList *node;
audiowsincband = setup_audiowsincband ();
......@@ -254,12 +261,13 @@ GST_START_TEST (test_32_bp_22050hz)
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
in = (gfloat *) map.data;
for (i = 0; i < 1024; i += 2) {
in[i] = 1.0;
in[i + 1] = -1.0;
}
gst_buffer_unmap (inbuffer, in, -1);
gst_buffer_unmap (inbuffer, &map);
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
gst_pad_set_caps (mysrcpad, caps);
......@@ -274,12 +282,12 @@ GST_START_TEST (test_32_bp_22050hz)
for (node = buffers; node; node = node->next) {
gint buffer_length;
gsize size;
fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
buffer_length = size / sizeof (gfloat);
gst_buffer_map (outbuffer, &map, GST_MAP_READ);
res = (gfloat *) map.data;
buffer_length = map.size / sizeof (gfloat);
rms = 0.0;
for (i = 0; i < buffer_length; i++)
rms += res[i] * res[i];
......@@ -303,6 +311,7 @@ GST_START_TEST (test_32_br_0hz)
GstCaps *caps;
gfloat *in, *res, rms;
gint i;
GstMapInfo map;
GList *node;
audiowsincband = setup_audiowsincband ();
......@@ -320,10 +329,11 @@ GST_START_TEST (test_32_br_0hz)
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
in = (gfloat *) map.data;
for (i = 0; i < 1024; i++)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, in, -1);
gst_buffer_unmap (inbuffer, &map);
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
gst_pad_set_caps (mysrcpad, caps);
......@@ -338,12 +348,12 @@ GST_START_TEST (test_32_br_0hz)
for (node = buffers; node; node = node->next) {
gint buffer_length;
gsize size;
fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
buffer_length = size / sizeof (gfloat);
gst_buffer_map (outbuffer, &map, GST_MAP_READ);
res = (gfloat *) map.data;
buffer_length = map.size / sizeof (gfloat);
rms = 0.0;
for (i = 0; i < buffer_length; i++)
rms += res[i] * res[i];
......@@ -367,6 +377,7 @@ GST_START_TEST (test_32_br_11025hz)
GstCaps *caps;
gfloat *in, *res, rms;
gint i;
GstMapInfo map;
GList *node;
audiowsincband = setup_audiowsincband ();
......@@ -384,7 +395,8 @@ GST_START_TEST (test_32_br_11025hz)
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
in = (gfloat *) map.data;
for (i = 0; i < 1024; i += 4) {
in[i] = 0.0;
......@@ -392,7 +404,7 @@ GST_START_TEST (test_32_br_11025hz)
in[i + 2] = 0.0;
in[i + 3] = -1.0;
}
gst_buffer_unmap (inbuffer, in, -1);
gst_buffer_unmap (inbuffer, &map);
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
gst_pad_set_caps (mysrcpad, caps);
......@@ -407,12 +419,12 @@ GST_START_TEST (test_32_br_11025hz)
for (node = buffers; node; node = node->next) {
gint buffer_length;
gsize size;
fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
buffer_length = size / sizeof (gfloat);
gst_buffer_map (outbuffer, &map, GST_MAP_READ);
res = (gfloat *) map.data;
buffer_length = map.size / sizeof (gfloat);
rms = 0.0;
for (i = 0; i < buffer_length; i++)
rms += res[i] * res[i];
......@@ -437,6 +449,7 @@ GST_START_TEST (test_32_br_22050hz)
GstCaps *caps;
gfloat *in, *res, rms;
gint i;
GstMapInfo map;
GList *node;
audiowsincband = setup_audiowsincband ();
......@@ -454,12 +467,13 @@ GST_START_TEST (test_32_br_22050hz)
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
in = (gfloat *) map.data;
for (i = 0; i < 1024; i += 2) {
in[i] = 1.0;
in[i + 1] = -1.0;
}
gst_buffer_unmap (inbuffer, in, -1);
gst_buffer_unmap (inbuffer, &map);
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
gst_pad_set_caps (mysrcpad, caps);
......@@ -474,12 +488,12 @@ GST_START_TEST (test_32_br_22050hz)
for (node = buffers; node; node = node->next) {
gint buffer_length;
gsize size;
fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
buffer_length = size / sizeof (gfloat);
gst_buffer_map (outbuffer, &map, GST_MAP_READ);
res = (gfloat *) map.data;
buffer_length = map.size / sizeof (gfloat);
rms = 0.0;
for (i = 0; i < buffer_length; i++)
rms += res[i] * res[i];
......@@ -502,6 +516,7 @@ GST_START_TEST (test_32_small_buffer)
GstCaps *caps;
gfloat *in;
gint i;
GstMapInfo map;
audiowsincband = setup_audiowsincband ();
/* Set to bandpass */
......@@ -518,10 +533,11 @@ GST_START_TEST (test_32_small_buffer)
44100 / 4.0 + 44100 / 16.0, NULL);
inbuffer = gst_buffer_new_and_alloc (20 * sizeof (gfloat));
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
in = (gfloat *) map.data;
for (i = 0; i < 20; i++)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, in, -1);
gst_buffer_unmap (inbuffer, &map);
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
gst_pad_set_caps (mysrcpad, caps);
......@@ -558,6 +574,7 @@ GST_START_TEST (test_64_bp_0hz)
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
GstMapInfo map;
GList *node;
audiowsincband = setup_audiowsincband ();
......@@ -575,10 +592,11 @@ GST_START_TEST (test_64_bp_0hz)
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
in = (gdouble *) map.data;
for (i = 0; i < 1024; i++)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, in, -1);
gst_buffer_unmap (inbuffer, &map);
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64);
gst_pad_set_caps (mysrcpad, caps);
......@@ -593,12 +611,12 @@ GST_START_TEST (test_64_bp_0hz)
for (node = buffers; node; node = node->next) {
gint buffer_length;
gsize size;
fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
buffer_length = size / sizeof (gfloat);
gst_buffer_map (outbuffer, &map, GST_MAP_READ);
res = (gdouble *) map.data;
buffer_length = map.size / sizeof (gdouble);
rms = 0.0;
for (i = 0; i < buffer_length; i++)
rms += res[i] * res[i];
......@@ -622,6 +640,7 @@ GST_START_TEST (test_64_bp_11025hz)
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
GstMapInfo map;
GList *node;
audiowsincband = setup_audiowsincband ();
......@@ -639,14 +658,15 @@ GST_START_TEST (test_64_bp_11025hz)
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
in = (gdouble *) map.data;
for (i = 0; i < 1024; i += 4) {
in[i] = 0.0;
in[i + 1] = 1.0;
in[i + 2] = 0.0;
in[i + 3] = -1.0;
}
gst_buffer_unmap (inbuffer, in, -1);
gst_buffer_unmap (inbuffer, &map);
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64);
gst_pad_set_caps (mysrcpad, caps);
......@@ -661,12 +681,12 @@ GST_START_TEST (test_64_bp_11025hz)
for (node = buffers; node; node = node->next) {
gint buffer_length;
gsize size;
fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
buffer_length = size / sizeof (gfloat);
gst_buffer_map (outbuffer, &map, GST_MAP_READ);
res = (gdouble *) map.data;
buffer_length = map.size / sizeof (gdouble);
rms = 0.0;
for (i = 0; i < buffer_length; i++)
rms += res[i] * res[i];
......@@ -691,6 +711,7 @@ GST_START_TEST (test_64_bp_22050hz)
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
GstMapInfo map;
GList *node;
audiowsincband = setup_audiowsincband ();
......@@ -708,12 +729,13 @@ GST_START_TEST (test_64_bp_22050hz)
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
in = (gdouble *) map.data;
for (i = 0; i < 1024; i += 2) {
in[i] = 1.0;
in[i + 1] = -1.0;
}
gst_buffer_unmap (inbuffer, in, -1);
gst_buffer_unmap (inbuffer, &map);
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64);
gst_pad_set_caps (mysrcpad, caps);
......@@ -728,12 +750,12 @@ GST_START_TEST (test_64_bp_22050hz)
for (node = buffers; node; node = node->next) {
gint buffer_length;
gsize size;
fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
buffer_length = size / sizeof (gfloat);
gst_buffer_map (outbuffer, &map, GST_MAP_READ);
res = (gdouble *) map.data;
buffer_length = map.size / sizeof (gdouble);
rms = 0.0;
for (i = 0; i < buffer_length; i++)
rms += res[i] * res[i];
......@@ -757,6 +779,7 @@ GST_START_TEST (test_64_br_0hz)
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
GstMapInfo map;
GList *node;
audiowsincband = setup_audiowsincband ();
......@@ -774,10 +797,11 @@ GST_START_TEST (test_64_br_0hz)
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));