tests: fix buffer leaks in opus tests

This commit is contained in:
Vincent Penquerc'h 2012-01-11 13:32:36 +00:00
parent d6b60c62e6
commit 3cb98f2674

View file

@ -110,7 +110,7 @@ cleanup_opusenc (GstElement * opusenc)
} }
static void static void
check_buffers (guint expected, gboolean headers_in_caps) check_buffers (guint expected)
{ {
GstBuffer *outbuffer; GstBuffer *outbuffer;
guint i, num_buffers; guint i, num_buffers;
@ -152,7 +152,7 @@ GST_START_TEST (test_opus_id_header)
/* ... and nothing ends up on the global buffer list */ /* ... and nothing ends up on the global buffer list */
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
gst_buffer_unref (inbuffer); gst_buffer_unref (inbuffer);
fail_unless (g_list_length (buffers) == 0); check_buffers (0);
/* cleanup */ /* cleanup */
cleanup_opusdec (opusdec); cleanup_opusdec (opusdec);
@ -248,7 +248,7 @@ GST_START_TEST (test_opus_encode_samples)
"could not set to ready"); "could not set to ready");
/* default frame size is 20 ms, at 48000 Hz that's 960 samples */ /* default frame size is 20 ms, at 48000 Hz that's 960 samples */
check_buffers ((nsamples + 959) / 960, FALSE); check_buffers ((nsamples + 959) / 960);
/* cleanup */ /* cleanup */
cleanup_opusenc (opusenc); cleanup_opusenc (opusenc);
@ -331,6 +331,8 @@ GST_START_TEST (test_opus_encode_properties)
/* change random parameters */ /* change random parameters */
g_object_set (opusenc, param_changes[step].param, param_changes[step].value, g_object_set (opusenc, param_changes[step].param, param_changes[step].value,
NULL); NULL);
check_buffers (1);
} }
gst_caps_unref (caps); gst_caps_unref (caps);