From 7a9a72f98475dde4debc402d2a75376a9607b836 Mon Sep 17 00:00:00 2001 From: Tom Finegan Date: Fri, 20 Jan 2012 15:59:38 -0500 Subject: [PATCH] mkvmuxer: Disallow non-monotonically increasing timestamps. Segment::AddFrame will now return false (fail) when a non-monotonically increasing timestamp value is passed to the method. Change-Id: Icfac093e6bddf18e3ef252df79e35c33dbe1e134 --- mkvmuxer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mkvmuxer.cpp b/mkvmuxer.cpp index c8051bc..d19e328 100644 --- a/mkvmuxer.cpp +++ b/mkvmuxer.cpp @@ -1575,6 +1575,10 @@ bool Segment::AddFrame(const uint8* frame, if (!CheckHeaderInfo()) return false; + // Check for non-monotonically increasing timestamps. + if (timestamp < last_timestamp_) + return false; + // If the segment has a video track hold onto audio frames to make sure the // audio that is associated with the start time of a video key-frame is // muxed into the same cluster.