Check if the buffer is DISCONT before making a potentially expensive copy to
unset the DISCONT flag.
if (stream) {
stream->seen_data = TRUE;
if (stream->drop_discont) {
- buffer = gst_buffer_make_writable (buffer);
- GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_DISCONT);
+ if (GST_BUFFER_IS_DISCONT (buffer)) {
+ GST_DEBUG_OBJECT (pad, "removing DISCONT from buffer %p", buffer);
+ buffer = gst_buffer_make_writable (buffer);
+ GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_DISCONT);
+ }
stream->drop_discont = FALSE;
}