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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2348>
This commit is contained in:
Olivier Crête 2021-06-21 16:50:46 -04:00 committed by GStreamer Marge Bot
parent 85c17f6c23
commit 71052f0321

View file

@ -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);