qtdemux: mind rounding issues when converting from global time to mov time
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Thu, 27 Jan 2011 11:16:46 +0000 (12:16 +0100)
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Thu, 27 Jan 2011 11:27:38 +0000 (12:27 +0100)
In particular, this avoids missing the intended keyframe when first converting
from the frame's mov time to global segment time, and then back from global
time to mov time when activating the segment.

gst/qtdemux/qtdemux.c

index 2076ba9..b6457ce 100644 (file)
@@ -848,7 +848,8 @@ gst_qtdemux_find_index (GstQTDemux * qtdemux, QtDemuxStream * str,
   guint32 index;
 
   /* convert media_time to mov format */
-  media_time = gst_util_uint64_scale (media_time, str->timescale, GST_SECOND);
+  media_time =
+      gst_util_uint64_scale_ceil (media_time, str->timescale, GST_SECOND);
 
   result = gst_util_array_binary_search (str->samples, str->stbl_index + 1,
       sizeof (QtDemuxSample), (GCompareDataFunc) find_func,