From b79d6b1c09a00db3833ca568bb46ade1b96dff71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Mon, 18 Nov 2013 16:03:07 +0000 Subject: [PATCH] tests: fix appsrc test with latest GLib version With the latest GLib, g_source_remove() complains about not finding the timeout source with the given ID here, since it was already destroyed by returning FALSE from the timeout callback. Also return FALSE from the bus watches when we don't want to be called any more. --- tests/check/elements/appsrc.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/check/elements/appsrc.c b/tests/check/elements/appsrc.c index 541f481a29..c31ed4cc58 100644 --- a/tests/check/elements/appsrc.c +++ b/tests/check/elements/appsrc.c @@ -143,6 +143,7 @@ static gboolean on_source_message (GstBus * bus, GstMessage * message, ProgramData * data) { GstElement *source; + gboolean ret = TRUE; switch (GST_MESSAGE_TYPE (message)) { case GST_MESSAGE_EOS: @@ -152,29 +153,34 @@ on_source_message (GstBus * bus, GstMessage * message, ProgramData * data) break; case GST_MESSAGE_ERROR: g_main_loop_quit (data->loop); + ret = FALSE; break; default: break; } - return TRUE; + return ret; } static gboolean on_sink_message (GstBus * bus, GstMessage * message, ProgramData * data) { + gboolean ret = TRUE; + switch (GST_MESSAGE_TYPE (message)) { case GST_MESSAGE_EOS: g_main_loop_quit (data->loop); + ret = FALSE; break; case GST_MESSAGE_ERROR: ASSERT_SET_STATE (data->sink, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS); ASSERT_SET_STATE (data->source, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS); g_main_loop_quit (data->loop); + ret = FALSE; break; default: break; } - return TRUE; + return ret; } static gboolean @@ -208,8 +214,6 @@ GST_START_TEST (test_appsrc_block_deadlock) GstBus *bus = NULL; GstElement *testsink = NULL; - gint tout; - data = g_new0 (ProgramData, 1); data->loop = g_main_loop_new (NULL, FALSE); @@ -242,7 +246,7 @@ GST_START_TEST (test_appsrc_block_deadlock) gst_bus_add_watch (bus, (GstBusFunc) on_sink_message, data); gst_object_unref (bus); - tout = g_timeout_add (150, (GSourceFunc) error_timeout, data); + g_timeout_add (150, (GSourceFunc) error_timeout, data); ASSERT_SET_STATE (data->sink, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC); ASSERT_SET_STATE (data->source, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC); @@ -252,7 +256,6 @@ GST_START_TEST (test_appsrc_block_deadlock) ASSERT_SET_STATE (data->sink, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS); ASSERT_SET_STATE (data->source, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS); - g_source_remove (tout); gst_object_unref (data->source); gst_object_unref (data->sink); g_main_loop_unref (data->loop);