videomixer: Send EOS if buf_end >= segment.stop
authorThibault Saunier <thibault.saunier@collabora.com>
Wed, 7 Aug 2013 17:32:07 +0000 (19:32 +0200)
committerThibault Saunier <thibault.saunier@collabora.com>
Sun, 11 Aug 2013 17:05:18 +0000 (19:05 +0200)
That means the whole segment is already played, and we are sure we
are EOS at that point.

Also handle segment seeks, and do not send EOS in that case.

gst/videomixer/videomixer2.c
tests/check/elements/videomixer.c

index 27c4c06..9c6398f 100644 (file)
@@ -1009,13 +1009,15 @@ gst_videomixer2_collected (GstCollectPads * pads, GstVideoMixer2 * mix)
       GST_SECOND * GST_VIDEO_INFO_FPS_D (&mix->info),
       GST_VIDEO_INFO_FPS_N (&mix->info)) + mix->segment.start;
 
-  if (output_start_time >= mix->segment.stop ||
-      output_end_time == mix->segment.stop) {
+  if (output_end_time >= mix->segment.stop) {
     GST_DEBUG_OBJECT (mix, "Segment done");
     GST_VIDEO_MIXER2_UNLOCK (mix);
-    gst_pad_push_event (mix->srcpad, gst_event_new_eos ());
-    ret = GST_FLOW_EOS;
-    goto done_unlocked;
+    if (!(mix->segment.flags & GST_SEGMENT_FLAG_SEGMENT)) {
+      gst_pad_push_event (mix->srcpad, gst_event_new_eos ());
+
+      ret = GST_FLOW_EOS;
+      goto done_unlocked;
+    }
   }
 
   if (mix->segment.stop != -1)
index d2de07a..7296cb3 100644 (file)
@@ -930,8 +930,8 @@ GST_START_TEST (test_loop)
 
   seek_event = gst_event_new_seek (1.0, GST_FORMAT_TIME,
       GST_SEEK_FLAG_SEGMENT | GST_SEEK_FLAG_FLUSH,
-      GST_SEEK_TYPE_SET, (GstClockTime) 0,
-      GST_SEEK_TYPE_SET, (GstClockTime) 1 * GST_SECOND);
+      GST_SEEK_TYPE_SET, (GstClockTime) 0, GST_SEEK_TYPE_SET,
+      (GstClockTime) 2 * GST_SECOND);
 
   main_loop = g_main_loop_new (NULL, FALSE);
   g_signal_connect (bus, "message::segment-done",
@@ -947,7 +947,9 @@ GST_START_TEST (test_loop)
   ck_assert_int_ne (state_res, GST_STATE_CHANGE_FAILURE);
 
   /* wait for completion */
-  state_res = gst_element_get_state (bin, NULL, NULL, GST_CLOCK_TIME_NONE);
+  state_res =
+      gst_element_get_state (GST_ELEMENT (bin), NULL, NULL,
+      GST_CLOCK_TIME_NONE);
   ck_assert_int_ne (state_res, GST_STATE_CHANGE_FAILURE);
 
   res = gst_element_send_event (bin, seek_event);