diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2018-02-28 19:19:10 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2018-03-13 16:04:17 +0200 |
commit | 10b7f5d54d753446f3ee20abfe3d6154603fdd52 (patch) | |
tree | 538f6a8e0e4ab779aa0c79f0da26cbbec6af422a | |
parent | b4ad5d8dc30a1cbb4b70a759765bcce147260d59 (diff) | |
download | gstreamer-plugins-good-10b7f5d54d753446f3ee20abfe3d6154603fdd52.tar.gz |
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.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gst/matroska/matroska-mux.c b/gst/matroska/matroska-mux.c index 50c4d45f5..bcdb0309f 100644 --- a/gst/matroska/matroska-mux.c +++ b/gst/matroska/matroska-mux.c @@ -3648,7 +3648,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, |