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 <identity0:sink>
             Detected on <identity0:src>
             Detected on <fakesink0:sink>
             Description : Buffers after SEGMENT and FLUSH must have a DISCONT flag

Issues found: 1

=======> Test PASSED (Return value: 0)
This commit is contained in:
Antonio Ospite 2019-04-08 11:35:34 +02:00 committed by Sebastian Dröge
parent 92138dc3d6
commit 61c1385c42

View file

@ -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 {