mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-08 18:39:54 +00:00
matroskademux: Fix cluster searching if we search multiple times in one chunk
After finding a cluster id in the byte reader, we skip ahead the reader position by one further byte to be able to continue searching from there inside the same chunk if the cluster candidate was a false positive. We have to accomodate for that additional byte when resuming the search, otherwise all following pulls are off-by-one for every resume and we run into an assertion.
This commit is contained in:
parent
c0da05df38
commit
5d4c71d76e
1 changed files with 11 additions and 2 deletions
|
@ -1766,13 +1766,22 @@ gst_matroska_demux_search_cluster (GstMatroskaDemux * demux, gint64 * pos)
|
||||||
demux->common.offset += length + needed;
|
demux->common.offset += length + needed;
|
||||||
ret = gst_matroska_read_common_peek_id_length_pull (&demux->common,
|
ret = gst_matroska_read_common_peek_id_length_pull (&demux->common,
|
||||||
GST_ELEMENT_CAST (demux), &id, &length, &needed);
|
GST_ELEMENT_CAST (demux), &id, &length, &needed);
|
||||||
if (ret != GST_FLOW_OK)
|
if (ret != GST_FLOW_OK) {
|
||||||
|
/* we skipped one byte in the reader above, need to accomodate for
|
||||||
|
* that when resuming skipping from the reader instead of reading a
|
||||||
|
* new chunk */
|
||||||
|
newpos += 1;
|
||||||
goto resume;
|
goto resume;
|
||||||
|
}
|
||||||
GST_DEBUG_OBJECT (demux, "next element is %scluster",
|
GST_DEBUG_OBJECT (demux, "next element is %scluster",
|
||||||
id == GST_MATROSKA_ID_CLUSTER ? "" : "not ");
|
id == GST_MATROSKA_ID_CLUSTER ? "" : "not ");
|
||||||
if (id == GST_MATROSKA_ID_CLUSTER)
|
if (id == GST_MATROSKA_ID_CLUSTER)
|
||||||
break;
|
break;
|
||||||
/* not ok, resume */
|
/* not ok, resume
|
||||||
|
* we skipped one byte in the reader above, need to accomodate for
|
||||||
|
* that when resuming skipping from the reader instead of reading a
|
||||||
|
* new chunk */
|
||||||
|
newpos += 1;
|
||||||
goto resume;
|
goto resume;
|
||||||
} else {
|
} else {
|
||||||
/* partial cluster id may have been in tail of buffer */
|
/* partial cluster id may have been in tail of buffer */
|
||||||
|
|
Loading…
Reference in a new issue