From 61c1385c42301b116e444948d6118a10a2c584e5 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Mon, 8 Apr 2019 11:35:34 +0200 Subject: [PATCH] rtpvrawpay: preserve GST_BUFFER_FLAG_DISCONT on the first outputted buffer If the incoming frame buffer has GST_BUFFER_FLAG_DISCONT set this should be preserved and set for the first output buffer too, like other payloaders do. Spotted with gst-validate-1.0 when adding integration tests for rtpsession, a minimal test to reproduce the issue is: $ gst-validate-1.0 videotestsrc num-buffers=1 ! rtpvrawpay ! identity ! fakesink Starting pipeline Pipeline started warning : Buffer didn't have expected DISCONT flag333 speed: 1.000000 /> Detected on Detected on Detected on Description : Buffers after SEGMENT and FLUSH must have a DISCONT flag Issues found: 1 =======> Test PASSED (Return value: 0) --- gst/rtp/gstrtpvrawpay.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gst/rtp/gstrtpvrawpay.c b/gst/rtp/gstrtpvrawpay.c index 11bd360c80..fa43ac87a7 100644 --- a/gst/rtp/gstrtpvrawpay.c +++ b/gst/rtp/gstrtpvrawpay.c @@ -282,6 +282,7 @@ gst_rtp_vraw_pay_handle_buffer (GstRTPBasePayload * payload, GstBuffer * buffer) gboolean use_buffer_lists; GstBufferList *list = NULL; GstRTPBuffer rtp = { NULL, }; + gboolean discont; rtpvrawpay = GST_RTP_VRAW_PAY (payload); @@ -290,6 +291,8 @@ gst_rtp_vraw_pay_handle_buffer (GstRTPBasePayload * payload, GstBuffer * buffer) return GST_FLOW_ERROR; } + discont = GST_BUFFER_IS_DISCONT (buffer); + GST_LOG_OBJECT (rtpvrawpay, "new frame of %" G_GSIZE_FORMAT " bytes", gst_buffer_get_size (buffer)); @@ -352,6 +355,12 @@ gst_rtp_vraw_pay_handle_buffer (GstRTPBasePayload * payload, GstBuffer * buffer) left = gst_rtp_buffer_calc_payload_len (mtu, 0, 0); out = gst_rtp_buffer_new_allocate (left, 0, 0); + if (discont) { + GST_BUFFER_FLAG_SET (out, GST_BUFFER_FLAG_DISCONT); + /* Only the first outputted buffer has the DISCONT flag */ + discont = FALSE; + } + if (field == 0) { GST_BUFFER_PTS (out) = GST_BUFFER_PTS (buffer); } else {