qtmux: Select the best pad based on the cached last_buf if any

last_buf is the one we're going to write next, not buf. As such we
should check timestamps against that one if there is one to select the
earliest pad.

Also remember the currently selected pad in the very beginning when
storing the first last_buf.

This both solves some edge cases where not the correct next pad was
selected corresponding to the target interleave.
This commit is contained in:
Sebastian Dröge 2017-04-04 15:08:33 +03:00
parent eb307baff4
commit 6b889bea69

View file

@ -3234,6 +3234,7 @@ gst_qt_mux_add_buffer (GstQTMux * qtmux, GstQTPad * pad, GstBuffer * buf)
}
#endif
pad->last_buf = buf;
qtmux->current_pad = pad;
goto exit;
} else {
gst_buffer_ref (last_buf);
@ -3600,7 +3601,10 @@ find_best_pad (GstQTMux * qtmux, GstCollectPads * pads)
continue;
}
} else {
timestamp = GST_BUFFER_DTS_OR_PTS (tmp_buf);
if (qtpad->last_buf)
timestamp = GST_BUFFER_DTS_OR_PTS (qtpad->last_buf);
else
timestamp = GST_BUFFER_DTS_OR_PTS (tmp_buf);
}
if (best_pad == NULL ||