qtmux: Avoid a buffer metadata copy if possible

If first_ts is 0 there is no need to subtract, so we might
skip some copying to make the buffer metadata writable.
This commit is contained in:
Thiago Santos 2011-09-28 10:41:14 -03:00
parent ca77c96c51
commit 4737090594

View file

@ -2128,7 +2128,8 @@ gst_qt_mux_add_buffer (GstQTMux * qtmux, GstQTPad * pad, GstBuffer * buf)
buf = pad->prepare_buf_func (pad, buf, qtmux);
}
if (G_LIKELY (buf != NULL && GST_CLOCK_TIME_IS_VALID (pad->first_ts))) {
if (G_LIKELY (buf != NULL && GST_CLOCK_TIME_IS_VALID (pad->first_ts) &&
pad->first_ts != 0)) {
buf = gst_buffer_make_metadata_writable (buf);
check_and_subtract_ts (qtmux, &GST_BUFFER_TIMESTAMP (buf), pad->first_ts);
}