tests/check/pipelines/theoraenc.c (test_discontinuity): Similar test to the one in vorbisenc. Also commented out.

Original commit message from CVS:
2006-07-21  Andy Wingo  <wingo@pobox.com>

* tests/check/pipelines/theoraenc.c (test_discontinuity): Similar
test to the one in vorbisenc. Also commented out.
This commit is contained in:
Andy Wingo 2006-07-21 17:04:06 +00:00
parent e75fc2062c
commit 810ac2d7ef
2 changed files with 111 additions and 0 deletions

View file

@ -1,5 +1,8 @@
2006-07-21 Andy Wingo <wingo@pobox.com>
* tests/check/pipelines/theoraenc.c (test_discontinuity): Similar
test to the one in vorbisenc. Also commented out.
* tests/check/pipelines/vorbisenc.c:
(test_discontinuity): New test, commented out until Mike lands
some elite vorbisenc patches.

View file

@ -289,6 +289,111 @@ GST_START_TEST (test_continuity)
GST_END_TEST;
#if 0
static gboolean
drop_second_data_buffer (GstPad * droppad, GstBuffer * buffer, gpointer unused)
{
return !(GST_BUFFER_OFFSET (buffer) == 1);
}
GST_START_TEST (test_discontinuity)
{
GstElement *bin;
GstPad *pad, *droppad;
gchar *pipe_str;
GstBuffer *buffer;
GError *error = NULL;
GstClockTime timestamp;
guint drop_id;
pipe_str = g_strdup_printf ("videotestsrc"
" ! video/x-raw-yuv,format=(fourcc)I420,framerate=10/1"
" ! theoraenc ! fakesink name=fs0");
bin = gst_parse_launch (pipe_str, &error);
fail_unless (bin != NULL, "Error parsing pipeline: %s",
error ? error->message : "(invalid error)");
g_free (pipe_str);
/* the plan: same as test_continuity, but dropping a buffer and seeing if
theoraenc correctly notes the discontinuity */
/* get the pad to use to drop buffers */
{
GstElement *sink = gst_bin_get_by_name (GST_BIN (bin), "theoraenc0");
fail_unless (sink != NULL, "Could not get theoraenc out of bin");
droppad = gst_element_get_pad (sink, "sink");
fail_unless (droppad != NULL, "Could not get pad out of theoraenc");
gst_object_unref (sink);
}
/* get the pad */
{
GstElement *sink = gst_bin_get_by_name (GST_BIN (bin), "fs0");
fail_unless (sink != NULL, "Could not get fakesink out of bin");
pad = gst_element_get_pad (sink, "sink");
fail_unless (pad != NULL, "Could not get pad out of fakesink");
gst_object_unref (sink);
}
drop_id = gst_pad_add_buffer_probe (droppad, drop_second_data_buffer, NULL);
gst_buffer_straw_start_pipeline (bin, pad);
/* header packets should have timestamp == NONE, granulepos 0 */
buffer = gst_buffer_straw_get_buffer (bin, pad);
check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
check_buffer_granulepos (buffer, 0);
check_buffer_is_header (buffer, TRUE);
gst_buffer_unref (buffer);
buffer = gst_buffer_straw_get_buffer (bin, pad);
check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
check_buffer_granulepos (buffer, 0);
check_buffer_is_header (buffer, TRUE);
gst_buffer_unref (buffer);
buffer = gst_buffer_straw_get_buffer (bin, pad);
check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
check_buffer_granulepos (buffer, 0);
check_buffer_is_header (buffer, TRUE);
gst_buffer_unref (buffer);
{
buffer = gst_buffer_straw_get_buffer (bin, pad);
check_buffer_timestamp (buffer, 0);
/* plain division because I know the answer is exact */
check_buffer_duration (buffer, GST_SECOND / 10);
check_buffer_granulepos (buffer, 0);
check_buffer_is_header (buffer, FALSE);
fail_if (GST_BUFFER_IS_DISCONT (buffer), "expected continuous buffer yo");
gst_buffer_unref (buffer);
/* check discontinuity with the next buffer */
buffer = gst_buffer_straw_get_buffer (bin, pad);
check_buffer_duration (buffer, GST_SECOND / 10);
check_buffer_granulepos (buffer, 2);
check_buffer_is_header (buffer, FALSE);
fail_unless (GST_BUFFER_IS_DISCONT (buffer),
"expected discontinuous buffer yo");
gst_buffer_unref (buffer);
}
gst_buffer_straw_stop_pipeline (bin, pad);
gst_pad_remove_buffer_probe (droppad, drop_id);
gst_object_unref (droppad);
gst_object_unref (pad);
gst_object_unref (bin);
}
GST_END_TEST;
#endif /* 0 */
#endif /* #ifndef GST_DISABLE_PARSE */
Suite *
@ -302,6 +407,9 @@ theoraenc_suite (void)
#ifndef GST_DISABLE_PARSE
tcase_add_test (tc_chain, test_granulepos_offset);
tcase_add_test (tc_chain, test_continuity);
#if 0
tcase_add_test (tc_chain, test_discontinuity);
#endif /* 0 */
#endif
return s;