test: rtpbin_buffer_list: check if the chain_list function has been called
authorAntonio Ospite <antonio.ospite@collabora.com>
Mon, 4 Mar 2019 10:27:33 +0000 (11:27 +0100)
committerOlivier CrĂȘte <olivier.crete@ocrete.ca>
Mon, 1 Apr 2019 18:42:32 +0000 (18:42 +0000)
Make the test more useful to verify that the chain list function has
actually been called.

tests/check/elements/rtpbin_buffer_list.c

index e71122d..3cfd33b 100644 (file)
@@ -223,12 +223,23 @@ check_packet (GstBufferList * list, guint index)
   check_payload (buffer, index);
 }
 
+/*
+ * Used to verify that the chain_list function is actually implemented by the
+ * element and called when executing the pipeline. This is needed because pads
+ * always have a default chain_list handler which handle buffers in a buffer
+ * list individually, and pushing a list to a pad can succeed even if no
+ * chain_list handler has been set.
+ */
+static gboolean chain_list_func_called;
+
 static GstFlowReturn
 sink_chain_list (GstPad * pad, GstObject * parent, GstBufferList * list)
 {
   GstCaps *current_caps;
   GstCaps *caps;
 
+  chain_list_func_called = TRUE;
+
   current_caps = gst_pad_get_current_caps (pad);
   fail_unless (current_caps != NULL);
 
@@ -291,7 +302,10 @@ GST_START_TEST (test_bufferlist)
   gst_caps_unref (caps);
 
   gst_element_set_state (rtpbin, GST_STATE_PLAYING);
+
+  chain_list_func_called = FALSE;
   fail_unless (gst_pad_push_list (srcpad, list) == GST_FLOW_OK);
+  fail_if (chain_list_func_called == FALSE);
 
   gst_pad_set_active (sinkpad, FALSE);
   gst_pad_set_active (srcpad, FALSE);