qtmux: Don't write invalid edit list start time.
authorJan Schmidt <jan@centricular.com>
Thu, 17 Dec 2015 18:17:15 +0000 (05:17 +1100)
committerJan Schmidt <jan@centricular.com>
Fri, 18 Dec 2015 16:49:28 +0000 (03:49 +1100)
Avoid writing a negative number as a large positive
integer in an edit list when the first_ts is smaller
than the first_dts - which can happen when the first
packet received has a PTS but no DTS.

https://bugzilla.gnome.org/show_bug.cgi?id=759615

gst/isomp4/gstqtmux.c

index 6f1dd3f2673ee1b97a21cf94fd6d3a2cc3d42e82..9ac7c77e81987b41bca7603d4033cbe18a8af5df 100644 (file)
@@ -2481,10 +2481,12 @@ gst_qt_mux_update_edit_lists (GstQTMux * qtmux)
 
       /* has shift */
       if (has_gap || (qtpad->dts_adjustment > 0)) {
-        GstClockTime ctts;
+        GstClockTime ctts = 0;
         guint32 media_start;
 
-        ctts = qtpad->first_ts - qtpad->first_dts;
+        if (qtpad->first_ts > qtpad->first_dts)
+          ctts = qtpad->first_ts - qtpad->first_dts;
+
         media_start = gst_util_uint64_scale_round (ctts,
             atom_trak_get_timescale (qtpad->trak), GST_SECOND);