} else
ref = pkt->dts; // Skip tests for the first packet
+ if (trk->dts_shift != AV_NOPTS_VALUE) {
+ /* With negative CTS offsets we have set an offset to the DTS,
+ * reverse this for the check. */
+ ref -= trk->dts_shift;
+ }
+
duration = pkt->dts - ref;
if (pkt->dts < ref || duration >= INT_MAX) {
av_log(s, AV_LOG_ERROR, "Application provided duration: %"PRId64" / timestamp: %"PRId64" is out of range for mov/mp4 format\n",