Commit 15ae7983 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

matroskamux: Clip maximum cluster duration to the maximum possible value

Only up to timescale * G_MAXINT16 is possible as cluster duration, which
is already higher than our default value. Using higher values would
cause overflows and broken files.

Based on the investigation by Nicola Murino <>
parent fc37bf70
......@@ -3725,7 +3725,8 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaPad * collect_pad,
is_max_duration_exceeded = (mux->max_cluster_duration > 0
&& buffer_timestamp > mux->cluster_time
&& (buffer_timestamp - mux->cluster_time) >= mux->max_cluster_duration);
&& (buffer_timestamp - mux->cluster_time) >=
MIN (G_MAXINT16 * mux->time_scale, mux->max_cluster_duration));
if (mux->cluster) {
/* start a new cluster at every keyframe, at every GstForceKeyUnit event,
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment