From 643e6fdc363b48af7b62536cd084215e66178393 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Sat, 23 Nov 2013 12:15:40 +0100 Subject: [PATCH] matroskamux: correctly handle negative relative timestamps ... rather than scaling these as unsigned. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=712744 Based on patch by Krzysztof Kotlenga --- gst/matroska/matroska-mux.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gst/matroska/matroska-mux.c b/gst/matroska/matroska-mux.c index e8b64f6480..e1cf9ea27f 100644 --- a/gst/matroska/matroska-mux.c +++ b/gst/matroska/matroska-mux.c @@ -3381,12 +3381,15 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaPad * collect_pad, if (relative_timestamp64 >= 0) { /* round the timestamp */ relative_timestamp64 += gst_util_uint64_scale (mux->time_scale, 1, 2); + relative_timestamp = gst_util_uint64_scale (relative_timestamp64, 1, + mux->time_scale); } else { /* round the timestamp */ relative_timestamp64 -= gst_util_uint64_scale (mux->time_scale, 1, 2); + relative_timestamp = + -((gint16) gst_util_uint64_scale (-relative_timestamp64, 1, + mux->time_scale)); } - relative_timestamp = gst_util_uint64_scale (relative_timestamp64, 1, - mux->time_scale); if (is_video_invisible) flags |= 0x08;