From 9c121b09a52379762d362eb9c616b14ec75c7ea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 22 Mar 2017 19:15:09 +0200 Subject: [PATCH] qtmux: Reset current chunk after writing out timecode If we have multiple tracks with timecodes, or it's not the first track that has timecodes, or not the first buffer, we already started a chunk for media data. We now need to "close" that chunk because we wrote data for the timecode track and a new chunk has to be started for the original track the next time it has data. --- gst/isomp4/gstqtmux.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gst/isomp4/gstqtmux.c b/gst/isomp4/gstqtmux.c index e16138a1b7..a3eb031666 100644 --- a/gst/isomp4/gstqtmux.c +++ b/gst/isomp4/gstqtmux.c @@ -3157,6 +3157,13 @@ gst_qt_mux_check_and_update_timecode (GstQTMux * qtmux, GstQTPad * pad, atom_trak_add_samples (pad->tc_trak, 1, 1, 4, qtmux->mdat_size, FALSE, 0); ret = gst_qt_mux_send_buffer (qtmux, tc_buf, &qtmux->mdat_size, TRUE); + + /* Need to reset the current chunk (of the previous pad) here because + * some other data was written now above, and the pad has to start a + * new chunk now */ + qtmux->current_chunk_offset = -1; + qtmux->current_chunk_size = 0; + qtmux->current_chunk_duration = 0; } else if (pad->is_out_of_order) { /* Check for a lower timecode than the one stored */ g_assert (pad->tc_trak != NULL);