From b30a14ecab6594d9692d3a67322c031a5d083f99 Mon Sep 17 00:00:00 2001 From: Andrew Voznytsa Date: Fri, 21 Feb 2020 21:18:15 +0200 Subject: [PATCH] Fix automatic RTP jitter buffer insertion (TCP/MPEG2 TS did not work properly) --- src/VideoStreaming/VideoReceiver.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/VideoStreaming/VideoReceiver.cc b/src/VideoStreaming/VideoReceiver.cc index 77de0267e..b83f36797 100644 --- a/src/VideoStreaming/VideoReceiver.cc +++ b/src/VideoStreaming/VideoReceiver.cc @@ -218,11 +218,12 @@ _linkPadWithOptionalBuffer(GstElement* element, GstPad* pad, gpointer data) GstCaps* filter = gst_caps_from_string("application/x-rtp"); if (filter != nullptr) { - GstCaps* caps; + GstCaps* caps = gst_pad_query_caps(pad, nullptr); - if ((caps = gst_pad_query_caps(pad, filter)) && !gst_caps_is_empty(caps)) { - qDebug() << gst_caps_to_string(caps); - isRtpPad = TRUE; + if (caps != nullptr) { + if (!gst_caps_is_any(caps) && gst_caps_can_intersect(caps, filter)) { + isRtpPad = TRUE; + } gst_caps_unref(caps); caps = nullptr; @@ -275,10 +276,12 @@ _padProbe(GstElement* element, GstPad* pad, gpointer user_data) GstCaps* filter = gst_caps_from_string("application/x-rtp"); if (filter != nullptr) { - GstCaps* caps; + GstCaps* caps = gst_pad_query_caps(pad, nullptr); - if ((caps = gst_pad_query_caps(pad, filter)) && !gst_caps_is_empty(caps)) { - *probeRes |= 2; + if (caps != nullptr) { + if (!gst_caps_is_any(caps) && gst_caps_can_intersect(caps, filter)) { + *probeRes |= 2; + } gst_caps_unref(caps); caps = nullptr; -- 2.22.0