tests: Avoid hang with decodebin test

When adding elements dynamically to a pipeline one should never guess what the
curren/target state is, and instead use `gst_element_sync_state_with_parent()`.

Fixes racy hang when running within valgrind

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/692>
This commit is contained in:
Edward Hervey 2020-06-08 08:11:00 +02:00 committed by Edward Hervey
parent 9c3cff287e
commit 78444fc622

View file

@ -127,12 +127,11 @@ pad_added_plug_fakesink_cb (GstElement * decodebin, GstPad * srcpad,
fail_unless (sink != NULL, "Failed to create fakesink element");
gst_bin_add (GST_BIN (pipeline), sink);
gst_element_sync_state_with_parent (sink);
sinkpad = gst_element_get_static_pad (sink, "sink");
fail_unless_equals_int (gst_pad_link (srcpad, sinkpad), GST_PAD_LINK_OK);
gst_object_unref (sinkpad);
gst_element_set_state (sink, GST_STATE_PLAYING);
}
GST_START_TEST (test_reuse_without_decoders)