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.
This commit is contained in:
Thibault Saunier 2013-08-07 19:32:07 +02:00
parent 96afba915a
commit 6c349d6ec3
2 changed files with 12 additions and 8 deletions

View 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)

View 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);