summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2018-02-28 19:19:10 +0200
committerSebastian Dröge <sebastian@centricular.com>2018-02-28 19:20:23 +0200
commit15ae79838caa6ee9494bece791b5221b9696c41a (patch)
tree001b4655f3c2ccbcd1152d2a4733a4fd81ab5ec7
parentfc37bf70c5f421e61a41307a7c9707098d0e728f (diff)
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 <nicola.murino@gmail.com> https://bugzilla.gnome.org/show_bug.cgi?id=792775
-rw-r--r--gst/matroska/matroska-mux.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gst/matroska/matroska-mux.c b/gst/matroska/matroska-mux.c
index 0a05ba2d6..78cffe88c 100644
--- a/gst/matroska/matroska-mux.c
+++ b/gst/matroska/matroska-mux.c
@@ -3725,7 +3725,8 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaPad * collect_pad,
mux->min_cluster_duration));
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,