qtdemux: Don't assert in prefill mode if a track has no samples at all

Just write it with a duration of 0, no samples, etc.
This commit is contained in:
Sebastian Dröge 2018-07-31 12:47:47 +03:00
parent 6ce2a5f7bf
commit 7679412b69

View File

@ -3615,21 +3615,15 @@ gst_qt_mux_stop_file (GstQTMux * qtmux)
for (walk = qtmux->collect->data; walk; walk = g_slist_next (walk)) {
GstCollectData *cdata = (GstCollectData *) walk->data;
GstQTPad *qpad = (GstQTPad *) cdata;
const TrakBufferEntryInfo *sample_entry;
guint64 block_idx;
AtomSTBL *stbl = &qpad->trak->mdia.minf.stbl;
/* Get the block index of the last sample we wrote, not of the next
* sample we would write */
block_idx = prefill_get_block_index (qtmux, qpad);
g_assert (block_idx > 0);
block_idx--;
sample_entry =
&g_array_index (qpad->samples, TrakBufferEntryInfo, block_idx);
/* stts */
{
if (block_idx > 0) {
STTSEntry *entry;
guint64 nsamples = 0;
gint i, n;
@ -3645,6 +3639,8 @@ gst_qt_mux_stop_file (GstQTMux * qtmux)
nsamples += entry->sample_count;
}
g_assert (i < n);
} else {
stbl->stts.entries.len = 0;
}
/* stsz */
@ -3658,6 +3654,12 @@ gst_qt_mux_stop_file (GstQTMux * qtmux)
gint i, n;
guint64 nsamples = 0;
gint chunk_index = 0;
const TrakBufferEntryInfo *sample_entry;
if (block_idx > 0) {
sample_entry =
&g_array_index (qpad->samples, TrakBufferEntryInfo,
block_idx - 1);
n = stbl->stco64.entries.len;
for (i = 0; i < n; i++) {
@ -3709,6 +3711,10 @@ gst_qt_mux_stop_file (GstQTMux * qtmux)
atom_stsc_add_new_entry (&stbl->stsc, chunk_index,
qpad->sample_offset);
}
} else {
stbl->stco64.entries.len = 0;
stbl->stsc.entries.len = 0;
}
}
{