videomixer: check last end_time after conversion to running segment
authorMathieu Duponchelle <mathieu.duponchelle@epitech.eu>
Tue, 11 Jun 2013 17:24:49 +0000 (19:24 +0200)
committerSebastian Dröge <slomo@circular-chaos.org>
Tue, 11 Jun 2013 19:03:35 +0000 (21:03 +0200)
The last end_time was saved after conversion, so the comparison
had to be made after conversion for it to make sense.

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

gst/videomixer/videomixer2.c

index 95e7d84..ae85097 100644 (file)
@@ -707,21 +707,6 @@ gst_videomixer2_fill_queues (GstVideoMixer2 * mix,
       g_assert (start_time != -1 && end_time != -1);
       end_time += start_time;   /* convert from duration to position */
 
-      if (mixcol->end_time != -1 && mixcol->end_time > end_time) {
-        GST_WARNING_OBJECT (pad, "Buffer from the past, dropping");
-        if (buf == mixcol->queued) {
-          gst_buffer_unref (buf);
-          gst_buffer_replace (&mixcol->queued, NULL);
-        } else {
-          gst_buffer_unref (buf);
-          buf = gst_collect_pads_pop (mix->collect, &mixcol->collect);
-          gst_buffer_unref (buf);
-        }
-
-        need_more_data = TRUE;
-        continue;
-      }
-
       /* Check if it's inside the segment */
       if (start_time >= segment->stop || end_time < segment->start) {
         GST_DEBUG_OBJECT (pad, "Buffer outside the segment");
@@ -755,6 +740,21 @@ gst_videomixer2_fill_queues (GstVideoMixer2 * mix,
         end_time *= ABS (mix->segment.rate);
       }
 
+      if (mixcol->end_time != -1 && mixcol->end_time > end_time) {
+        GST_DEBUG_OBJECT (pad, "Buffer from the past, dropping");
+        if (buf == mixcol->queued) {
+          gst_buffer_unref (buf);
+          gst_buffer_replace (&mixcol->queued, NULL);
+        } else {
+          gst_buffer_unref (buf);
+          buf = gst_collect_pads_pop (mix->collect, &mixcol->collect);
+          gst_buffer_unref (buf);
+        }
+
+        need_more_data = TRUE;
+        continue;
+      }
+
       if (end_time >= output_start_time && start_time < output_end_time) {
         GST_DEBUG_OBJECT (pad,
             "Taking new buffer with start time %" GST_TIME_FORMAT,