summaryrefslogtreecommitdiffstats
path: root/tests/check/elements
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2007-08-16 09:48:27 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2007-08-16 09:48:27 +0000
commite38e701293f998e0268d8c13d967266cf699a3f3 (patch)
treee45374931920205d703840d4bf1a00c9b1514e78 /tests/check/elements
parentb414b128c696019f3fe019b8cc798bf762c9f3bb (diff)
downloadgst-plugins-bad-e38e701293f998e0268d8c13d967266cf699a3f3.tar.gz
gst-plugins-bad-e38e701293f998e0268d8c13d967266cf699a3f3.tar.bz2
gst-plugins-bad-e38e701293f998e0268d8c13d967266cf699a3f3.zip
gst/filter/gstlpwsinc.*: Implement latency query and only forward those samples downstream that actually contain the ...
Original commit message from CVS: * gst/filter/gstlpwsinc.c: (gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32), (process_64), (lpwsinc_build_kernel), (lpwsinc_push_residue), (lpwsinc_transform), (lpwsinc_start), (lpwsinc_query), (lpwsinc_query_type), (lpwsinc_event), (lpwsinc_set_property): * gst/filter/gstlpwsinc.h: Implement latency query and only forward those samples downstream that actually contain the data we want, i.e. drop kernel_length/2 in the beginning and append kernel_length/2 (created by convolving the filter kernel with zeroes) to the end. * tests/check/elements/lpwsinc.c: (GST_START_TEST): Adjust the unit test for this slightly changed behaviour.
Diffstat (limited to 'tests/check/elements')
-rw-r--r--tests/check/elements/lpwsinc.c110
1 files changed, 62 insertions, 48 deletions
diff --git a/tests/check/elements/lpwsinc.c b/tests/check/elements/lpwsinc.c
index 8fe7b02c..3d69bc95 100644
--- a/tests/check/elements/lpwsinc.c
+++ b/tests/check/elements/lpwsinc.c
@@ -96,6 +96,7 @@ GST_START_TEST (test_lp_0hz)
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
+ GList *node;
lpwsinc = setup_lpwsinc ();
/* Set to lowpass */
@@ -120,21 +121,23 @@ GST_START_TEST (test_lp_0hz)
/* pushing gives away my reference ... */
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
+ fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()));
/* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
+ fail_unless (g_list_length (buffers) >= 1);
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
- for (i = 21; i < 128; i++) {
- fail_unless (res[i] <= 1.01
- && res[i] >= 0.99, "res[%d] = %lf\n", i, res[i]);
- }
+ for (node = buffers; node; node = node->next) {
+ gint buffer_length;
- rms = 0.0;
- for (i = 0; i < 128; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 128.0);
- fail_unless (rms >= 0.9);
+ fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
+
+ res = (gdouble *) GST_BUFFER_DATA (outbuffer);
+ buffer_length = GST_BUFFER_SIZE (outbuffer) / sizeof (gdouble);
+ rms = 0.0;
+ for (i = 0; i < buffer_length; i++)
+ rms += res[i] * res[i];
+ rms = sqrt (rms / buffer_length);
+ fail_unless (rms >= 0.9);
+ }
/* cleanup */
cleanup_lpwsinc (lpwsinc);
@@ -152,6 +155,7 @@ GST_START_TEST (test_lp_22050hz)
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
+ GList *node;
lpwsinc = setup_lpwsinc ();
/* Set to lowpass */
@@ -177,21 +181,23 @@ GST_START_TEST (test_lp_22050hz)
/* pushing gives away my reference ... */
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
+ fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()));
/* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
+ fail_unless (g_list_length (buffers) >= 1);
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
- for (i = 21; i < 128; i++) {
- fail_unless (res[i] <= 0.01
- && res[i] >= -0.01, "res[%d] = %lf\n", i, res[i]);
- }
+ for (node = buffers; node; node = node->next) {
+ gint buffer_length;
- rms = 0.0;
- for (i = 0; i < 128; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 128.0);
- fail_unless (rms <= 0.05);
+ fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
+
+ res = (gdouble *) GST_BUFFER_DATA (outbuffer);
+ buffer_length = GST_BUFFER_SIZE (outbuffer) / sizeof (gdouble);
+ 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);
+ }
/* cleanup */
cleanup_lpwsinc (lpwsinc);
@@ -209,6 +215,7 @@ GST_START_TEST (test_hp_0hz)
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
+ GList *node;
lpwsinc = setup_lpwsinc ();
/* Set to highpass */
@@ -232,21 +239,23 @@ GST_START_TEST (test_hp_0hz)
/* pushing gives away my reference ... */
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
+ fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()));
/* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
+ fail_unless (g_list_length (buffers) >= 1);
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
- for (i = 21; i < 128; i++) {
- fail_unless (res[i] <= 0.01
- && res[i] >= -0.01, "res[%d] = %lf\n", i, res[i]);
- }
+ for (node = buffers; node; node = node->next) {
+ gint buffer_length;
- rms = 0.0;
- for (i = 0; i < 128; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 128.0);
- fail_unless (rms <= 0.05);
+ fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
+
+ res = (gdouble *) GST_BUFFER_DATA (outbuffer);
+ buffer_length = GST_BUFFER_SIZE (outbuffer) / sizeof (gdouble);
+ 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);
+ }
/* cleanup */
cleanup_lpwsinc (lpwsinc);
@@ -264,6 +273,7 @@ GST_START_TEST (test_hp_22050hz)
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
+ GList *node;
lpwsinc = setup_lpwsinc ();
/* Set to highpass */
@@ -289,21 +299,24 @@ GST_START_TEST (test_hp_22050hz)
/* pushing gives away my reference ... */
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
+ fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()));
/* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
+ fail_unless (g_list_length (buffers) >= 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
- for (i = 21; i < 128; i++) {
- fail_unless (abs (res[i]) <= 1.01
- && abs (res[i]) >= 0.99, "res[%d] = %lf\n", i, res[i]);
- }
+ for (node = buffers; node; node = node->next) {
+ gint buffer_length;
- rms = 0.0;
- for (i = 0; i < 128; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 128.0);
- fail_unless (rms >= 0.9);
+ fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
+
+ res = (gdouble *) GST_BUFFER_DATA (outbuffer);
+ buffer_length = GST_BUFFER_SIZE (outbuffer) / sizeof (gdouble);
+ rms = 0.0;
+ for (i = 0; i < buffer_length; i++)
+ rms += res[i] * res[i];
+ rms = sqrt (rms / buffer_length);
+ fail_unless (rms >= 0.9);
+ }
/* cleanup */
cleanup_lpwsinc (lpwsinc);
@@ -344,8 +357,9 @@ GST_START_TEST (test_small_buffer)
/* pushing gives away my reference ... */
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
+ fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()));
/* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
+ fail_unless (g_list_length (buffers) >= 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
/* cleanup */