From: Tim-Philipp Müller Date: Thu, 29 Nov 2012 13:42:45 +0000 (+0000) Subject: test: add test for playbin in combination with appsink X-Git-Tag: 1.19.3~511^2~5702 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=64c4fa2ca0a5690a19da4b658f33e316d71f225d;p=platform%2Fupstream%2Fgstreamer.git 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 --- diff --git a/tests/check/elements/playbin.c b/tests/check/elements/playbin.c index 950d56c..8f4f624 100644 --- a/tests/check/elements/playbin.c +++ b/tests/check/elements/playbin.c @@ -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);