diff options
author | Wim Taymans <wtaymans@redhat.com> | 2014-05-09 15:08:48 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2014-05-09 15:13:54 +0200 |
commit | b8165dbd6035e4bf4924e68d91b799713689411f (patch) | |
tree | 1e50823d492e66f97ec79bb666585e50e0f4f7ff | |
parent | aec1b42c4e59ad548a3d39b561c775fc19eaa776 (diff) |
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.
-rw-r--r-- | tests/check/gst/media.c | 13 |
1 files 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; + } } } |