rtpbasedepay: when setting discont flag make sure rtpbuffer is current

Depayloaders will look at rtpbuffer->buffer for the discont flag.
When we set the discont flag on a buffer in the rtp base depayloader
and we have to make the buffer writable, make sure the rtpbuffer
actually contains the newly-flagged buffer, not the original input
buffer. This was introduced with the addition of the process_rtp_packet
vfunc, but would only trigger if the input buffer wasn't flagged
already and was not writable already.
This commit is contained in:
Tim-Philipp Müller 2015-12-11 11:01:53 +00:00
parent 29cd7966b7
commit f0db396e63

View file

@ -426,11 +426,21 @@ gst_rtp_base_depayload_handle_buffer (GstRTPBaseDepayload * filter,
if (G_UNLIKELY (discont)) {
priv->discont = TRUE;
if (!buf_discont) {
gpointer old_inbuf = in;
/* we detected a seqnum discont but the buffer was not flagged with a discont,
* set the discont flag so that the subclass can throw away old data. */
GST_LOG_OBJECT (filter, "mark DISCONT on input buffer");
in = gst_buffer_make_writable (in);
GST_BUFFER_FLAG_SET (in, GST_BUFFER_FLAG_DISCONT);
/* depayloaders will check flag on rtpbuffer->buffer, so if the input
* buffer was not writable already we need to remap to make our
* newly-flagged buffer current on the rtpbuffer */
if (in != old_inbuf) {
gst_rtp_buffer_unmap (&rtp);
if (G_UNLIKELY (!gst_rtp_buffer_map (in, GST_MAP_READ, &rtp)))
goto invalid_buffer;
}
}
}