/* having flushed above, can check for buffers now */
if (GST_CLOCK_TIME_IS_VALID (qtpad->first_ts)) {
+ GstClockTime first_pts_in = qtpad->first_ts;
+ /* it should be, since we got first_ts by adding adjustment
+ * to a positive incoming PTS */
+ if (qtpad->dts_adjustment <= first_pts_in)
+ first_pts_in -= qtpad->dts_adjustment;
/* determine max stream duration */
if (!GST_CLOCK_TIME_IS_VALID (qtmux->last_dts)
|| qtpad->last_dts > qtmux->last_dts) {
qtmux->last_dts = qtpad->last_dts;
}
if (!GST_CLOCK_TIME_IS_VALID (qtmux->first_ts)
- || qtpad->first_ts < qtmux->first_ts) {
- qtmux->first_ts = qtpad->first_ts;
+ || first_pts_in < qtmux->first_ts) {
+ /* we need the original incoming PTS here, as this first_ts
+ * is used in update_edit_lists to construct the edit list that arrange
+ * for sync'ed streams. The first_ts is most likely obtained from
+ * some (audio) stream with 0 dts_adjustment and initial 0 PTS,
+ * so it makes no difference, though it matters in other cases */
+ qtmux->first_ts = first_pts_in;
}
}
/* store the first timestamp for comparing with other streams and
* know if there are late streams */
+ /* subjected to dts adjustment */
GstClockTime first_ts;
GstClockTime first_dts;
/* keep track of the largest chunk to fine-tune brands */
GstClockTime longest_chunk;
- /* Earliest timestamp across all pads/traks */
+ /* Earliest timestamp across all pads/traks
+ * (unadjusted incoming PTS) */
GstClockTime first_ts;
/* Last DTS across all pads (= duration) */
GstClockTime last_dts;