[gst-cvs] gst-plugins-good: flvmux: Fix unit test to correctly handle request pads

Sebastian Dröge slomo at kemper.freedesktop.org
Mon Aug 3 11:09:35 PDT 2009


Module: gst-plugins-good
Branch: master
Commit: a931c6759771a3942239c19cadeee3726508595d
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=a931c6759771a3942239c19cadeee3726508595d

Author: Sebastian Dröge <sebastian.droege at collabora.co.uk>
Date:   Mon Aug  3 20:08:33 2009 +0200

flvmux: Fix unit test to correctly handle request pads

Request pads are removed by the element instance in PAUSED->READY
so we need to re-request pads for every run and link them again.

Last fix for bug #590447.

---

 tests/check/elements/flvmux.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/tests/check/elements/flvmux.c b/tests/check/elements/flvmux.c
index 5881071..38bb6c1 100644
--- a/tests/check/elements/flvmux.c
+++ b/tests/check/elements/flvmux.c
@@ -50,7 +50,6 @@ static void
 mux_pcm_audio (guint num_buffers, guint repeat)
 {
   GstElement *src, *sink, *flvmux, *pipeline;
-  GstPad *sinkpad, *srcpad;
   gint counter;
 
   GST_LOG ("num_buffers = %u", num_buffers);
@@ -78,22 +77,27 @@ mux_pcm_audio (guint num_buffers, guint repeat)
 
   gst_bin_add_many (GST_BIN (pipeline), src, flvmux, sink, NULL);
 
-  /* now link the elements */
-  sinkpad = gst_element_get_request_pad (flvmux, "audio");
-  fail_unless (sinkpad != NULL, "Could not get audio request pad");
-
-  srcpad = gst_element_get_static_pad (src, "src");
-  fail_unless (srcpad != NULL, "Could not get audiotestsrc's source pad");
-
-  fail_unless_equals_int (gst_pad_link (srcpad, sinkpad), GST_PAD_LINK_OK);
   fail_unless (gst_element_link (flvmux, sink));
 
   do {
     GstStateChangeReturn state_ret;
     GstMessage *msg;
+    GstPad *sinkpad, *srcpad;
 
     GST_LOG ("repeat=%d", repeat);
 
+    /* now link the elements */
+    sinkpad = gst_element_get_request_pad (flvmux, "audio");
+    fail_unless (sinkpad != NULL, "Could not get audio request pad");
+
+    srcpad = gst_element_get_static_pad (src, "src");
+    fail_unless (srcpad != NULL, "Could not get audiotestsrc's source pad");
+
+    fail_unless_equals_int (gst_pad_link (srcpad, sinkpad), GST_PAD_LINK_OK);
+
+    gst_object_unref (srcpad);
+    gst_object_unref (sinkpad);
+
     counter = 0;
 
     state_ret = gst_element_set_state (pipeline, GST_STATE_PAUSED);





More information about the Gstreamer-commits mailing list