From 71052f032109b0d64e84ac2d75913090e57a39d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= Date: Mon, 21 Jun 2021 16:50:46 -0400 Subject: [PATCH] webrtcbin test: Fix race in new test Pull a buffer from a sink to make sure that the caps are already set before trying to update them. Part-of: --- tests/check/elements/webrtcbin.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/check/elements/webrtcbin.c b/tests/check/elements/webrtcbin.c index 405886ee3f..a1253f07a1 100644 --- a/tests/check/elements/webrtcbin.c +++ b/tests/check/elements/webrtcbin.c @@ -4074,6 +4074,7 @@ GST_START_TEST (test_codec_preferences_negotiation_srcpad) GstHarness *sink_harness = NULL; guint i; GstElement *rtpbin2; + GstBuffer *buf; t->on_negotiation_needed = NULL; t->on_ice_candidate = NULL; @@ -4108,6 +4109,13 @@ GST_START_TEST (test_codec_preferences_negotiation_srcpad) g_mutex_unlock (&t->lock); fail_unless (sink_harness->element == t->webrtc2); + /* Get one buffer out, this makes sure the capsfilter is primed and + * avoids races. + */ + buf = gst_harness_pull (sink_harness); + fail_unless (buf != NULL); + gst_buffer_unref (buf); + gst_harness_set_sink_caps_str (sink_harness, OPUS_RTP_CAPS (100)); test_webrtc_reset_negotiation (t);