test: add test for playbin in combination with appsink

Make sure appsink works multiple times in a row.
Disable it though for now though.

https://bugzilla.gnome.org/show_bug.cgi?id=644989
This commit is contained in:
Tim-Philipp Müller 2012-11-29 13:42:45 +00:00
parent 8edd1443a8
commit 64c4fa2ca0

View file

@ -766,6 +766,70 @@ gst_codec_src_init (GstCodecSrc * src)
{
}
#if 0
GST_START_TEST (test_appsink_twice)
{
GstElement *playbin, *appsink;
GstSample *sample;
gchar *fn, *uri;
int flags;
fn = g_build_filename (GST_TEST_FILES_PATH, "theora-vorbis.ogg", NULL);
uri = gst_filename_to_uri (fn, NULL);
g_free (fn);
playbin = gst_element_factory_make ("playbin", NULL);
g_object_set (playbin, "uri", uri, NULL);
g_free (uri);
/* disable video decoding/rendering (doesn't actually work yet though) */
g_object_get (playbin, "flags", &flags, NULL);
g_object_set (playbin, "flags", flags & ~1, NULL);
appsink = gst_element_factory_make ("appsink", "appsink");
g_object_set (playbin, "audio-sink", appsink, NULL);
fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PLAYING),
GST_STATE_CHANGE_ASYNC);
fail_unless_equals_int (gst_element_get_state (playbin, NULL, NULL,
GST_CLOCK_TIME_NONE), GST_STATE_CHANGE_SUCCESS);
do {
g_signal_emit_by_name (appsink, "pull-sample", &sample);
GST_LOG ("got sample: %p", sample);
if (sample)
gst_sample_unref (sample);
}
while (sample != NULL);
GST_INFO ("got first EOS");
fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_NULL),
GST_STATE_CHANGE_SUCCESS);
fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PLAYING),
GST_STATE_CHANGE_ASYNC);
fail_unless_equals_int (gst_element_get_state (playbin, NULL, NULL,
GST_CLOCK_TIME_NONE), GST_STATE_CHANGE_SUCCESS);
do {
g_signal_emit_by_name (appsink, "pull-sample", &sample);
GST_LOG ("got sample: %p", sample);
if (sample)
gst_sample_unref (sample);
}
while (sample != NULL);
GST_INFO ("got second EOS");
fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_NULL),
GST_STATE_CHANGE_SUCCESS);
gst_object_unref (playbin);
}
GST_END_TEST;
#endif
#endif /* GST_DISABLE_REGISTRY */
@ -789,6 +853,18 @@ playbin_suite (void)
tcase_add_test (tc_chain, test_refcount);
tcase_add_test (tc_chain, test_source_setup);
#if 0
{
GstRegistry *reg = gst_registry_get ();
if (gst_registry_check_feature_version (reg, "oggdemux", 1, 0, 0) &&
gst_registry_check_feature_version (reg, "theoradec", 1, 0, 0) &&
gst_registry_check_feature_version (reg, "vorbisdec", 1, 0, 0)) {
tcase_add_test (tc_chain, test_appsink_twice);
}
}
#endif
/* one day we might also want to have the following checks:
* tcase_add_test (tc_chain, test_missing_secondary_decoder_one_fatal);
* tcase_add_test (tc_chain, test_missing_secondary_decoder_two_fatal);