diff --git a/ext/webrtc/gstwebrtcbin.c b/ext/webrtc/gstwebrtcbin.c index 5d00dfdf01..41e915d798 100644 --- a/ext/webrtc/gstwebrtcbin.c +++ b/ext/webrtc/gstwebrtcbin.c @@ -1259,8 +1259,11 @@ _find_codec_preferences (GstWebRTCBin * webrtc, GstWebRTCRTPTransceiver * trans, } 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 {