From b8165dbd6035e4bf4924e68d91b799713689411f Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 9 May 2014 15:08:48 +0200 Subject: [PATCH] tests: add and remove pads only once In this test we simulate a dynamic pad by watching the caps event. Because of renegotiation in the base payloader now, this caps is sent multiple times but we can only deal with 1 invocation, use a variable to only 'add and remove' the pad once. --- tests/check/gst/media.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/check/gst/media.c b/tests/check/gst/media.c index f2a58ce..c7d680e 100644 --- a/tests/check/gst/media.c +++ b/tests/check/gst/media.c @@ -214,17 +214,24 @@ static void on_notify_caps (GstPad * pad, GParamSpec * pspec, GstElement * pay) { GstCaps *caps; + static gboolean have_caps = FALSE; g_object_get (pad, "caps", &caps, NULL); GST_DEBUG ("notify %" GST_PTR_FORMAT, caps); if (caps) { - g_signal_emit_by_name (pay, "pad-added", pad); - g_signal_emit_by_name (pay, "no-more-pads", NULL); + if (!have_caps) { + g_signal_emit_by_name (pay, "pad-added", pad); + g_signal_emit_by_name (pay, "no-more-pads", NULL); + have_caps = TRUE; + } gst_caps_unref (caps); } else { - g_signal_emit_by_name (pay, "pad-removed", pad); + if (have_caps) { + g_signal_emit_by_name (pay, "pad-removed", pad); + have_caps = FALSE; + } } } -- 2.7.4