decklinksrc: Process EOS even when there are no incoming video frames.

https://bugzilla.gnome.org/show_bug.cgi?id=680700
This commit is contained in:
Todd Agulnick 2013-12-14 18:12:53 -05:00 committed by Sebastian Dröge
parent d5eccb2285
commit 44b9429516

View file

@ -362,6 +362,7 @@ gst_decklink_src_send_event (GstElement * element, GstEvent * event)
case GST_EVENT_EOS:
g_atomic_int_set (&src->pending_eos, TRUE);
GST_INFO_OBJECT (src, "EOS pending");
g_cond_signal (&src->cond);
result = TRUE;
break;
break;
@ -745,7 +746,8 @@ gst_decklink_src_task (void *priv)
GST_DEBUG_OBJECT (decklinksrc, "task");
g_mutex_lock (&decklinksrc->mutex);
while (decklinksrc->video_frame == NULL && !decklinksrc->stop) {
while (decklinksrc->video_frame == NULL && !decklinksrc->stop &&
!decklinksrc->pending_eos) {
g_cond_wait (&decklinksrc->cond, &decklinksrc->mutex);
}
video_frame = decklinksrc->video_frame;
@ -763,6 +765,13 @@ gst_decklink_src_task (void *priv)
return;
}
if (g_atomic_int_compare_and_exchange (&decklinksrc->pending_eos, TRUE,
FALSE)) {
GST_INFO_OBJECT (decklinksrc, "EOS pending");
flow = GST_FLOW_EOS;
goto pause;
}
/* warning on dropped frames */
/* FIXME: post QoS message */
if (decklinksrc->dropped_frames - decklinksrc->dropped_frames_old > 0) {
@ -887,12 +896,6 @@ gst_decklink_src_task (void *priv)
else
flow = video_flow;
if (g_atomic_int_compare_and_exchange (&decklinksrc->pending_eos, TRUE,
FALSE)) {
GST_INFO_OBJECT (decklinksrc, "EOS pending");
flow = GST_FLOW_EOS;
}
if (flow != GST_FLOW_OK)
goto pause;