mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-17 21:06:17 +00:00
decklink: wait for stop with a timeout
Decklink sometimes does not notify us through the callback that it has stopped scheduled playback either because it was uncleanly shutdown without an explicit stop or for unknown other reasons. Wait on the cond for a short amount of time before checking if scheduled playback has stopped without notification. https://bugzilla.gnome.org/show_bug.cgi?id=797130
This commit is contained in:
parent
bf849e9a69
commit
946cbbccc1
1 changed files with 17 additions and 9 deletions
|
@ -852,6 +852,21 @@ gst_decklink_video_sink_stop (GstDecklinkVideoSink * self)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_wait_for_stop_notify (GstDecklinkVideoSink *self)
|
||||
{
|
||||
bool active = false;
|
||||
|
||||
self->output->output->IsScheduledPlaybackRunning (&active);
|
||||
while (active) {
|
||||
/* cause sometimes decklink stops without notifying us... */
|
||||
guint64 wait_time = g_get_monotonic_time () + G_TIME_SPAN_SECOND;
|
||||
if (!g_cond_wait_until (&self->output->cond, &self->output->lock, wait_time))
|
||||
GST_WARNING_OBJECT (self, "Failed to wait for stop notification");
|
||||
self->output->output->IsScheduledPlaybackRunning (&active);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_decklink_video_sink_start_scheduled_playback (GstElement * element)
|
||||
{
|
||||
|
@ -923,10 +938,7 @@ gst_decklink_video_sink_start_scheduled_playback (GstElement * element)
|
|||
return;
|
||||
}
|
||||
// Wait until scheduled playback actually stopped
|
||||
do {
|
||||
g_cond_wait (&self->output->cond, &self->output->lock);
|
||||
self->output->output->IsScheduledPlaybackRunning (&active);
|
||||
} while (active);
|
||||
_wait_for_stop_notify (self);
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT (self,
|
||||
|
@ -986,13 +998,9 @@ gst_decklink_video_sink_stop_scheduled_playback (GstDecklinkVideoSink * self)
|
|||
res));
|
||||
ret = GST_STATE_CHANGE_FAILURE;
|
||||
} else {
|
||||
bool active = false;
|
||||
|
||||
// Wait until scheduled playback actually stopped
|
||||
do {
|
||||
g_cond_wait (&self->output->cond, &self->output->lock);
|
||||
self->output->output->IsScheduledPlaybackRunning (&active);
|
||||
} while (active);
|
||||
_wait_for_stop_notify (self);
|
||||
}
|
||||
if (start_time > 0)
|
||||
self->scheduled_stop_time = start_time;
|
||||
|
|
Loading…
Reference in a new issue