demux->invalid_duration = FALSE;
+ demux->cached_length = G_MAXUINT64;
+
gst_flow_combiner_clear (demux->flowcombiner);
}
}
next:
- if (G_UNLIKELY (demux->common.offset ==
- gst_matroska_read_common_get_length (&demux->common))) {
- GST_LOG_OBJECT (demux, "Reached end of stream");
- ret = GST_FLOW_EOS;
- goto eos;
+ if (G_UNLIKELY (demux->cached_length == G_MAXUINT64 ||
+ demux->common.offset >= demux->cached_length)) {
+ demux->cached_length = gst_matroska_read_common_get_length (&demux->common);
+ if (demux->common.offset == demux->cached_length) {
+ GST_LOG_OBJECT (demux, "Reached end of stream");
+ ret = GST_FLOW_EOS;
+ goto eos;
+ }
}
return;
/* for non-finalized files, with invalid segment duration */
gboolean invalid_duration;
+
+ /* Cached upstream length (default G_MAXUINT64) */
+ guint64 cached_length;
} GstMatroskaDemux;
typedef struct _GstMatroskaDemuxClass {