matroskademux: do not error out on a block with unknown tracknumber
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Fri, 9 Jul 2010 14:57:33 +0000 (16:57 +0200)
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Fri, 16 Jul 2010 11:58:39 +0000 (13:58 +0200)
gst/matroska/matroska-demux.c

index 1b34b9f9bf674249c9428ba81b1499bfe90c5fb5..ac104469f611d9f53c026235571d55f2af3071d7 100644 (file)
@@ -4405,13 +4405,17 @@ gst_matroska_demux_parse_blockgroup_or_simpleblock (GstMatroskaDemux * demux,
 
         /* fetch stream from num */
         stream_num = gst_matroska_demux_stream_from_num (demux, num);
-        if (size < 3 || stream_num < 0 || stream_num >= demux->num_streams) {
-          gst_buffer_unref (buf);
-          buf = NULL;
-          GST_WARNING_OBJECT (demux, "Invalid stream %d or size %u", stream_num,
-              size);
+        if (G_UNLIKELY (size < 3)) {
+          GST_WARNING_OBJECT (demux, "Invalid size %u", size);
           ret = GST_FLOW_ERROR;
           break;
+        } else if (G_UNLIKELY (stream_num < 0 ||
+                stream_num >= demux->num_streams)) {
+          /* let's not give up on a stray invalid track number */
+          GST_WARNING_OBJECT (demux,
+              "Invalid stream %d for track number %" G_GUINT64_FORMAT
+              "; ignoring block", stream_num);
+          break;
         }
 
         stream = g_ptr_array_index (demux->src, stream_num);