summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2011-02-09 16:22:47 +0100
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2011-02-09 16:27:00 +0100
commit9de84b45bcbd43e2e96b0287355f5695bc911280 (patch)
treee4bd0766296e6d41bd489a68d64f8d77cbf20f02
parenta86bab66893bb1a3323a756410573c117b8219ef (diff)
matroskademux: properly resume cluster scanning
... rather than getting offset tracking messed up, and then likely failing a subsequent assert.
-rw-r--r--gst/matroska/matroska-demux.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c
index 4541b44c0..f1b2b783f 100644
--- a/gst/matroska/matroska-demux.c
+++ b/gst/matroska/matroska-demux.c
@@ -2353,13 +2353,13 @@ gst_matroska_demux_search_cluster (GstMatroskaDemux * demux, gint64 * pos)
GST_DEBUG_OBJECT (demux, "read buffer size %d at offset %" G_GINT64_FORMAT,
GST_BUFFER_SIZE (buf), newpos);
gst_byte_reader_init_from_buffer (&reader, buf);
- cluster_pos = 0;
resume:
cluster_pos = gst_byte_reader_masked_scan_uint32 (&reader, 0xffffffff,
- GST_MATROSKA_ID_CLUSTER, cluster_pos,
- GST_BUFFER_SIZE (buf) - cluster_pos);
+ GST_MATROSKA_ID_CLUSTER, 0, gst_byte_reader_get_remaining (&reader));
if (cluster_pos >= 0) {
newpos += cluster_pos;
+ /* prepare resuming at next byte */
+ gst_byte_reader_skip (&reader, cluster_pos + 1);
GST_DEBUG_OBJECT (demux,
"found cluster ebml id at offset %" G_GINT64_FORMAT, newpos);
/* extra checks whether we really sync'ed to a cluster:
@@ -2399,7 +2399,7 @@ gst_matroska_demux_search_cluster (GstMatroskaDemux * demux, gint64 * pos)
goto resume;
} else {
/* partial cluster id may have been in tail of buffer */
- newpos += MAX (GST_BUFFER_SIZE (buf), 4) - 3;
+ newpos += MAX (gst_byte_reader_get_remaining (&reader), 4) - 3;
gst_buffer_unref (buf);
buf = NULL;
}