mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
matroskademux: search_cluster should find preceding cluster before target
... since failing this constraint takes search_pos by surprise which might then end up in an infinite loop. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=787538
This commit is contained in:
parent
286e1e62be
commit
cf3f195012
1 changed files with 11 additions and 3 deletions
|
@ -1703,15 +1703,23 @@ gst_matroska_demux_search_cluster (GstMatroskaDemux * demux, gint64 * pos,
|
|||
while (1) {
|
||||
GstByteReader reader;
|
||||
gint cluster_pos;
|
||||
guint toread = chunk;
|
||||
|
||||
if (!forward)
|
||||
newpos = MAX (0, newpos - chunk);
|
||||
if (!forward) {
|
||||
/* never read beyond the requested target */
|
||||
if (G_UNLIKELY (newpos < chunk)) {
|
||||
toread = newpos;
|
||||
newpos = 0;
|
||||
} else {
|
||||
newpos -= chunk;
|
||||
}
|
||||
}
|
||||
if (buf != NULL) {
|
||||
gst_buffer_unmap (buf, &map);
|
||||
gst_buffer_unref (buf);
|
||||
buf = NULL;
|
||||
}
|
||||
ret = gst_pad_pull_range (demux->common.sinkpad, newpos, chunk, &buf);
|
||||
ret = gst_pad_pull_range (demux->common.sinkpad, newpos, toread, &buf);
|
||||
if (ret != GST_FLOW_OK)
|
||||
break;
|
||||
GST_DEBUG_OBJECT (demux,
|
||||
|
|
Loading…
Reference in a new issue