tests/netsim: Set src caps before creating buffers
authorDoug Nazar <nazard@nazar.ca>
Wed, 21 Apr 2021 03:51:49 +0000 (23:51 -0400)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Wed, 21 Apr 2021 09:05:44 +0000 (09:05 +0000)
GstHarness requires the source pad caps to be set before
buffer allocations.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2179>

tests/check/elements/netsim.c

index 1de026c..02789e1 100644 (file)
@@ -29,10 +29,12 @@ GST_START_TEST (netsim_stress_delayed)
 {
   GstHarness *h = gst_harness_new_parse ("netsim delay-probability=0.5");
   GstCaps *caps = gst_caps_from_string ("mycaps");
-  GstBuffer *buf = gst_harness_create_buffer (h, 100);
+  GstBuffer *buf;
   GstHarnessThread *state, *push;
   GstSegment segment;
 
+  gst_harness_set_src_caps (h, gst_caps_ref (caps));
+  buf = gst_harness_create_buffer (h, 100);
   gst_segment_init (&segment, GST_FORMAT_TIME);
   state = gst_harness_stress_statechange_start (h);
   push = gst_harness_stress_push_buffer_start (h, caps, &segment, buf);