From ebfc77da194911ebbfa94af3fab06203a74004bf Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Tue, 13 Dec 2011 18:18:45 +0100 Subject: [PATCH] matroskademux: filter bogus index entries with missing block number ... to avoid contradictory information resulting in seeks sending more downstream than needed for the corresponding segment. --- gst/matroska/matroska-read-common.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/gst/matroska/matroska-read-common.c b/gst/matroska/matroska-read-common.c index 5fd178f..188dea9 100644 --- a/gst/matroska/matroska-read-common.c +++ b/gst/matroska/matroska-read-common.c @@ -982,6 +982,21 @@ gst_matroska_read_common_parse_index_cuetrack (GstMatroskaReadCommon * common, DEBUG_ELEMENT_STOP (common, ebml, "CueTrackPositions", ret); + /* (e.g.) lavf typically creates entries without a block number, + * which is bogus and leads to contradictory information */ + if (common->index->len) { + GstMatroskaIndex *last_idx; + + last_idx = &g_array_index (common->index, GstMatroskaIndex, + common->index->len - 1); + if (last_idx->block == idx.block && last_idx->pos == idx.pos && + last_idx->track == idx.track && idx.time > last_idx->time) { + GST_DEBUG_OBJECT (common, "Cue entry refers to same location, " + "but has different time than previous entry; discarding"); + idx.track = 0; + } + } + if ((ret == GST_FLOW_OK || ret == GST_FLOW_UNEXPECTED) && idx.pos != (guint64) - 1 && idx.track > 0) { g_array_append_val (common->index, idx); -- 2.7.4