mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
webrtcbin: Ensure that query caps method returns valid caps
This means rejecting any caps that aren't fixed. Also, use a filter that will create unfixed caps if the other side just returns ANY. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2104>
This commit is contained in:
parent
09c65fe534
commit
c7107fd940
1 changed files with 25 additions and 3 deletions
|
@ -1511,9 +1511,28 @@ _find_codec_preferences (GstWebRTCBin * webrtc,
|
||||||
GST_LOG_OBJECT (webrtc, "Using current pad caps: %" GST_PTR_FORMAT,
|
GST_LOG_OBJECT (webrtc, "Using current pad caps: %" GST_PTR_FORMAT,
|
||||||
caps);
|
caps);
|
||||||
} else {
|
} else {
|
||||||
if ((caps = gst_pad_peer_query_caps (GST_PAD (pad), NULL)))
|
static GstStaticCaps static_filter =
|
||||||
|
GST_STATIC_CAPS ("application/x-rtp, "
|
||||||
|
"media = (string) { audio, video }, payload = (int) [ 0, 127 ]");
|
||||||
|
GstCaps *filter = gst_static_caps_get (&static_filter);
|
||||||
|
|
||||||
|
filter = gst_caps_make_writable (filter);
|
||||||
|
|
||||||
|
if (rtp_trans->kind == GST_WEBRTC_KIND_AUDIO)
|
||||||
|
gst_caps_set_simple (filter, "media", G_TYPE_STRING, "audio", NULL);
|
||||||
|
else if (rtp_trans->kind == GST_WEBRTC_KIND_VIDEO)
|
||||||
|
gst_caps_set_simple (filter, "media", G_TYPE_STRING, "video", NULL);
|
||||||
|
|
||||||
|
caps = gst_pad_peer_query_caps (GST_PAD (pad), filter);
|
||||||
GST_LOG_OBJECT (webrtc, "Using peer query caps: %" GST_PTR_FORMAT,
|
GST_LOG_OBJECT (webrtc, "Using peer query caps: %" GST_PTR_FORMAT,
|
||||||
caps);
|
caps);
|
||||||
|
|
||||||
|
if (!gst_caps_is_fixed (caps) || gst_caps_is_equal_fixed (caps, filter)
|
||||||
|
|| gst_caps_is_empty (caps) || gst_caps_is_any (caps)) {
|
||||||
|
gst_caps_unref (caps);
|
||||||
|
caps = NULL;
|
||||||
|
}
|
||||||
|
gst_caps_unref (filter);
|
||||||
}
|
}
|
||||||
if (caps) {
|
if (caps) {
|
||||||
if (trans)
|
if (trans)
|
||||||
|
@ -1539,6 +1558,9 @@ _add_supported_attributes_to_caps (GstWebRTCBin * webrtc,
|
||||||
GstCaps *ret;
|
GstCaps *ret;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
|
if (caps == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
ret = gst_caps_make_writable (caps);
|
ret = gst_caps_make_writable (caps);
|
||||||
|
|
||||||
for (i = 0; i < gst_caps_get_size (ret); i++) {
|
for (i = 0; i < gst_caps_get_size (ret); i++) {
|
||||||
|
|
Loading…
Reference in a new issue