mpegtsmux: Properly detect backward DTS

There was code to detect backward dts, but the marker min_dts
was never set. Setting it enable this feature that prevents
potential integer overflow when generating TS.

https://bugzilla.gnome.org/show_bug.cgi?id=740575
This commit is contained in:
Nicolas Dufresne 2015-06-10 11:39:01 -04:00
parent b23e4452a2
commit 91cbaa5ac7

View file

@ -1067,14 +1067,19 @@ mpegtsmux_clip_inc_running_time (GstCollectPads * pads,
GST_LOG_OBJECT (cdata->pad, "buffer dts %" GST_TIME_FORMAT " -> %"
GST_TIME_FORMAT " running time",
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)), GST_TIME_ARGS (time));
if (GST_CLOCK_TIME_IS_VALID (pad_data->min_dts) &&
time < pad_data->min_dts) {
if (!GST_CLOCK_TIME_IS_VALID (pad_data->min_dts))
pad_data->min_dts = time;
if (time < pad_data->min_dts) {
/* Ignore DTS going backward */
GST_WARNING_OBJECT (cdata->pad, "ignoring DTS going backward");
time = pad_data->min_dts;
}
*outbuf = gst_buffer_make_writable (buf);
GST_BUFFER_DTS (*outbuf) = time;
pad_data->min_dts = time;
}
}