rtpgstpay: Send caps anyway if caps are pending in the adapter but are different...
authorSebastian Dröge <sebastian@centricular.com>
Wed, 12 Jun 2019 12:57:48 +0000 (15:57 +0300)
committerSebastian Dröge <slomo@coaxion.net>
Tue, 18 Jun 2019 08:35:12 +0000 (08:35 +0000)
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

index c1aa439..b8c3932 100644 (file)
@@ -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);