[0.11] gst-plugins-good: matroskademux: filter bogus index entries with missing block number

Sebastian Dröge slomo at kemper.freedesktop.org
Tue Jan 10 05:33:07 PST 2012


Module: gst-plugins-good
Branch: 0.11
Commit: ebfc77da194911ebbfa94af3fab06203a74004bf
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=ebfc77da194911ebbfa94af3fab06203a74004bf

Author: Mark Nauwelaerts <mark.nauwelaerts at collabora.co.uk>
Date:   Tue Dec 13 18:18:45 2011 +0100

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 files changed, 15 insertions(+), 0 deletions(-)

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);



More information about the gstreamer-commits mailing list