From 6c349d6ec3f633d2535ec52b5c077b731a153459 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Wed, 7 Aug 2013 19:32:07 +0200 Subject: [PATCH] videomixer: Send EOS if buf_end >= segment.stop 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 | 12 +++++++----- tests/check/elements/videomixer.c | 8 +++++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/gst/videomixer/videomixer2.c b/gst/videomixer/videomixer2.c index 27c4c06..9c6398f 100644 --- a/gst/videomixer/videomixer2.c +++ b/gst/videomixer/videomixer2.c @@ -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) diff --git a/tests/check/elements/videomixer.c b/tests/check/elements/videomixer.c index d2de07a..7296cb3 100644 --- a/tests/check/elements/videomixer.c +++ b/tests/check/elements/videomixer.c @@ -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); -- 2.7.4