find_codec_preferences: use received caps

When negotiation is triggered by receiving caps on our sink pad
probes, we could encounter a race condition where need-negotiation
is emitted and the application requires the creation of an offer
before the current caps were actually updated.

This led to retrieving incomplete caps when creating the offer,
using find_codec_preferences -> pad_get_current_caps.

Instead, as we save the caps in the probe callback anyway, it is better
and thread safe to use these if they were set.

https://bugzilla.gnome.org/show_bug.cgi?id=796801
diff --git a/ext/webrtc/gstwebrtcbin.c b/ext/webrtc/gstwebrtcbin.c
index cd31456..b3746bf 100644
--- a/ext/webrtc/gstwebrtcbin.c
+++ b/ext/webrtc/gstwebrtcbin.c
@@ -1258,8 +1258,11 @@
   } else {
     GstWebRTCBinPad *pad = _find_pad_for_mline (webrtc, direction, media_idx);
     if (pad) {
-      GstCaps *caps = gst_pad_get_current_caps (GST_PAD (pad));
-      if (caps) {
+      GstCaps *caps = NULL;
+
+      if (pad->received_caps) {
+        caps = gst_caps_ref (pad->received_caps);
+      } else if ((caps = gst_pad_get_current_caps (GST_PAD (pad)))) {
         GST_LOG_OBJECT (webrtc, "Using current pad caps: %" GST_PTR_FORMAT,
             caps);
       } else {