From b18ad8b54c2a208b099f8841761406a7c1a7c5c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 12 Jun 2019 15:57:48 +0300 Subject: [PATCH] rtpgstpay: Send caps anyway if caps are pending in the adapter but are different from the new ones Otherwise it can happen that we receive a caps event, then another caps event and only then buffers. We would then send out the first caps event in the stream but mark buffers with the caps version of the second caps event. --- gst/rtp/gstrtpgstpay.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gst/rtp/gstrtpgstpay.c b/gst/rtp/gstrtpgstpay.c index c1aa439eb6..b8c39324a7 100644 --- a/gst/rtp/gstrtpgstpay.c +++ b/gst/rtp/gstrtpgstpay.c @@ -421,8 +421,17 @@ gst_rtp_gst_pay_send_caps (GstRtpGSTPay * rtpgstpay, guint8 cv, GstCaps * caps) guint capslen; GstBuffer *outbuf; - if (rtpgstpay->flags & (1 << 7)) + if (rtpgstpay->flags == ((1 << 7) | (cv << 4))) { + /* If caps for the current CV are pending in the adapter already, do + * nothing at all here + */ return; + } else if (rtpgstpay->flags & (1 << 7)) { + /* Create a new standalone caps packet if caps were already pending. + * The next caps are going to be merged with the following buffer or + * sent standalone if another event is sent first */ + gst_rtp_gst_pay_create_from_adapter (rtpgstpay, GST_CLOCK_TIME_NONE); + } capsstr = gst_caps_to_string (caps); capslen = strlen (capsstr);