Commit 6b889bea authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

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.
parent eb307baf
......@@ -3234,6 +3234,7 @@ gst_qt_mux_add_buffer (GstQTMux * qtmux, GstQTPad * pad, GstBuffer * buf)
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)
} else {
timestamp = GST_BUFFER_DTS_OR_PTS (tmp_buf);
if (qtpad->last_buf)
timestamp = GST_BUFFER_DTS_OR_PTS (qtpad->last_buf);
timestamp = GST_BUFFER_DTS_OR_PTS (tmp_buf);
if (best_pad == NULL ||
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment